Best JavaScript code snippet using playwright-internal
init.mjs
Source:init.mjs
...378 }379 giraffeTranslation['x'].oninput = function() {380 const val = parseInt(giraffeTranslation['x'].value)381 master.giraffe.bodyLocation[0] = val382 master.giraffe.transformModel()383 master.giraffe.updateTransform()384 render(master);385 }386 giraffeTranslation['y'].oninput = function() {387 const val = parseInt(giraffeTranslation['y'].value)388 master.giraffe.bodyLocation[1] = val389 master.giraffe.transformModel()390 master.giraffe.updateTransform()391 render(master);392 }393 giraffeTranslation['z'].oninput = function() {394 const val = parseInt(giraffeTranslation['z'].value)395 master.giraffe.bodyLocation[2] = val396 master.giraffe.transformModel()397 master.giraffe.updateTransform()398 render(master);399 }400 giraffeBodyRotation['x'].oninput = function() {401 const val = parseInt(giraffeBodyRotation['x'].value)402 master.giraffe.inRotation['body']['x'] = val403 master.giraffe.transformModel()404 master.giraffe.updateTransform()405 render(master)406 }407 giraffeBodyRotation['y'].oninput = function() {408 const val = parseInt(giraffeBodyRotation['y'].value)409 master.giraffe.inRotation['body']['y'] = val410 master.giraffe.transformModel()411 master.giraffe.updateTransform()412 render(master)413 }414 giraffeBodyRotation['z'].oninput = function() {415 const val = parseInt(giraffeBodyRotation['z'].value)416 master.giraffe.inRotation['body']['z'] = val417 master.giraffe.transformModel()418 master.giraffe.updateTransform()419 render(master)420 }421 giraffeNeckRotation['x'].oninput = function() {422 const val = parseInt(giraffeNeckRotation['x'].value)423 master.giraffe.inRotation['neck']['x'] = val424 master.giraffe.transformModel()425 master.giraffe.updateTransform()426 render(master)427 }428 giraffeNeckRotation['y'].oninput = function() {429 const val = parseInt(giraffeNeckRotation['y'].value)430 master.giraffe.inRotation['neck']['y'] = val431 master.giraffe.transformModel()432 master.giraffe.updateTransform()433 render(master)434 }435 giraffeNeckRotation['z'].oninput = function() {436 const val = parseInt(giraffeNeckRotation['z'].value)437 master.giraffe.inRotation['neck']['z'] = val438 master.giraffe.transformModel()439 master.giraffe.updateTransform()440 render(master)441 }442 giraffeHeadRotation['x'].oninput = function() {443 const val = parseInt(giraffeHeadRotation['x'].value)444 master.giraffe.inRotation['head']['x'] = val445 master.giraffe.transformModel()446 master.giraffe.updateTransform()447 render(master)448 }449 giraffeHeadRotation['y'].oninput = function() {450 const val = parseInt(giraffeHeadRotation['y'].value)451 master.giraffe.inRotation['head']['y'] = val452 master.giraffe.transformModel()453 master.giraffe.updateTransform()454 render(master)455 }456 giraffeHeadRotation['z'].oninput = function() {457 const val = parseInt(giraffeHeadRotation['z'].value)458 master.giraffe.inRotation['head']['z'] = val459 master.giraffe.transformModel()460 master.giraffe.updateTransform()461 render(master)462 }463 giraffeLegFrontLeftRotation['x'].oninput = function() {464 const val = parseInt(giraffeLegFrontLeftRotation['x'].value)465 master.giraffe.inRotation['leg-front-left']['x'] = val466 master.giraffe.transformModel()467 master.giraffe.updateTransform()468 render(master)469 }470 giraffeLegFrontLeftRotation['y'].oninput = function() {471 const val = parseInt(giraffeLegFrontLeftRotation['y'].value)472 master.giraffe.inRotation['leg-front-left']['y'] = val473 master.giraffe.transformModel()474 master.giraffe.updateTransform()475 render(master)476 }477 giraffeLegFrontLeftRotation['z'].oninput = function() {478 const val = parseInt(giraffeLegFrontLeftRotation['z'].value)479 master.giraffe.inRotation['leg-front-left']['z'] = val480 master.giraffe.transformModel()481 master.giraffe.updateTransform()482 render(master)483 }484 giraffeLegFrontRightRotation['x'].oninput = function() {485 const val = parseInt(giraffeLegFrontRightRotation['x'].value)486 master.giraffe.inRotation['leg-front-right']['x'] = val487 master.giraffe.transformModel()488 master.giraffe.updateTransform()489 render(master)490 }491 giraffeLegFrontRightRotation['y'].oninput = function() {492 const val = parseInt(giraffeLegFrontRightRotation['y'].value)493 master.giraffe.inRotation['leg-front-right']['y'] = val494 master.giraffe.transformModel()495 master.giraffe.updateTransform()496 render(master)497 }498 giraffeLegFrontRightRotation['z'].oninput = function() {499 const val = parseInt(giraffeLegFrontRightRotation['z'].value)500 master.giraffe.inRotation['leg-front-right']['z'] = val501 master.giraffe.transformModel()502 master.giraffe.updateTransform()503 render(master)504 }505 giraffeLegBackLeftRotation['x'].oninput = function() {506 const val = parseInt(giraffeLegBackLeftRotation['x'].value)507 master.giraffe.inRotation['leg-back-left']['x'] = val508 master.giraffe.transformModel()509 master.giraffe.updateTransform()510 render(master)511 }512 giraffeLegBackLeftRotation['y'].oninput = function() {513 const val = parseInt(giraffeLegBackLeftRotation['y'].value)514 master.giraffe.inRotation['leg-back-left']['y'] = val515 master.giraffe.transformModel()516 master.giraffe.updateTransform()517 render(master)518 }519 giraffeLegBackLeftRotation['z'].oninput = function() {520 const val = parseInt(giraffeLegBackLeftRotation['z'].value)521 master.giraffe.inRotation['leg-back-left']['z'] = val522 master.giraffe.transformModel()523 master.giraffe.updateTransform()524 render(master)525 }526 giraffeLegBackRightRotation['x'].oninput = function() {527 const val = parseInt(giraffeLegBackRightRotation['x'].value)528 master.giraffe.inRotation['leg-back-right']['x'] = val529 master.giraffe.transformModel()530 master.giraffe.updateTransform()531 render(master)532 }533 giraffeLegBackRightRotation['y'].oninput = function() {534 const val = parseInt(giraffeLegBackRightRotation['y'].value)535 master.giraffe.inRotation['leg-back-right']['y'] = val536 master.giraffe.transformModel()537 master.giraffe.updateTransform()538 render(master)539 }540 giraffeLegBackRightRotation['x'].oninput = function() {541 const val = parseInt(giraffeLegBackRightRotation['x'].value)542 master.giraffe.inRotation['leg-back-right']['x'] = val543 master.giraffe.transformModel()544 master.giraffe.updateTransform()545 render(master)546 }547 giraffeLegBackRightRotation['z'].oninput = function() {548 const val = parseInt(giraffeLegBackRightRotation['z'].value)549 master.giraffe.inRotation['leg-back-right']['z'] = val550 master.giraffe.transformModel()551 master.giraffe.updateTransform()552 render(master)553 }554 giraffeFeetFrontLeftRotation['x'].oninput = function() {555 const val = parseInt(giraffeFeetFrontLeftRotation['x'].value)556 master.giraffe.inRotation['feet-front-left']['x'] = val557 master.giraffe.transformModel()558 master.giraffe.updateTransform()559 render(master)560 }561 giraffeFeetFrontLeftRotation['y'].oninput = function() {562 const val = parseInt(giraffeFeetFrontLeftRotation['y'].value)563 master.giraffe.inRotation['feet-front-left']['y'] = val564 master.giraffe.transformModel()565 master.giraffe.updateTransform()566 render(master)567 }568 giraffeFeetFrontLeftRotation['z'].oninput = function() {569 const val = parseInt(giraffeFeetFrontLeftRotation['z'].value)570 master.giraffe.inRotation['feet-front-left']['z'] = val571 master.giraffe.transformModel()572 master.giraffe.updateTransform()573 render(master)574 }575 giraffeFeetFrontRightRotation['x'].oninput = function() {576 const val = parseInt(giraffeFeetFrontRightRotation['x'].value)577 master.giraffe.inRotation['feet-front-right']['x'] = val578 master.giraffe.transformModel()579 master.giraffe.updateTransform()580 render(master)581 }582 giraffeFeetFrontRightRotation['y'].oninput = function() {583 const val = parseInt(giraffeFeetFrontRightRotation['y'].value)584 master.giraffe.inRotation['feet-front-right']['y'] = val585 master.giraffe.transformModel()586 master.giraffe.updateTransform()587 render(master)588 }589 giraffeFeetFrontRightRotation['z'].oninput = function() {590 const val = parseInt(giraffeFeetFrontRightRotation['z'].value)591 master.giraffe.inRotation['feet-front-right']['z'] = val592 master.giraffe.transformModel()593 master.giraffe.updateTransform()594 render(master)595 }596 giraffeFeetBackLeftRotation['x'].oninput = function() {597 const val = parseInt(giraffeFeetBackLeftRotation['x'].value)598 master.giraffe.inRotation['feet-back-left']['x'] = val599 master.giraffe.transformModel()600 master.giraffe.updateTransform()601 render(master)602 }603 giraffeFeetBackLeftRotation['y'].oninput = function() {604 const val = parseInt(giraffeFeetBackLeftRotation['y'].value)605 master.giraffe.inRotation['feet-back-left']['y'] = val606 master.giraffe.transformModel()607 master.giraffe.updateTransform()608 render(master)609 }610 giraffeFeetBackLeftRotation['z'].oninput = function() {611 const val = parseInt(giraffeFeetBackLeftRotation['z'].value)612 master.giraffe.inRotation['feet-back-left']['z'] = val613 master.giraffe.transformModel()614 master.giraffe.updateTransform()615 render(master)616 }617 giraffeFeetBackRightRotation['x'].oninput = function() {618 const val = parseInt(giraffeFeetBackRightRotation['x'].value)619 master.giraffe.inRotation['feet-back-right']['x'] = val620 master.giraffe.transformModel()621 master.giraffe.updateTransform()622 render(master)623 }624 giraffeFeetBackRightRotation['y'].oninput = function() {625 const val = parseInt(giraffeFeetBackRightRotation['y'].value)626 master.giraffe.inRotation['feet-back-right']['y'] = val627 master.giraffe.transformModel()628 master.giraffe.updateTransform()629 render(master)630 }631 giraffeFeetBackRightRotation['z'].oninput = function() {632 const val = parseInt(giraffeFeetBackRightRotation['z'].value)633 master.giraffe.inRotation['feet-back-right']['z'] = val634 master.giraffe.transformModel()635 master.giraffe.updateTransform()636 render(master)637 }638 dogTranslation['x'].oninput = function() {639 const val = parseInt(dogTranslation['x'].value)640 master.dog.bodyLocation[0] = val641 master.dog.transformModel()642 master.dog.updateTransform()643 render(master);644 }645 646 dogTranslation['y'].oninput = function() {647 const val = parseInt(dogTranslation['y'].value)648 master.dog.bodyLocation[1] = val649 master.dog.transformModel()650 master.dog.updateTransform()651 render(master);652 }653 654 dogTranslation['z'].oninput = function() {655 const val = parseInt(dogTranslation['z'].value)656 master.dog.bodyLocation[2] = val657 master.dog.transformModel()658 master.dog.updateTransform()659 render(master);660 }661 dogBodyRotation['x'].oninput = function() {662 const val = parseInt(dogBodyRotation['x'].value)663 master.dog.inRotation['body']['x'] = val664 master.dog.transformModel()665 master.dog.updateTransform()666 render(master)667 }668 dogBodyRotation['y'].oninput = function() {669 const val = parseInt(dogBodyRotation['y'].value)670 master.dog.inRotation['body']['y'] = val671 master.dog.transformModel()672 master.dog.updateTransform()673 render(master)674 }675 dogBodyRotation['z'].oninput = function() {676 const val = parseInt(dogBodyRotation['z'].value)677 master.dog.inRotation['body']['z'] = val678 master.dog.transformModel()679 master.dog.updateTransform()680 render(master)681 }682 683 dogNeckRotation['x'].oninput = function() {684 const val = parseInt(dogNeckRotation['x'].value)685 master.dog.inRotation['neck']['x'] = val686 master.dog.transformModel()687 master.dog.updateTransform()688 render(master)689 }690 691 dogNeckRotation['y'].oninput = function() {692 const val = parseInt(dogNeckRotation['y'].value)693 master.dog.inRotation['neck']['y'] = val694 master.dog.transformModel()695 master.dog.updateTransform()696 render(master)697 }698 699 dogNeckRotation['z'].oninput = function() {700 const val = parseInt(dogNeckRotation['z'].value)701 master.dog.inRotation['neck']['z'] = val702 master.dog.transformModel()703 master.dog.updateTransform()704 render(master)705 }706 707 dogHeadRotation['x'].oninput = function() {708 const val = parseInt(dogHeadRotation['x'].value)709 master.dog.inRotation['head']['x'] = val710 master.dog.transformModel()711 master.dog.updateTransform()712 render(master)713 }714 715 dogHeadRotation['y'].oninput = function() {716 const val = parseInt(dogHeadRotation['y'].value)717 master.dog.inRotation['head']['y'] = val718 master.dog.transformModel()719 master.dog.updateTransform()720 render(master)721 }722 723 dogHeadRotation['z'].oninput = function() {724 const val = parseInt(dogHeadRotation['z'].value)725 master.dog.inRotation['head']['z'] = val726 master.dog.transformModel()727 master.dog.updateTransform()728 render(master)729 }730 731 dogLegFrontLeftRotation['x'].oninput = function() {732 const val = parseInt(dogLegFrontLeftRotation['x'].value)733 master.dog.inRotation['leg-front-left']['x'] = val734 master.dog.transformModel()735 master.dog.updateTransform()736 render(master)737 }738 739 dogLegFrontLeftRotation['y'].oninput = function() {740 const val = parseInt(dogLegFrontLeftRotation['y'].value)741 master.dog.inRotation['leg-front-left']['y'] = val742 master.dog.transformModel()743 master.dog.updateTransform()744 render(master)745 }746 747 dogLegFrontLeftRotation['z'].oninput = function() {748 const val = parseInt(dogLegFrontLeftRotation['z'].value)749 master.dog.inRotation['leg-front-left']['z'] = val750 master.dog.transformModel()751 master.dog.updateTransform()752 render(master)753 }754 755 dogLegFrontRightRotation['x'].oninput = function() {756 const val = parseInt(dogLegFrontRightRotation['x'].value)757 master.dog.inRotation['leg-front-right']['x'] = val758 master.dog.transformModel()759 master.dog.updateTransform()760 render(master)761 }762 763 dogLegFrontRightRotation['y'].oninput = function() {764 const val = parseInt(dogLegFrontRightRotation['y'].value)765 master.dog.inRotation['leg-front-right']['y'] = val766 master.dog.transformModel()767 master.dog.updateTransform()768 render(master)769 }770 771 dogLegFrontRightRotation['z'].oninput = function() {772 const val = parseInt(dogLegFrontRightRotation['z'].value)773 master.dog.inRotation['leg-front-right']['z'] = val774 master.dog.transformModel()775 master.dog.updateTransform()776 render(master)777 }778 779 dogLegBackLeftRotation['x'].oninput = function() {780 const val = parseInt(dogLegBackLeftRotation['x'].value)781 master.dog.inRotation['leg-back-left']['x'] = val782 master.dog.transformModel()783 master.dog.updateTransform()784 render(master)785 }786 787 dogLegBackLeftRotation['y'].oninput = function() {788 const val = parseInt(dogLegBackLeftRotation['y'].value)789 master.dog.inRotation['leg-back-left']['y'] = val790 master.dog.transformModel()791 master.dog.updateTransform()792 render(master)793 }794 795 dogLegBackLeftRotation['z'].oninput = function() {796 const val = parseInt(dogLegBackLeftRotation['z'].value)797 master.dog.inRotation['leg-back-left']['z'] = val798 master.dog.transformModel()799 master.dog.updateTransform()800 render(master)801 }802 803 dogLegBackRightRotation['x'].oninput = function() {804 const val = parseInt(dogLegBackRightRotation['x'].value)805 master.dog.inRotation['leg-back-right']['x'] = val806 master.dog.transformModel()807 master.dog.updateTransform()808 render(master)809 }810 811 dogLegBackRightRotation['y'].oninput = function() {812 const val = parseInt(dogLegBackRightRotation['y'].value)813 master.dog.inRotation['leg-back-right']['y'] = val814 master.dog.transformModel()815 master.dog.updateTransform()816 render(master)817 }818 819 dogLegBackRightRotation['z'].oninput = function() {820 const val = parseInt(dogLegBackRightRotation['z'].value)821 master.dog.inRotation['leg-back-right']['z'] = val822 master.dog.transformModel()823 master.dog.updateTransform()824 render(master)825 }826 dogEarLeftRotation['x'].oninput = function() {827 const val = parseInt(dogEarLeftRotation['x'].value)828 master.dog.inRotation['ear-left']['x'] = val829 master.dog.transformModel()830 master.dog.updateTransform()831 render(master)832 }833 dogEarLeftRotation['y'].oninput = function() {834 const val = parseInt(dogEarLeftRotation['y'].value)835 master.dog.inRotation['ear-left']['y'] = val836 master.dog.transformModel()837 master.dog.updateTransform()838 render(master)839 }840 dogEarLeftRotation['z'].oninput = function() {841 const val = parseInt(dogEarLeftRotation['z'].value)842 master.dog.inRotation['ear-left']['z'] = val843 master.dog.transformModel()844 master.dog.updateTransform()845 render(master)846 }847 dogEarRightRotation['x'].oninput = function() {848 const val = parseInt(dogEarRightRotation['x'].value)849 master.dog.inRotation['ear-right']['x'] = val850 master.dog.transformModel()851 master.dog.updateTransform()852 render(master)853 }854 855 dogEarRightRotation['y'].oninput = function() {856 const val = parseInt(dogEarRightRotation['y'].value)857 master.dog.inRotation['ear-right']['y'] = val858 master.dog.transformModel()859 master.dog.updateTransform()860 render(master)861 }862 dogEarRightRotation['z'].oninput = function() {863 const val = parseInt(dogEarRightRotation['z'].value)864 master.dog.inRotation['ear-right']['z'] = val865 master.dog.transformModel()866 master.dog.updateTransform()867 render(master)868 }869 870 dogTailRotation['x'].oninput = function() {871 const val = parseInt(dogTailRotation['x'].value)872 master.dog.inRotation['tail']['x'] = val873 master.dog.transformModel()874 master.dog.updateTransform()875 render(master)876 }877 dogTailRotation['y'].oninput = function() {878 const val = parseInt(dogTailRotation['y'].value)879 master.dog.inRotation['tail']['y'] = val880 master.dog.transformModel()881 master.dog.updateTransform()882 render(master)883 }884 dogTailRotation['z'].oninput = function() {885 const val = parseInt(dogTailRotation['z'].value)886 master.dog.inRotation['tail']['z'] = val887 master.dog.transformModel()888 master.dog.updateTransform()889 render(master)890 }891 batTranslation['x'].oninput = function() {892 const val = parseInt(batTranslation['x'].value)893 master.bat.bodyLocation[0] = val894 master.bat.transformModel()895 master.bat.updateTransform()896 render(master);897 }898 batTranslation['y'].oninput = function() {899 const val = parseInt(batTranslation['y'].value)900 master.bat.bodyLocation[1] = val901 master.bat.transformModel()902 master.bat.updateTransform()903 render(master);904 }905 batTranslation['z'].oninput = function() {906 const val = parseInt(batTranslation['z'].value)907 master.bat.bodyLocation[2] = val908 master.bat.transformModel()909 master.bat.updateTransform()910 render(master);911 }912 batBodyRotation['x'].oninput = function() {913 const val = parseInt(batBodyRotation['x'].value)914 master.bat.inRotation['body']['x'] = val915 master.bat.transformModel()916 master.bat.updateTransform()917 render(master)918 }919 batBodyRotation['y'].oninput = function() {920 const val = parseInt(batBodyRotation['y'].value)921 master.bat.inRotation['body']['y'] = val922 master.bat.transformModel()923 master.bat.updateTransform()924 render(master)925 }926 batBodyRotation['z'].oninput = function() {927 const val = parseInt(batBodyRotation['z'].value)928 master.bat.inRotation['body']['y'] = val929 master.bat.transformModel()930 master.bat.updateTransform()931 render(master)932 }933 batWing1Rotation['x'].oninput = function() {934 const val = parseInt(batWing1Rotation['x'].value)935 master.bat.inRotation['wing1']['x'] = val936 master.bat.transformModel()937 master.bat.updateTransform()938 render(master)939 }940 batWing1Rotation['y'].oninput = function() {941 const val = parseInt(batWing1Rotation['y'].value)942 master.bat.inRotation['wing1']['y'] = val943 master.bat.transformModel()944 master.bat.updateTransform()945 render(master)946 }947 batWing1Rotation['z'].oninput = function() {948 const val = parseInt(batWing1Rotation['z'].value)949 master.bat.inRotation['wing1']['z'] = val950 master.bat.transformModel()951 master.bat.updateTransform()952 render(master)953 }954 batWing2Rotation['x'].oninput = function() {955 const val = parseInt(batWing2Rotation['x'].value)956 master.bat.inRotation['wing2']['x'] = val957 master.bat.transformModel()958 master.bat.updateTransform()959 render(master)960 }961 batWing2Rotation['y'].oninput = function() {962 const val = parseInt(batWing2Rotation['y'].value)963 master.bat.inRotation['wing2']['y'] = val964 master.bat.transformModel()965 master.bat.updateTransform()966 render(master)967 }968 batWing2Rotation['z'].oninput = function() {969 const val = parseInt(batWing2Rotation['z'].value)970 master.bat.inRotation['wing2']['z'] = val971 master.bat.transformModel()972 master.bat.updateTransform()973 render(master)974 }975 batLegFrontLeftRotation['x'].oninput = function() {976 const val = parseInt(batLegFrontLeftRotation['x'].value)977 master.bat.inRotation['leg-front-left']['x'] = val978 master.bat.transformModel()979 master.bat.updateTransform()980 render(master)981 }982 batLegFrontLeftRotation['y'].oninput = function() {983 const val = parseInt(batLegFrontLeftRotation['y'].value)984 master.bat.inRotation['leg-front-left']['y'] = val985 master.bat.transformModel()986 master.bat.updateTransform()987 render(master)988 }989 batLegFrontLeftRotation['z'].oninput = function() {990 const val = parseInt(batLegFrontLeftRotation['z'].value)991 master.bat.inRotation['leg-front-left']['z'] = val992 master.bat.transformModel()993 master.bat.updateTransform()994 render(master)995 }996 batLegFrontRightRotation['x'].oninput = function() {997 const val = parseInt(batLegFrontRightRotation['x'].value)998 master.bat.inRotation['leg-front-right']['x'] = val999 master.bat.transformModel()1000 master.bat.updateTransform()1001 render(master)1002 }1003 batLegFrontRightRotation['y'].oninput = function() {1004 const val = parseInt(batLegFrontRightRotation['y'].value)1005 master.bat.inRotation['leg-front-right']['y'] = val1006 master.bat.transformModel()1007 master.bat.updateTransform()1008 render(master)1009 }1010 batLegFrontRightRotation['z'].oninput = function() {1011 const val = parseInt(batLegFrontRightRotation['z'].value)1012 master.bat.inRotation['leg-front-right']['z'] = val1013 master.bat.transformModel()1014 master.bat.updateTransform()1015 render(master)1016 }1017 animation['giraffe'].oninput = function() {1018 const val = parseInt(animation['giraffe'].value);1019 master.giraffe.distributeRotation(val)1020 master.giraffe.updateAnimation();1021 master.giraffe.updateTransform();1022 render(master);1023 };1024 animation['dog'].oninput = function() {1025 const val = parseInt(animation['dog'].value);1026 master.dog.distributeRotation(val)1027 master.dog.updateAnimation();...
main.js
Source:main.js
1var STYLE_ON_TAB_SELECT = true2var BoxShadowGenerator = Vue.component("boxshadow-generator", {3 data(){4 return {5 shadowModel: [6 {7 shadowX: 20,8 shadowY: 20,9 spread: 0,10 blur: 0,11 shadowInset: false,12 shadowColor: "#000000"13 }14 ]15 }16 },17 methods: {18 addLayer: function(){19 this.shadowModel.push({20 shadowX: 20,21 shadowY: 20,22 spread: 0,23 blur: 0,24 shadowInset: false,25 shadowColor: "#000000"26 })27 },28 removeLayer: function(i){29 if(this.shadowModel.length < 2) return;30 this.shadowModel.splice(i, 1)31 },32 emitCodes(){33 var shadow = this.shadows34 this.$emit("codesChange", [35 {36 property: "box-shadow",37 value: shadow38 }39 ])40 }41 },42 computed: {43 shadows: function(){44 var s = "";45 for(var i = 0; i < this.shadowModel.length; i++){46 s += this.shadowModel[i].shadowInset ? ", inset " : ", "47 s += this.shadowModel[i].shadowX + "px " + this.shadowModel[i].shadowY + "px " + this.shadowModel[i].blur + "px " + this.shadowModel[i].spread + "px " + this.shadowModel[i].shadowColor48 }49 var res = s.substring(2)50 return res51 }52 },53 watch: {54 shadows(){55 this.emitCodes()56 }57 },58 mounted(){59 STYLE_ON_TAB_SELECT && this.emitCodes()60 },61 template: `62 <div>63 <div class="layer-ctrl" v-for="(layer, index) in shadowModel">64 <p class="layer-close"><i v-on:click="removeLayer(index)" v-if="shadowModel.length > 1">×</i></p>65 <div class="input-group">66 <label>X Axis: {{shadowModel[index].shadowX}}px</label>67 <input type="range" min="-50" max="50" value="0" v-model="shadowModel[index].shadowX">68 </div>69 <div class="input-group">70 <label>Y Axis: {{shadowModel[index].shadowY}}px</label>71 <input type="range" min="-50" max="50" value="0" v-model="shadowModel[index].shadowY">72 </div>73 <div class="input-group">74 <label>Blur: {{shadowModel[index].blur}}px</label>75 <input type="range" min="0" max="50" value="0" v-model="shadowModel[index].blur">76 </div>77 <div class="input-group">78 <label>Spread: {{shadowModel[index].spread}}px</label>79 <input type="range" min="0" max="50" value="0" v-model="shadowModel[index].spread">80 </div>81 <div class="input-group">82 <label>Inset: {{shadowModel[index].shadowInset}}</label>83 <input type="checkbox" v-model="shadowModel[index].shadowInset">84 </div>85 <div class="input-group">86 <label>Shadow color: {{shadowModel[index].shadowColor}}</label>87 <input type="color" v-model="shadowModel[index].shadowColor">88 </div>89 </div>90 <div class="text-right">91 <button class="btn" v-on:click="addLayer()">add layer</button>92 </div>93 </div>94 `95})96var BorderRadiusGenerator = Vue.component("borderradius-generator", {97 data(){98 return {99 borderRadiusModel: {100 topLeftX: 5,101 topRightX: 5,102 bottomLeftX: 5,103 bottomRightX: 5,104 topLeftY: 5,105 topRightY: 5,106 bottomLeftY: 5,107 bottomRightY: 5108 }109 }110 },111 methods: {112 emitCodes(){113 var borderRadius = this.borderRadius114 this.$emit("codesChange", [115 {116 property: "border-radius",117 value: borderRadius118 }119 ])120 }121 },122 computed: {123 borderRadius: function(){124 let t = this.borderRadiusModel125 var res = `${ t.topLeftX }% ${ t.topRightX }% ${ t.bottomRightX }% ${ t.bottomLeftX }% / ${ t.topLeftY }% ${ t.topRightY }% ${ t.bottomRightY }% ${ t.bottomLeftY }%`126 return res127 }128 },129 watch: {130 borderRadius(){131 this.emitCodes()132 }133 },134 mounted(){135 STYLE_ON_TAB_SELECT && this.emitCodes()136 },137 template: `138 <div>139 <div class="layer-ctrl">140 <div class="input-group">141 <label>Top Left X: {{ borderRadiusModel.topLeftX }}%</label>142 <input type="range" min="0" max="100" value="0" v-model="borderRadiusModel.topLeftX">143 </div>144 <div class="input-group">145 <label>Top Left Y: {{ borderRadiusModel.topLeftY }}%</label>146 <input type="range" min="0" max="100" value="0" v-model="borderRadiusModel.topLeftY">147 </div>148 <br>149 <div class="input-group">150 <label>Top Right X: {{ borderRadiusModel.topRightX }}%</label>151 <input type="range" min="0" max="100" value="0" v-model="borderRadiusModel.topRightX">152 </div>153 <div class="input-group">154 <label>Top Right Y: {{ borderRadiusModel.topRightY }}%</label>155 <input type="range" min="0" max="100" value="0" v-model="borderRadiusModel.topRightY">156 </div>157 <br>158 <div class="input-group">159 <label>Bottom Left X: {{ borderRadiusModel.bottomLeftX }}%</label>160 <input type="range" min="0" max="100" value="0" v-model="borderRadiusModel.bottomLeftX">161 </div>162 <div class="input-group">163 <label>Bottom Left Y: {{ borderRadiusModel.bottomLeftY }}%</label>164 <input type="range" min="0" max="100" value="0" v-model="borderRadiusModel.bottomLeftY">165 </div>166 <br>167 <div class="input-group">168 <label>Bottom Right X: {{ borderRadiusModel.bottomRightX }}%</label>169 <input type="range" min="0" max="100" value="0" v-model="borderRadiusModel.bottomRightX">170 </div>171 <div class="input-group">172 <label>Bottom Right Y: {{ borderRadiusModel.bottomRightY }}%</label>173 <input type="range" min="0" max="100" value="0" v-model="borderRadiusModel.bottomRightY">174 </div>175 176 </div>177 <div>178 `179})180var TransformGenerator = Vue.component("gradient-generator", {181 data(){182 return {183 transformModel: {184 translateX: 0,185 translateY: 0,186 translateZ: 0,187 skewX: 0,188 skewY: 0,189 rotateX: 0,190 rotateY: 0,191 rotateZ: 0,192 scaleX: 1,193 scaleY: 1,194 scaleZ: 1,195 originX: "center",196 originY: "center",197 perspective: 0,198 transformStyle: "initial"199 }200 }201 },202 methods: {203 emitCodes(){204 var transforms = this.transforms205 this.$emit("codesChange", [206 {207 property: "transform-style",208 value: transforms[0]209 },210 {211 property: "transform-origin",212 value: transforms[1]213 },214 {215 property: "transform",216 value: transforms[2]217 },218 219 220 ])221 }222 },223 computed: {224 transforms: function(){225 let t = this.transformModel226 var res = [227 t.transformStyle,228 `${t.originX} ${t.originY}`,229 `perspective(${t.perspective}px) `230 + `translateX(${t.translateX}%) translateY(${t.translateY}%) translateZ(${t.translateZ}px) `231 + `skewX(${t.skewX}deg) skewY(${t.skewY}deg) `232 + `rotateX(${t.rotateX}deg) rotateY(${t.rotateY}deg) rotateZ(${t.rotateZ}deg) `233 + `scaleX(${t.scaleX}) scaleY(${t.scaleY}) scaleZ(${t.scaleZ})`234 ]235 return res236 }237 },238 watch: {239 transforms(){240 this.emitCodes()241 }242 },243 mounted(){244 STYLE_ON_TAB_SELECT && this.emitCodes()245 },246 template: `247 <div>248 <div class="layer-ctrl">249 <div class="input-group">250 <label>Transform Origin X: {{ transformModel.originX }}</label>251 <select v-model="transformModel.originX">252 <option value="center">center</option>253 <option value="top">top</option>254 <option value="bottom">bottom</option>255 <option value="left">left</option>256 <option value="right">right</option>257 258 </select>259 </div>260 <div class="input-group">261 <label>Transform Origin Y: {{ transformModel.originY }}</label>262 <select v-model="transformModel.originY">263 <option value="center">center</option>264 <option value="top">top</option>265 <option value="bottom">bottom</option>266 <option value="left">left</option>267 <option value="right">right</option>268 269 </select>270 </div>271 <br>272 <div class="input-group">273 <label>Prespective: {{ transformModel.perspective }}</label>274 <input type="range" min="0" max="3000" value="0" v-model="transformModel.perspective">275 </div>276 <div class="input-group">277 <label>Transform Style: {{ transformModel.transformStyle }}</label>278 <select v-model="transformModel.transformStyle">279 <option value="initial">initial</option>280 <option value="inherit">inherit</option>281 <option value="flat">flat</option>282 <option value="preserve-3d">preserve-3d</option>283 284 </select>285 </div>286 <br>287 <div class="input-group">288 <label>Translate X: {{ transformModel.translateX }}%</label>289 <input type="range" min="-100" max="100" value="0" v-model="transformModel.translateX">290 </div>291 <div class="input-group">292 <label>Translate Y: {{ transformModel.translateY }}%</label>293 <input type="range" min="-100" max="100" value="0" v-model="transformModel.translateY">294 </div>295 <div class="input-group">296 <label>Translate Z: {{ transformModel.translateZ }}px</label>297 <input type="range" min="-1000" max="1000" value="0" v-model="transformModel.translateZ">298 </div>299 <br>300 <div class="input-group">301 <label>Skew X: {{ transformModel.skewX }}deg</label>302 <input type="range" min="-180" max="180" value="0" v-model="transformModel.skewX">303 </div>304 <div class="input-group">305 <label>Skew Y: {{ transformModel.skewY }}deg</label>306 <input type="range" min="-180" max="180" value="0" v-model="transformModel.skewY">307 </div>308 <br>309 310 <div class="input-group">311 <label>Rotate X: {{ transformModel.rotateX }}deg</label>312 <input type="range" min="-180" max="180" value="0" v-model="transformModel.rotateX">313 </div>314 <div class="input-group">315 <label>Rotate Y: {{ transformModel.rotateY }}deg</label>316 <input type="range" min="-180" max="180" value="0" v-model="transformModel.rotateY">317 </div>318 <div class="input-group">319 <label>Rotate Z: {{ transformModel.rotateZ }}deg</label>320 <input type="range" min="-180" max="180" value="0" v-model="transformModel.rotateZ">321 </div>322 <br>323 <div class="input-group">324 <label>Scale X: {{ transformModel.scaleX }}deg</label>325 <input type="range" min="0" max="10" step="0.1" value="0" v-model="transformModel.scaleX">326 </div>327 <div class="input-group">328 <label>Scale Y: {{ transformModel.scaleY }}deg</label>329 <input type="range" min="0" max="10" step="0.1" value="0" v-model="transformModel.scaleY">330 </div>331 <div class="input-group">332 <label>Scale Z: {{ transformModel.scaleZ }}deg</label>333 <input type="range" min="0" max="10" step="0.1" value="0" v-model="transformModel.scaleZ">334 </div>335 <br>336 337 </div>338 <div>339 `340})341var DOMManipulator = Vue.component("dom-manipulator", {342 props: ["styles"],343 data(){344 return {345 selector: null346 }347 },348 watch: {349 styles(){350 if(!this.selector) return351 var $this = this352 chrome.tabs.query({currentWindow: true, active: true}, function (tabs){353 var activeTab = tabs[0]354 chrome.tabs.sendMessage(activeTab.id, {"message": $this.selector + " seperator " + JSON.stringify($this.styles)})355 })356 }357 },358 mounted(){359 if(!chrome) return360 console.log("We're in chrome");361 },362 template: `363 <div class="input-section">364 <input type="text" placeholder="Enter selector on amy element on your page" v-model="selector">365 <span><span>-</span> selected element</span>366 </div>367 `368})369var HomePage = Vue.component("home-page", {370 data(){371 return {372 tabs: [373 {374 name: "box shadow",375 component: BoxShadowGenerator376 },377 {378 name: "border radius",379 component: BorderRadiusGenerator380 },381 {382 name: "transform",383 component: TransformGenerator384 }385 ],386 currentTab: 0,387 styles: [],388 showModal: false,389 mode: "extension"390 }391 },392 methods: {393 handleCodesChange(codes){394 this.styles = codes395 var $this = this396 codes.map(function(style){397 $this.$refs.previewBox.style[style.property] = style.value398 })399 }400 },401 template: `402 <div>403 <div class="navbar">404 <a href="#">Design Tools</a>405 <span class="info" @click="showModal = true">?</span>406 </div>407 <dom-manipulator :styles="styles" v-if="mode == 'extension'"></dom-manipulator>408 <div class="tabs">409 <a href="#" class="tab" v-for="(tab, index) in tabs" :key="index" :class="{active: index == currentTab}" @click="currentTab = index">{{ tab.name }}</a>410 </div>411 <div class="main">412 <div class="preview">413 <div class="box" ref="previewBox"></div>414 </div>415 <div class="component">416 <keep-alive>417 <component :is="tabs[currentTab].component" @codesChange="handleCodesChange"></component>418 </keep-alive>419 </div>420 </div>421 <div class="codes">422 <p>Generated codes:</p>423 <div class="codes-box">424 <p v-for="(style, index) in styles" :key="index"><span class="code-prop">{{ style.property }}</span>: <span class="code-val">{{ style.value }}</span>;</p>425 </div>426 </div>427 <div class="modal" v-if="showModal">428 <div class="content">429 <span class="close" @click="showModal = false">×</span>430 <p><b>Design Tools</b> contains useful tools that will ease your development. Choose any tool and create an effect you like. Then simply copy pase the generated css codes into your project.</p>431 </div>432 </div>433 </div>434 `435})436var app = new Vue({437 el: "#app",438 data: () => ({439 msg: "hello"440 })...
TransformsSpec.js
Source:TransformsSpec.js
1(function( root, factory ) {2 // Set up appropriately for the environment.3 // Start with AMD.4 if ( typeof define === 'function' && define.amd ) {5 define(6 [7 'backbone',8 'sinon',9 'models/transforms/Transforms'10 ],11 function( Backbone, sinon, TransformMixin ) {12 factory( Backbone, root.expect, sinon, TransformMixin );13 }14 );15 // Next for Node.js or CommonJS.16 } else if ( typeof exports !== 'undefined' ) {17 var expect = require( 'chai' ).expect;18 var sinon = require( 'sinon' );19 var Backbone = require( 'backbone' );20 var TransformMixin = require( '../../../../src/models/transforms/Transforms' );21 factory( Backbone, expect, sinon, TransformMixin );22 // Finally, as a browser global.23 } else {24 factory( root.Backbone, root.expect, root.sinon, root.ExoSuit.Mixins.TransformMixin );25 }26}( this, function( Backbone, expect, sinon, TransformMixin ) {27 describe('Transform Model Mixin ', function () {28 var model, TransformModel, oldMethodStub, stub;29 describe('_transformData()', function () {30 beforeEach(function() {31 // Create Exclude Model definition32 TransformModel = Backbone.Model.extend({33 transformations: {34 "test": {35 deserialize: function( value ) {36 return value ? String( value ) : null;37 },38 serialize: function( value ) {39 return value ? String( value ) + " world" : null;40 }41 }42 }43 });44 TransformMixin.call( TransformModel.prototype );45 });46 afterEach(function() {47 if ( stub ) {48 stub.restore();49 }50 });51 it('should return data as is if serialize is not a boolean', function() {52 TransformModel.prototype.transforms = {53 key1: "string",54 key2: "number",55 key3: "boolean",56 key4: "test"57 };58 // Create model59 model = new TransformModel();60 var data = model._transformData({61 key1: 20,62 key2: "450",63 key3: "1",64 key4: "hello"65 });66 expect( data ).to.deep.equal({67 key1: 20,68 key2: "450",69 key3: "1",70 key4: "hello"71 });72 data = model._transformData({73 key1: 20,74 key2: "450",75 key3: "1",76 key4: "hello"77 }, 1);78 expect( data ).to.deep.equal({79 key1: 20,80 key2: "450",81 key3: "1",82 key4: "hello"83 });84 data = model._transformData({85 key1: 20,86 key2: "450",87 key3: "1",88 key4: "hello"89 }, "true");90 expect( data ).to.deep.equal({91 key1: 20,92 key2: "450",93 key3: "1",94 key4: "hello"95 });96 });97 it('should deserialize transform attributes if transforms are defined on the model and false is passed as serialize argument', function() {98 TransformModel.prototype.transforms = {99 key1: "string",100 key2: "number",101 key3: "boolean",102 key4: "test"103 };104 // Create model105 model = new TransformModel();106 var data = model._transformData({107 key1: 20,108 key2: "450",109 key3: "1",110 key4: "hello"111 }, false);112 expect( data ).to.deep.equal({113 key1: "20",114 key2: 450,115 key3: true,116 key4: "hello"117 });118 });119 it('should serialize transform attributes if transforms are defined on the model and true is passed as serialize argument', function() {120 TransformModel.prototype.transforms = {121 key1: "string",122 key2: "number",123 key3: "boolean",124 key4: "test"125 };126 // Create model127 model = new TransformModel();128 var data = model._transformData({129 key1: 20,130 key2: "450",131 key3: "1",132 key4: "hello"133 }, true);134 expect( data ).to.deep.equal({135 key1: "20",136 key2: 450,137 key3: true,138 key4: "hello world"139 });140 });141 it('should transform nested attributes if transforms are defined on the model', function() {142 TransformModel.prototype.transforms = {143 "key1.prop": "test"144 };145 // Create model146 model = new TransformModel();147 var data = model._transformData({148 key1: {149 prop: 20150 }151 }, false );152 expect( data ).to.deep.equal({153 key1: {154 prop: "20"155 }156 });157 data = model._transformData({158 key1: {159 prop: 20160 }161 }, true );162 expect( data ).to.deep.equal({163 key1: {164 prop: "20 world"165 }166 });167 });168 });169 describe('parse()', function () {170 beforeEach(function() {171 // Create Exclude Model definition172 TransformModel = Backbone.Model.extend({173 transformations: {174 "test": {175 deserialize: function( value ) {176 return value ? String( value ) : null;177 },178 serialize: function( value ) {179 return value ? String( value ) + ".suffix" : null;180 }181 }182 }183 });184 oldMethodStub = sinon.stub( TransformModel.prototype, "parse" );185 TransformMixin.call( TransformModel.prototype );186 });187 afterEach(function() {188 oldMethodStub.restore();189 if ( stub ) {190 stub.restore();191 }192 });193 it('should pass arguments to super parse untouched if no transforms are defined', function() {194 // Create model195 model = new TransformModel();196 model.parse(197 {198 key1: "value1",199 key2: "value2",200 key3: "value3"201 },202 {203 test: true204 }205 );206 expect( oldMethodStub.called ).to.be.true;207 expect( oldMethodStub.callCount ).to.equal( 1 );208 expect( oldMethodStub.calledWith(209 {210 key1: "value1",211 key2: "value2",212 key3: "value3"213 },214 {215 test: true216 }217 ) ).to.be.true;218 });219 it('should call _transformData if transforms are defined on the model', function() {220 // Create model221 model = new TransformModel();222 stub = sinon.stub( model, "_transformData" );223 model.parse({224 key1: 20,225 key2: "450",226 key3: "1"227 });228 expect( stub.called ).to.be.false;229 expect( oldMethodStub.called ).to.be.true;230 expect( oldMethodStub.callCount ).to.equal( 1 );231 TransformModel.prototype.transforms = {232 key1: "string",233 key2: "number",234 key3: "boolean"235 };236 model = new TransformModel();237 stub = sinon.stub( model, "_transformData" );238 model.parse({239 key1: 20,240 key2: "450",241 key3: "1"242 });243 expect( stub.called ).to.be.true;244 expect( stub.callCount ).to.equal( 1 );245 expect( stub.calledWith( {246 key1: 20,247 key2: "450",248 key3: "1"249 }, false ) ).to.be.true;250 expect( oldMethodStub.callCount ).to.equal( 2 );251 });252 });253 describe('toJSON()', function () {254 beforeEach(function() {255 // Create Exclude Model definition256 TransformModel = Backbone.Model.extend();257 oldMethodStub = sinon.stub( TransformModel.prototype, "toJSON" );258 TransformMixin.call( TransformModel.prototype );259 });260 afterEach(function() {261 oldMethodStub.restore();262 if ( stub ) {263 stub.restore();264 }265 });266 it('should call super toJSON method', function() {267 // Create model268 model = new TransformModel();269 model.toJSON();270 expect( oldMethodStub.called ).to.be.true;271 expect( oldMethodStub.callCount ).to.equal( 1 );272 });273 it('should call _transformData if transforms are defined on the model', function() {274 // Create model275 model = new TransformModel();276 stub = sinon.stub( model, "_transformData" );277 model.toJSON();278 expect( stub.called ).to.be.false;279 expect( oldMethodStub.called ).to.be.true;280 expect( oldMethodStub.callCount ).to.equal( 1 );281 TransformModel.prototype.transforms = {282 key1: "string",283 key2: "number",284 key3: "boolean"285 };286 model = new TransformModel();287 stub = sinon.stub( model, "_transformData" );288 model.toJSON();289 expect( stub.called ).to.be.true;290 expect( stub.callCount ).to.equal( 1 );291 expect( oldMethodStub.callCount ).to.equal( 2 );292 });293 });294 describe('sync()', function () {295 beforeEach(function() {296 // Create Exclude Model definition297 TransformModel = Backbone.Model.extend();298 oldMethodStub = sinon.stub( TransformModel.prototype, "sync" );299 TransformMixin.call( TransformModel.prototype );300 });301 afterEach(function() {302 oldMethodStub.restore();303 if ( stub ) {304 stub.restore();305 }306 });307 it('should call super sync untouched if options,patch isnt true', function() {308 // Create model309 model = new TransformModel();310 model.sync( "update", model, {} );311 expect( oldMethodStub.called ).to.be.true;312 expect( oldMethodStub.callCount ).to.equal( 1 );313 expect( oldMethodStub.calledWith( "update", model, {} ) ).to.be.true;314 });315 it('should transform attributes if method equals patch and transforms are defined on the model', function() {316 TransformModel.prototype.transforms = {317 key1: "string",318 key2: "number",319 key3: "boolean"320 };321 // Create model322 model = new TransformModel();323 stub = sinon.stub( model, "_transformData" );324 model.sync( "patch", model, {325 attrs: {326 key1: 20,327 key2: "450",328 key3: "1"329 }330 } );331 expect( stub.called ).to.be.true;332 expect( stub.callCount ).to.equal( 1 );333 expect( stub.calledWith( {334 key1: 20,335 key2: "450",336 key3: "1"337 }, true ) ).to.be.true;338 });339 });340 });...
index.jsx
Source:index.jsx
1import React from 'react';2import BaseComponent from '../../../../../lib/base/component/component.jsx';3import Selector from '../../../general/etc/form/field/selector.jsx';4import EnumFactory from '../../../../../lib/base/enum';5import Form from '../../../general/etc/form';6import User from '../../../../../api/user/entity/entity.client.js';7// import AutoForm from 'uniforms-unstyled/AutoForm';8import levelEnum from '../../../../../api/registry.object/enum/level.js';9import locationEnum from '../../../../../api/registry.object/enum/area.js';10import kindEnum from '../../../../../api/registry.object/enum/kind.js';11import categoryEnum from '../../../../../api/registry.object/enum/category.js';12import conditionEnum from '../../../../../api/registry.object/enum/condition.js';13import statusEnum from '../../../../../api/registry.object/enum/status.js';14import PropTypes from 'prop-types';15import Schema from './schema.js';16import Model from './model.js';17export default class RegistryFilterPanel extends BaseComponent18{19 static propTypes = {20 className: PropTypes.string,21 onApply: PropTypes.func,22 onCancel: PropTypes.func,23 };24 static defaultProps = {25 className: '',26 onApply: null,27 onCancel: null28 };29 constructor(props) {30 super(props);31 this.extendState({32 model: Model.extractModel(this.props.data),33 });34 }35 // componentWillMount() {36 // this.getFCS().onMount(); // mount function on event37 //38 // if (this.useTitle()) {39 // this.setTitle(this.getTitle());40 // }41 //42 // this._emitter = _.throttle(this.emitChange.bind(this), 700);43 // }44 //45 // componentWillUnmount() {46 // this.getFCS().onUnmount(); // remove function from event47 // this.emitChange(null);48 // }49 getModel() {50 return this.state.model;51 }52 // modelTransform(mode, transformModel) {53 // this.onModelTransform(transformModel);54 // this._emitter(transformModel);55 //56 // if (mode === 'form') {57 // this.getFCS().setDirty(this.getInitialModel(), transformModel);58 // }59 //60 // return transformModel;61 // }62 onSubmit(data) {63 const result = Model.putModel(data, {});64 if (_.isFunction(this.props.onApply)) {65 this.props.onApply(result);66 }67 }68 // modelTransform(mode, transformModel) {69 // this.onModelTransform(transformModel);70 // this._emitter(transformModel);71 //72 // if (mode === 'form') {73 // this.getFCS().setDirty(this.getInitialModel(), transformModel);74 // }75 //76 // return transformModel;77 // }78 // onValidate(data, error, cb) {79 // if (error) {80 // console.error(error);81 // }82 // if (error && error.error === 'validation-error') {83 // this.stop();84 // }85 //86 // return cb();87 // }88 onChangeModel(model) {89 // set actual model outside =/90 this.setState({91 model,92 });93 }94 getFlagsEnum() {95 if (!this._flagsEnum) {96 const items = [97 {key: 'FAVOURITE', value: 'РизбÑанном'},98 ];99 if (User.isEditor()) {100 items.push({key: 'DANGER', value: 'РопаÑноÑÑи'});101 }102 this._flagsEnum = new EnumFactory(items);103 }104 return this._flagsEnum;105 }106 render() {107 // todo: replace "flags" selector with YES/NO/DONTCARE selector108 return (109 <Form110 schema={Schema}111 model={this.getModel()}112 onSubmit={this.onSubmit.bind(this)}113 className="grid-y"114 ref={(reference) => {this._form = reference;}}115 onChangeModel={this.onChangeModel.bind(this)}116 // onValidate={this.onValidate.bind(this)}117 // modelTransform={this.modelTransform.bind(this)}118 >119 <div className="cell rb-padding_x rb-f-size_x1p25">120 ÐÑиÑеÑии поиÑка121 </div>122 <div className="cell rb-flex-grow_2">123 <div className="registry-filter__modal-inner">124 <div className="rb-padding-lr_x">125 <div className="rb-group_v_x">126 {127 !!User.get()128 &&129 <Selector130 label=""131 name="flags"132 items={this.getFlagsEnum()}133 multiple134 />135 }136 <Selector137 label="СÑаÑÑÑ"138 name="status"139 items={statusEnum}140 multiple141 />142 <Selector143 label="Тип"144 name="kind"145 items={kindEnum.clone().sortByValueAscAlphabetical()}146 multiple147 />148 <Selector149 label="Регион"150 name="area"151 items={locationEnum.clone().sortByValueAscAlphabetical()}152 multiple153 />154 <Selector155 label="ÐнаÑимоÑÑÑ"156 name="level"157 items={levelEnum}158 multiple159 />160 <Selector161 label="СоÑÑоÑние"162 name="condition"163 items={conditionEnum}164 multiple165 />166 <Selector167 label="ÐаÑегоÑиÑ"168 name="category"169 items={categoryEnum.clone().sortByValueAscAlphabetical()}170 multiple171 />172 </div>173 </div>174 </div>175 </div>176 <div className="cell rb-padding_x">177 <div className="rb-group_x">178 <button179 type="submit"180 className="pl-button"181 >182 ÐÑимениÑÑ183 </button>184 <button185 type="button"186 className="pl-button"187 onClick={this.props.onCancel}188 >189 ÐÑмена190 </button>191 </div>192 </div>193 </Form>194 );195 }...
model_transformer_spec.js
Source:model_transformer_spec.js
...35 });36 });37 it('Does not touch original object', function() {38 var existingModel = util.deepCopy(model);39 transformedModel = transformer.transformModel('puppies', model);40 expect(existingModel).toEqual(model);41 });42 it('Adds an id field if one does not already exist', function() {43 delete model.id;44 transformedModel = transformer.transformModel('puppies', model);45 expect(transformedModel.id).toBeDefined();46 });47 it('Does not mangle normal strings', function() {48 transformedModel = transformer.transformModel('puppies', model);49 expect(transformedModel.sentence).toEqual(model.sentence);50 });51 it('Leaves unsupported mustache syntax alone', function() {52 transformedModel = transformer.transformModel('puppies', model);53 expect(transformedModel.unsupported).toEqual(model.unsupported);54 });55 it('Transforms a string containing a single mustache object', function() {56 transformedModel = transformer.transformModel('puppies', model);57 expect(transformedModel.name).toEqual('barney');58 });59 it('Retains the type of single built-in mustache objects', function() {60 transformedModel = transformer.transformModel('puppies', model);61 expect(transformedModel.id).toEqual(54);62 expect(typeof transformedModel.id).toEqual('number');63 });64 it('Passes the correct data to the transformer for built-in mustache objects', function() {65 transformedModel = transformer.transformModel('puppies', model);66 expect(objectTransformers.id).toHaveBeenCalledWith('puppies', 'id', '{{id}}', jasmine.any(Object));67 });68 it('Supports replacing faker-styled variables.', function() {69 transformedModel = transformer.transformModel('puppies', model);70 expect(faker.my.name).toHaveBeenCalled();71 expect(transformedModel.name).toEqual('barney');72 });73 it('Retains the type of single faker-based mustache objects', function() {74 transformedModel = transformer.transformModel('puppies', model);75 expect(transformedModel.number).toEqual(32);76 expect(typeof transformedModel.number).toBe('number');77 });78 it('Replaces mustache variables at the beginning of a string', function() {79 transformedModel = transformer.transformModel('puppies', model);80 expect(transformedModel.first).toEqual('barney is sk... barney?');81 });82 it('Replaces mustache variables at the end of a string', function() {83 transformedModel = transformer.transformModel('puppies', model);84 expect(transformedModel.last).toEqual('Yeah, my name is barney');85 });86 it('Replaces mustache variables in the middle of the string', function() {87 transformedModel = transformer.transformModel('puppies', model);88 expect(transformedModel.mid).toEqual('my name is barney, right?');89 });90 it('Replaces multiple of the same mustache variables with different values', function() {91 var hasCalled = false;92 faker.my.name.and.callFake(function() {93 hasCalled = !hasCalled;94 if (hasCalled)95 return 'meglodon';96 return 'barney';97 });98 transformedModel = transformer.transformModel('puppies', model);99 expect(transformedModel.multi).toEqual('My name is meglodon... wait no its barney!');100 });101 it('Replaces mustache syntax in sub-objects', function() {102 transformedModel = transformer.transformModel('puppies', model);103 expect(transformedModel.sub.name).toEqual('barney'); 104 });105 it('Retains the type of mustache variables in sub-objects', function() {106 transformedModel = transformer.transformModel('puppies', model);107 expect(typeof transformedModel.sub.number).toEqual('number'); 108 });109 it('Replaces mustache syntax in arrays', function() {110 transformedModel = transformer.transformModel('puppies', model);111 expect(transformedModel.array[0]).toEqual('barney'); 112 });113 it('Retains the type of mustache variables in sub-objects', function() {114 transformedModel = transformer.transformModel('puppies', model);115 expect(typeof transformedModel.array[1]).toEqual('number'); 116 });117 })...
OtherUtils.js
Source:OtherUtils.js
1/** @module OtherUtils */23/**4 * Adds a function to the microtask queue5 * 6 * @param {Function} func 7*/8export const nextTick = func => {9 setTimeout(func, 0)10}1112/**13 * Needs to be refactored and tested14 * 15 * @param {Element} HTMLElem 16*/17export const getInlineTransforms = HTMLElem => {18 const transformTypes = [{19 name: 'scale',20 variants: ['X', 'Y', 'Z', '3d'],21 },22 {23 name: 'translate',24 variants: ['X', 'Y', 'Z', '3d'],25 },26 {27 name: 'rotate',28 variants: ['X', 'Y', 'Z', '3d'],29 },30 {31 name: 'skew',32 variants: ['X', 'Y'],33 },34 {35 name: 'perspective',36 variants: [],37 },38 {39 name: 'matrix',40 variants: ['3d'],41 },42 ],43 elemTransformStr = HTMLElem.style.transform.toLowerCase();4445 return transformTypes.map(t => {46 const transformModel = {47 name: '',48 transform: {49 X: 0,50 Y: 0,51 Z: 0,52 }53 },54 transformPosition = elemTransformStr.indexOf(t.name);55 transformModel.name = t.name;56 if (transformPosition != -1) {57 let transformVariant = elemTransformStr.charAt(transformPosition + t.name.length).toUpperCase();58 if (transformVariant === '3') transformVariant = '3d';59 if (t.variants.includes(transformVariant) && transformVariant != '3d') {60 transformModel.transform[transformVariant] = elemTransformStr.substring(transformPosition + t.name.length + 2, elemTransformStr.indexOf(')', transformPosition))61 } else if (transformVariant == '3d' && t.name != 'matrix') {62 const transformValues = elemTransformStr.substring(transformPosition + t.name.length + 3, elemTransformStr.indexOf(')', transformPosition));63 let X = Y = Z = 0,64 unit;65 let valuesArray = StringUtils.replaceAll(transformValues, ' ', '').split(',');66 X = valuesArray[0] ? valuesArray[0] : 0;67 Y = valuesArray[1] ? valuesArray[1] : 0;68 Z = valuesArray[2] ? valuesArray[2] : 0;69 unit = valuesArray[3] ? valuesArray[3] : 0;70 transformModel.transform = {71 X,72 Y,73 Z,74 unit75 };76 } else {77 const transformValues = elemTransformStr.substring(transformPosition + t.name.length + 1, elemTransformStr.indexOf(')', transformPosition));78 let X = Y = Z = 0;79 if (transformValues.indexOf(',') != -1) {80 let valuesArray = StringUtils.replaceAll(transformValues, ' ', '').split(',');81 if (t.name != 'matrix') {82 X = valuesArray[0] ? valuesArray[0] : 0;83 Y = valuesArray[1] ? valuesArray[1] : 0;84 Z = valuesArray[2] ? valuesArray[2] : 0;85 transformModel.transform = {86 X,87 Y,88 Z89 };90 } else {91 transformModel.transform = valuesArray;92 }93 } else if (transformValues.length > 0) {94 if (t.name != 'rotate' && t.name != 'perspective') {95 X = transformValues;96 Y = transformValues;97 Z = 0;98 transformModel.transform = {99 X,100 Y,101 Z102 };103 } else {104 X = 0;105 Y = 0;106 Z = transformValues;107 transformModel.transform = {108 X,109 Y,110 Z111 };112 }113 }114 }115 }116 return transformModel;117 });118}119120/**121 * Normalize touch and mouse event x and y.122 * For touch events it only gets touches[0]123 * 124 * @param {Event} event 125*/126export const mouseTouchOffset = event => {127128 const elemBCR = event.currentTarget && typeof event.currentTarget.getBoundingClientRect == 'function' ?129 event.currentTarget.getBoundingClientRect() :130 event.target && typeof event.target.getBoundingClientRect == 'function' ?131 event.target.getBoundingClientRect() : {132 x: 0,133 y: 0134 }135136 if (event instanceof MouseEvent) {137 return {138 x: event.x - elemBCR.x,139 y: event.y - elemBCR.y,140 }141 } else if (event instanceof TouchEvent) {142 if (event.touches && event.touches[0])143 return {144 x: event.touches[0].clientX - elemBCR.x,145 y: event.touches[0].clientY - elemBCR.y,146 }147 else148 return {149 x: null,150 y: null151 }152 }153}154// touchesPosToArray: event => {155// if(event instanceof TouchEvent) {156// const touches = [];157// if(event.touches.length > 0)158// console.log(event.touches)159// for(let touch in event.touches) {160// console.log(touch);161// }162// }163// },164/**165 * Get touches[0] if it is set or returns null otherwise166 * @param {TouchEvent} 167*/168export const getFirstTouch = ({ touches }) => {169170 if (touches && touches[0])171 return touches[0]172 else173 return null174175}176177export default {178 getInlineTransforms,179 mouseTouchOffset,180 getFirstTouch,181 nextTick,
...
cars-model-sync.js
Source:cars-model-sync.js
...8 try {9 console.log('------------------')10 const transformModel = model => `${model.brand.name}#${model.name}`;11 const models = await selectModels({}, model => model);12 const modelNames = models.map(model => transformModel(model));13 const cars = await selectCars({}, car => car);14 for (const car of cars) {15 const modelName = transformModel(car.model);16 if (modelNames.findIndex(m => m === modelName) < 0) {17 console.log('model not found', `${modelName}#${car.variant}`);18 }19 }20 console.log('------------------')21 } catch (error) {22 console.error(error);23 }24 process.exit(0);25}26async function modelsWithoutCars() {27 console.log('modelsWithoutCars');28 let i = 0;29 try {30 console.log('------------------')31 const transformModel = model => `${model.brand.name}#${model.name}`;32 const models = await selectModels({}, model => model);33 const cars = await selectCars({}, car => car);34 const carModelNames = cars.map(car => transformModel(car.model));35 for (const model of models) {36 const modelName = transformModel(model);37 if (carModelNames.findIndex(m => m === modelName) < 0) {38 console.log('car not found for model', modelName);39 }40 }41 console.log('------------------')42 } catch (error) {43 console.error(error);44 }45 process.exit(0);46}...
all_74.js
Source:all_74.js
1var searchData=2[3 ['transformmodel',['TransformModel',['../class_transform_model.html',1,'']]],4 ['transformmodel_2ephp',['TransformModel.php',['../_transform_model_8php.html',1,'']]]...
Using AI Code Generation
1const playwright = require('playwright');2const { transformModel } = require('playwright/lib/protocol/transform');3(async () => {4 const browser = await playwright['chromium'].launch();5 const page = await browser.newPage();6 const model = await page._delegate._mainFrame._client.send('DOM.getDocument');7 const transformedModel = transformModel(model);8 console.log(transformedModel);9 await browser.close();10})();11{12 root: {13 }14}
Using AI Code Generation
1const { transformModel } = require('playwright-core/lib/server/supplements/recorder/recorderSupplement');2const model = {3 {4 },5 {6 },7 {8 },9 {10 },11};12(async () => {13 const transformedModel = await transformModel(model);14 console.log(transformedModel);15})();16{17 {18 },19 {20 },21 {22 },23 {24 },25}
Using AI Code Generation
1const { transformModel } = require('playwright/lib/server/supplements/recorder/recorderSupplement.js');2const model = {3 {4 "requestHeaders": {5 "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36",6 "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"7 },8 "responseHeaders": {9 "content-type": "text/html; charset=ISO-8859-1"10 }11 }12};13const transformedModel = transformModel(model);14console.log(transformedModel);15{16 {17 "requestHeaders": {18 "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36",19 "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"20 },21 "responseHeaders": {22 "content-type": "text/html; charset=ISO-8859-1"23 }24 }25 {
Using AI Code Generation
1const { transformModel } = require('playwright/lib/server/frames');2const { Frame } = require('playwright/lib/server/dom');3const { ElementHandle } = require('playwright/lib/server/dom');4const { JSHandle } = require('playwright/lib/server/dom');5const { Page } = require('playwright/lib/server/page');6const { CDPSession } = require('playwright/lib/server/cdpsession');7const { Connection } = require('playwright/lib/server/connection');8const { helper } = require('playwright/lib/helper');9const { assert } = require('playwright/lib/helper');10const { debugError } = require('playwright/lib/helper');11const { debug } = require('playwright/lib/helper');12const { parseSelector } = require('playwright/lib/server/selectors');13const { SelectorEngine } = require('playwright/lib/server/selectors');14const { createHandle } = require('playwright/lib/server/frames');15const { createJSHandle } = require('playwright/lib/server/frames');16const { createHandleFromElement } = require('playwright/lib/server/frames');17const { createHandleFromElementHandle } = require('playwright/lib/server/frames');18const { createHandleFromJSHandle } = require('playwright/lib/server/frames');19const { createHandleFromExecutionContext } = require('playwright/lib/server/frames');20const { createHandleFromEvaluateHandle } = require('playwright/lib/server/frames');21const { createHandleFromEvaluateHandlePromise } = require('playwright/lib/server/frames');22const { createHandleFromBindingCall } = require('playwright/lib/server/frames');23const { createHandleFromBindingCallPromise } = require('playwright/lib/server/frames');24const { createHandleFromExecutionContextPromise } = require('playwright/lib/server/frames');25const { createHandleFromEvaluateHandlePromise } = require('playwright/lib/server/frames');26const { createHandleFromBindingCallPromise } = require('playwright/lib/server/frames');27const { createHandleFromExecutionContextPromise } = require('playwright/lib/server/frames');28const { createHandleFromEvaluateHandlePromise } = require('playwright/lib/server/frames');29const { createHandleFromBindingCallPromise } = require('playwright/lib/server/frames');30const { createHandleFromExecutionContextPromise } = require('playwright/lib/server/frames');31const { createHandleFromEvaluateHandlePromise } = require('play
Using AI Code Generation
1const { transformModel } = require('playwright-core/lib/server/frames.js');2const { parseSelector } = require('playwright-core/lib/server/selectors.js');3const { parseScript } = require('playwright-core/lib/server/frames.js');4const { parseCallArgument } = require('playwright-core/lib/server/frames.js');5const { serializeResult } = require('playwright-core/lib/server/frames.js');6const { serializeError } = require('playwright-core/lib/server/frames.js');7const { Frame } = require('playwright-core/lib/server/frames.js');8const { ElementHandle } = require('playwright-core/lib/server/dom.js');9const { JSHandle } = require('playwright-core/lib/server/jsHandle.js');10const { parseSelector } = require('playwright-core/lib/server/selectors.js');11const { parseScript } = require('playwright-core/lib/server/frames.js');12const { parseCallArgument } = require('playwright-core/lib/server/frames.js');13const { serializeResult } = require('playwright-core/lib/server/frames.js');14const { serializeError } = require('playwright-core/lib/server/frames.js');15const { Frame } = require('playwright-core/lib/server/frames.js');16const { ElementHandle } = require('playwright-core/lib/server/dom.js');17const { JSHandle } = require('playwright-core/lib/server/jsHandle.js');18const { parseSelector } = require('playwright-core/lib/server/selectors.js');19const { parseScript } = require('playwright-core/lib/server/frames.js');20const { parseCallArgument } = require('playwright-core/lib/server/frames.js');21const { serializeResult } = require('playwright-core/lib/server/frames.js');22const { serializeError } = require('playwright-core/lib/server/frames.js');23const { Frame } = require('playwright-core/lib/server/frames.js');24const { ElementHandle } = require('playwright-core/lib/server/dom.js');25const { JSHandle } = require('playwright-core/lib/server/jsHandle.js');26const { parseSelector } = require('playwright-core/lib/server/selectors.js');27const { parseScript } = require('playwright-core/lib/server/frames.js');28const { parseCallArgument } = require('playwright-core/lib/server/frames.js');29const { serializeResult } = require('playwright-core/lib/server/frames.js');30const { serializeError } =
Using AI Code Generation
1const { transformModel } = require('playwright/lib/server/supplements/recorder/recorderSupplement');2const { Page } = require('playwright/lib/server/page');3const { ElementHandle } = require('playwright/lib/server/dom');4const { Frame } = require('playwright/lib/server/frame');5const { JSHandle } = require('playwright/lib/server/jsHandle');6const { Worker } = require('playwright/lib/server/worker');7const { BrowserContext } = require('playwright/lib/server/browserContext');8const { page } = require('playwright');9const { chromium } = require('playwright');10(async () => {11 const browser = await chromium.launch();12 const context = await browser.newContext();13 const page = await context.newPage();14 await page.click('text=Google offered in:');15 const transformedModel = transformModel(page);16 console.log(transformedModel);17 await browser.close();18})();
Using AI Code Generation
1const { transformModel } = require('playwright/lib/server/frames');2const { Page } = require('playwright');3const { Frame } = require('playwright/lib/server/frames');4const { transformModel } = require('playwright/lib/server/frames');5const { Page } = require('playwright');6const { Frame } = require('playwright/lib/server/frames');7const { transformModel } = require('playwright/lib/server/frames');8const { Page } = require('playwright');9const { Frame } = require('playwright/lib/server/frames');10const { transformModel } = require('playwright/lib/server/frames');11const { Page } = require('playwright');12const { Frame } = require('playwright/lib/server/frames');13const { transformModel } = require('playwright/lib/server/frames');14const { Page } = require('playwright');15const { Frame } = require('playwright/lib/server/frames');16const { transformModel } = require('playwright/lib/server/frames');17const { Page } = require('playwright');18const { Frame } = require('playwright/lib/server/frames');19const { transformModel } = require('playwright/lib/server/frames');20const { Page } = require('playwright');21const { Frame } = require('playwright/lib/server/frames');22const { transformModel } = require('playwright/lib/server/frames');23const { Page } = require('playwright');24const { Frame } = require('playwright/lib/server/frames');25const { transformModel } = require('playwright/lib/server/frames');26const { Page } = require('playwright');27const { Frame } = require('playwright/lib/server/frames');28const { transformModel } = require('playwright/lib/server/frames');29const { Page } = require('playwright');30const { Frame }
Using AI Code Generation
1const { transformModel } = require('playwright/lib/internal/transformModel');2const fs = require('fs');3const path = require('path');4const model = {5 {6 {7 },8 },9};10const transformedModel = transformModel(model);11fs.writeFileSync(path.join(__dirname, 'test.json'), JSON.stringify(transformedModel, null, 2));12{13 {14 {15 "retry": {16 }17 }18 }19}
Using AI Code Generation
1const { transformModel } = require('playwright-core/lib/server/supplements/recorder/recorderSupplement');2const transformedModel = transformModel(model);3console.log(transformedModel);4const { transformModel } = require('playwright/lib/server/supplements/recorder/recorderSupplement');5const transformedModel = transformModel(model);6console.log(transformedModel);7const { transformModel } = require('playwright/lib/server/supplements/recorder/recorderSupplement');8const transformedModel = transformModel(model);9console.log(transformedModel);10const { transformModel } = require('playwright/lib/server/supplements/recorder/recorderSupplement');11const transformedModel = transformModel(model);12console.log(transformedModel);13const { transformModel } = require('playwright/lib/server/supplements/recorder/recorderSupplement');14const transformedModel = transformModel(model);15console.log(transformedModel);16const { transformModel } = require('playwright/lib/server/supplements/recorder/recorderSupplement');17const transformedModel = transformModel(model);18console.log(transformedModel);19const { transformModel } = require('playwright/lib/server/supplements/recorder/recorderSupplement');20const transformedModel = transformModel(model);21console.log(transformedModel);
Using AI Code Generation
1const { transformModel } = require('playwright-core/lib/server/supplements/recorder/recorderSupplement.js');2const model = await transformModel({3 { type: 'keydown', modifiers: 0, timestamp: 1617925832215, text: 'a', unmodifiedText: 'a', code: 'KeyA', key: 'a', windowsVirtualKeyCode: 65, nativeVirtualKeyCode: 65, autoRepeat: false, location: 0, isKeypad: false, isSystemKey: false, altKey: false, ctrlKey: false, metaKey: false, shiftKey: false, inputSource: 'keyboard' },4 { type: 'input', modifiers: 0, timestamp: 1617925832215, data: 'a', isComposing: false },5 { type: 'keyup', modifiers: 0, timestamp: 1617925832215, text: 'a', unmodifiedText: 'a', code: 'KeyA', key: 'a', windowsVirtualKeyCode: 65, nativeVirtualKeyCode: 65, autoRepeat: false, location: 0, isKeypad: false, isSystemKey: false, altKey: false, ctrlKey: false, metaKey: false, shiftKey: false, inputSource: 'keyboard' }6});7console.log(model);8const { transformModel } = require('@playwright/test/lib/recorder/recorderSupplement.js');9const model = await transformModel({10 { type: 'keydown', modifiers: 0, timestamp: 1617925832215, text: 'a', unmodifiedText: 'a', code: 'KeyA', key: 'a', windowsVirtualKeyCode: 65, nativeVirtualKeyCode: 65, autoRepeat: false, location: 0, isKeypad: false, isSystemKey: false, altKey: false, ctrlKey: false, metaKey: false, shiftKey: false, inputSource: 'keyboard' },11 { type: 'input', modifiers
LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.
Get 100 minutes of automation test minutes FREE!!