Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Add bottom margin to cards list.
#cards-list-container { padding: 150px 15px 15px 250px; position: relative; z-index: 1; } .cards-list { height: 100%; position: relative; width: 100%; }
#cards-list-container { margin-bottom: 15px; padding: 150px 15px 15px 250px; position: relative; z-index: 1; } .cards-list { height: 100%; position: relative; width: 100%; }
Disable pointer events on inactive bullets
// Bespoke Classes: https://github.com/markdalgleish/bespoke-classes // Stylus: http://learnboost.github.io/stylus @import 'normalizecss/normalize.css' .bespoke-parent position: absolute top: 0 left: 0 right: 0 bottom: 0 .bespoke-scale-parent position: absolute top: 0 left: 0 right: 0 bottom: 0 .bespoke-slide width: 640px height: 480px position: absolute top: 50% left: 50% margin-left: -(@width / 2) margin-top: -(@height / 2) display: flex flex-direction: column justify-content: center align-items: center .bespoke-inactive opacity: 0 pointer-events: none .bespoke-bullet-inactive opacity: 0 .emphatic background: #222 color: white .bespoke-progress-parent position: absolute top: 0 left: 0 right: 0 height: .3vw .bespoke-progress-bar position: absolute height: 100% background: #ccc transition: width .6s ease
// Bespoke Classes: https://github.com/markdalgleish/bespoke-classes // Stylus: http://learnboost.github.io/stylus @import 'normalizecss/normalize.css' .bespoke-parent position: absolute top: 0 left: 0 right: 0 bottom: 0 .bespoke-scale-parent position: absolute top: 0 left: 0 right: 0 bottom: 0 .bespoke-slide width: 640px height: 480px position: absolute top: 50% left: 50% margin-left: -(@width / 2) margin-top: -(@height / 2) display: flex flex-direction: column justify-content: center align-items: center .bespoke-inactive opacity: 0 pointer-events: none .bespoke-bullet-inactive opacity: 0 pointer-events: none .emphatic background: #222 color: white .bespoke-progress-parent position: absolute top: 0 left: 0 right: 0 height: .3vw .bespoke-progress-bar position: absolute height: 100% background: #ccc transition: width .6s ease
Fix display of recent blog posts after theme update
// Blog Feed .blog-feed margin-top global-margin * 3 .blog-feed__header margin-top global-margin * 2 a text-decoration none a:hover text-decoration underline .blog-feed__posts margin-top global-margin display flex flex-flow row wrap margin-left: -20px; margin-right: -20px; // Blog Post .blog-post flex 0 0 33.333333% padding 0 20px 40px .blog-post__header text-decoration none a text-decoration none a:hover text-decoration underline .blog-post__image height 165px overflow hidden margin-bottom 20px position relative img display block position absolute top 50% left 0 transform translateY(-50%)
// Blog Feed .blog-feed margin-top global-margin * 3 .blog-feed__header margin-top global-margin * 2 a text-decoration none a:hover text-decoration underline .blog-feed__posts margin-top global-margin display flex flex-flow row wrap margin-left: -20px; margin-right: -20px; // Blog Post .blog-post flex 0 0 33.333333% padding 0 20px 40px // Fix for unnecessary screen reader text for 'read more' link in blog feed .screen-reader-text display none .blog-post__header text-decoration none a text-decoration none a:hover text-decoration underline .blog-post__image height 220px overflow hidden margin-bottom 20px position relative img display block position absolute top 50% left 0 transform translateY(-50%)
Fix browser discrepancy on textarea
// Wrap in body for higher specificity body .mdl-textfield--floating-label.is-invalid .mdl-textfield__label color mdl-error .mdl-textfield__error display block :invalid box-shadow none .textarea-label:after bottom 23px
.mdl-textfield .mdl-textfield--floating-label.is-invalid .mdl-textfield__label color mdl-error .mdl-textfield__error display block :invalid box-shadow none textarea vertical-align top
Remove text on small screen :art:
.introjs-tooltip background-color transparent color white box-shadow none .tooltipBottom min-width inherit max-width inherit width 200%!important // @stylint ignore .tooltipRight, .tooltipSmallRight min-width 100% max-width 100% .tooltipSmallBottom margin-top -20px left -10px!important // @stylint ignore right -10px!important // @stylint ignore .tooltipLeft left -300px!important // @stylint ignore right -50px!important // @stylint ignore min-width inherit max-width inherit .tooltipCenter top 100%!important // @stylint ignore left 100%!important // @stylint ignore width 400px .introjs-prevbutton, .introjs-arrow, .introjs-helperNumberLayer, .introjs-skipbutton display none !important // @stylint ignore .introjs-tooltipbuttons text-align left .introjs-button margin-top 20px text-align center padding 11px 24px border-radius 2px background-color dodger-blue color white background-image none text-shadow inherit border-width 0 font-size 14px text-transform uppercase .introjs-button:focus, .introjs-button:active background-image none .introjs-button:hover box-shadow none
.introjs-tooltip background-color transparent color white box-shadow none .tooltipBottom min-width inherit max-width inherit width 200%!important // @stylint ignore .tooltipRight, .tooltipSmallRight min-width 100% max-width 100% .tooltipSmallBottom margin-top -20px left -10px!important // @stylint ignore right -10px!important // @stylint ignore .tooltipLeft left -300px!important // @stylint ignore right -50px!important // @stylint ignore min-width inherit max-width inherit .tooltipCenter top 100%!important // @stylint ignore left 100%!important // @stylint ignore width 400px .introjs-prevbutton, .introjs-arrow, .introjs-helperNumberLayer, .introjs-skipbutton display none !important // @stylint ignore .introjs-tooltipbuttons text-align left .introjs-button margin-top 20px text-align center padding 11px 24px border-radius 2px background-color dodger-blue color white background-image none text-shadow inherit border-width 0 font-size 14px text-transform uppercase .introjs-button:focus, .introjs-button:active background-image none .introjs-button:hover box-shadow none @media (max-width: 40em) .introjs-tooltiptext div display none h1 font-size 1.5em
Implement user edit page in ACP
// Page header block (under breadcrubmbs): title + description // @import "nodeca.core/client/common/_variables" .page-head margin-top 1.5rem margin-bottom 1rem .page-actions margin-top -.25rem .page-head__title margin 0 font-weight normal font-size $font-size-h3 //color $brand-primary
// Page header block (under breadcrubmbs): title + description // @import "nodeca.core/client/common/_variables" .page-head margin-top 1.5rem margin-bottom 1rem .page-actions margin-top -.25rem .page-head__title margin 0 font-weight normal font-size $font-size-h3 //color $brand-primary .page-head__descr font-size $font-size-xs color $body-color-secondary margin .2em 0 0 0
Add osx font smoothing for firefox too
html body padding: 0 margin: 0 body -webkit-font-smoothing: antialiased position: relative img border: 0
html body padding: 0 margin: 0 body -webkit-font-smoothing: antialiased -moz-osx-font-smoothing: grayscale position: relative img border: 0
Fix the live auction preview image width in Safari
@require '../stylus_lib' reminder-width = 500px reminder-height = 120px .auction-reminders position fixed bottom 40px right 40px z-index zindex-modal .auction-reminder position relative display flex width reminder-width height reminder-height block-margins(15px) padding 15px 90px 15px 15px align-items center justify-content space-between background-color white border 1px solid gray-lighter-color text-decoration none transition opacity 0.25s, transform 0.5s &[data-state='open'] opacity 1 transform translateY(0) &, &[data-state='closed'] opacity 0 transform translateY(reminder-height / 2) .auction-reminder-metadata margin 0 20px > h4 avant-garde-size('s-headline') > h3 margin 3px 0 garamond-size('s-body') .auction-reminder-clock white-space nowrap // Hide some bits of the clock .clock-header .clock-days .clock-days + li display none .auction-reminder-close position absolute top 0 right 0 padding 20px color gray-color &:hover color gray-lighter-color > .icon-close font-size 26px line-height @font-size
@require '../stylus_lib' reminder-width = 500px reminder-height = 120px .auction-reminders position fixed bottom 40px right 40px z-index zindex-modal .auction-reminder position relative display flex width reminder-width height reminder-height block-margins(15px) padding 15px 90px 15px 15px align-items center justify-content space-between background-color white border 1px solid gray-lighter-color text-decoration none transition opacity 0.25s, transform 0.5s &[data-state='open'] opacity 1 transform translateY(0) &, &[data-state='closed'] opacity 0 transform translateY(reminder-height / 2) .auction-reminder-image min-width:90px .auction-reminder-metadata margin 0 20px > h4 avant-garde-size('s-headline') > h3 margin 3px 0 garamond-size('s-body') .auction-reminder-clock white-space nowrap // Hide some bits of the clock .clock-header .clock-days .clock-days + li display none .auction-reminder-close position absolute top 0 right 0 padding 20px color gray-color &:hover color gray-lighter-color > .icon-close font-size 26px line-height @font-size
Add box-sizing: border box on all elements
global-reset() @import variables html height 100% body height 100% font-size 18px font-family Lato, sans-serif font-weight 300 margin 0 a color link-color h1, h2, h3, h4, h5 font-weight 400 @import layout @import helpers @import buttons @import alerts @import builds @import projects
@import variables global-reset() * box-sizing border-box html height 100% body height 100% font-size 18px font-family Lato, sans-serif font-weight 300 margin 0 a color link-color h1, h2, h3, h4, h5 font-weight 400 @import layout @import helpers @import buttons @import alerts @import builds @import projects
Load normalize from node_modules using webpack's resolver
@import '_vars.styl' :global @import 'normalize.css/normalize.css' html font-family "futura-pt", sans-serif &.wf-loading color transparent * color transparent !important text-shadow none !important ::selection background selection-color color lighten(selection-color, 75%) a color accentColor text-decoration none &:hover, &:focus text-decoration underline body min-height 100vh background-color splashDark color mainColor
@import '_vars.styl' :global @import '~normalize.css/normalize.css' html font-family "futura-pt", sans-serif &.wf-loading color transparent * color transparent !important text-shadow none !important ::selection background selection-color color lighten(selection-color, 75%) a color accentColor text-decoration none &:hover, &:focus text-decoration underline body min-height 100vh background-color splashDark color mainColor
Add extra exclamation mark to preserve buffered/important comment structure
/*! baremetal v0.1.0 | MIT License | github.com/ryennelsen/baremetal */ @require globals @require variables @require grid @require forms
/*!! baremetal v0.1.0 | MIT License | github.com/ryennelsen/baremetal */ @require globals @require variables @require grid @require forms
Increase map height on narrow screens
// maintain aspect ratio of 4:3 for the map, see // https://stackoverflow.com/questions/1495407/maintain-the-aspect-ratio-of-a-div-with-css // .location-show-dlg__map-container width 100% padding-bottom 75% position relative // same background as for .leaflet-container, // in case styles for leaflet aren't loaded yet background #ddd .location-show-dlg__map position absolute top 0 bottom 0 left 0 right 0
@import "nodeca.core/client/common/_variables" // maintain aspect ratio of 4:3 for the map, see // https://stackoverflow.com/questions/1495407/maintain-the-aspect-ratio-of-a-div-with-css // .location-show-dlg__map-container width 100% padding-bottom 75% position relative // same background as for .leaflet-container, // in case styles for leaflet aren't loaded yet background #ddd .location-show-dlg__map position absolute top 0 bottom 0 left 0 right 0 @media (max-width: $grid-breakpoints.sm - 1) .location-show-dlg__map-container padding-bottom 100%
Tweak alignment of stats tooltips
.main-page h1 font-weight 300 margin-bottom 0 .stat-display display inline-block width 100% margin 40px 0 20px 0 display flex justify-content space-between flex-flow wrap .stat-display__stat margin 0 20px 20px 20px text-align center width calc(50% - 40px) +above(desktop) margin 0 0 20px 0 width (1/7*100)% .stat-display__value font-family inherit color $brand_primary font-size 38px margin 0 font-weight 300 small color #666 font-size 1em line-height 1 .tooltip left -15% width 130% &:before left 50%
.main-page h1 font-weight 300 margin-bottom 0 .stat-display display inline-block width 100% margin 40px 0 20px 0 display flex justify-content space-between flex-flow wrap .stat-display__stat margin 0 20px 20px 20px text-align center width calc(50% - 40px) +above(desktop) margin 0 0 20px 0 width (1/7*100)% .stat-display__value font-family inherit color $brand_primary font-size 38px margin 0 font-weight 300 small color #666 font-size 1em line-height 1 .tooltip width 100% &:before left 50%
Fix .l-center appearing and disappearing.
// Tâmia © 2013 Artem Sapegin http://sapegin.me // Helper classes // Element is hidden. .is-hidden display: none /// Element is in transit between hidden (.is-hidden) and visible. .is-transit display: block // Disabled form element. .is-disabled cursor: default pointer-events: none opacity: .4 text-shadow: none // Image replacement. .ir background-color: transparent border: 0 overflow: hidden &:before content: "" display: block width: 0 height: 150% // Clearfix. .group clearfix()
// Tâmia © 2013 Artem Sapegin http://sapegin.me // Helper classes // Element is hidden. .is-hidden display: none /// Element is in transit between hidden (.is-hidden) and visible. .is-transit display: block &.l-center display: table // Disabled form element. .is-disabled cursor: default pointer-events: none opacity: .4 text-shadow: none // Image replacement. .ir background-color: transparent border: 0 overflow: hidden &:before content: "" display: block width: 0 height: 150% // Clearfix. .group clearfix()
Fix styling on mobile page
@require '_frontend/styles/colors' @require '_frontend/styles/grid' @require '_frontend/styles/spacing' .form { col(1/2, offset: 1/4) background-color $white border-radius 5px margin-top $spacing2x margin-bottom $spacing2x padding $spacing2x } .section { margin-bottom $spacing1x } .input { border 1px solid $kindaLightGray box-sizing border-box color $darkGray padding $spacingHalf width 100% }
@require '_frontend/styles/colors' @require '_frontend/styles/grid' @require '_frontend/styles/spacing' .form { +desktop() { col(1/2, offset: 1/4) } +tablet() { margin-right $spacing2x margin-left $spacing2x } +mobile() { border-radius 0 } background-color $white border-radius 5px margin-top $spacing2x margin-bottom $spacing2x padding $spacing2x } .section { margin-bottom $spacing1x } .input { border 1px solid $kindaLightGray box-sizing border-box color $darkGray padding $spacingHalf width 100% }
Remove visited state for item-action buttons
.btn.item-action { color: #9B9B9B !important; font-size: 13px; font-weight: bold; &:hover, &:focus, &:active, &:visited { color: #555 !important; text-decoration: none; } }
.btn.item-action { color: #9B9B9B !important; font-size: 13px; font-weight: bold; &:hover, &:focus, &:active { color: #555 !important; text-decoration: none; } }
Remove left gallery icon padding
@require '../../../../components/inquiry_questionnaire/stylesheets' .artwork-partner display flex block-margins(gutter / 2) padding gutter 0 align-items center &__icon &__metadata padding 0 (gutter / 2) &__icon &--icon background-color white > a display block width 90px height @width margin 0 auto background-size contain background-repeat no-repeat background-position center center initials() &__metadata border-left 1px solid gray-lighter-color &__name garamond-size('s-headline') text-decoration none &__locations garamond-size('s-body') color gray-dark-color &__bio margin (gutter / 4) 0 (gutter / 2) 0 garamond-size('s-body') &__actions margin-top (gutter / 2) > a > span inline-block-margins(gutter / 4) &__followers garamond-size('l-caption') color gray-dark-color
@require '../../../../components/inquiry_questionnaire/stylesheets' .artwork-partner display flex block-margins(gutter / 2) padding gutter 0 align-items center &__metadata padding 0 (gutter / 2) &__icon padding-right (gutter / 2) &--icon background-color white > a display block width 90px height @width background-size contain background-repeat no-repeat background-position center center initials() &__metadata border-left 1px solid gray-lighter-color &__name garamond-size('s-headline') text-decoration none &__locations garamond-size('s-body') color gray-dark-color &__bio margin (gutter / 4) 0 (gutter / 2) 0 garamond-size('s-body') &__actions margin-top (gutter / 2) > a > span inline-block-margins(gutter / 4) &__followers garamond-size('l-caption') color gray-dark-color
Fix url string on font-face
@font-face font-family 'Lato' font-style normal font-weight 400 src local('Lato Normal'), local('Lato-Normal'), url(https://themes.googleusercontent.com/static/fonts/lato/v6/9k-RPmcnxYEPm8CNFsH2gg.woff) format('woff')
@font-face font-family 'Lato' font-style normal font-weight 400 src local('Lato Normal'), local('Lato-Normal'), url('https://themes.googleusercontent.com/static/fonts/lato/v6/9k-RPmcnxYEPm8CNFsH2gg.woff') format('woff')
Fix margin on worker list
.worker-list list-style-type none li width 80% padding 1em margin 0.5em auto display inline-block border link-color 1px solid h3 margin 0 .versions margin 0 dt font-weight 400 display inline-block margin .4em &:first-child margin-left 0 dd display inline-block margin 0 margin-right .8em @media screen and (min-width 900px) .worker-list li max-width 46% &:nth-child(2n) float right margin-right 0 &:nth-child(n) margin-left 0
.worker-list list-style-type none margin 0 li width 80% padding 1em margin 0.5em auto display inline-block border link-color 1px solid h3 margin 0 .versions margin 0 dt font-weight 400 display inline-block margin .4em &:first-child margin-left 0 dd display inline-block margin 0 margin-right .8em @media screen and (min-width 900px) .worker-list li max-width 46% &:nth-child(2n) float right margin-right 0 &:nth-child(n) margin-left 0
Index page: fix for mobile phones (narrow screen)
.home-slogan text-align center .home-description text-align center margin-bottom 40px .home-download background #eee display flex justify-content space-between align-items center a text-decoration none .home-logo padding 20px 40px 20px 20px img height 120px .home-download-details flex 1 p margin 0 padding 0 .home-download-version display block font-size 1.4rem font-weight 700 color black border-radius 0 4px 0 0 margin-bottom 20px .home-download-list color rgba(0, 0, 0, 0.5) font-size 0.9rem padding-top 0 padding-bottom 0 height 28px max-height 28px a:after content ', ' a:nth-last-child(2):after content ' & ' color rgba(0, 0, 0, 0.5) a:last-child:after content '' .home-secondary-links margin-top 40px p text-align center
.home-slogan text-align center .home-description text-align center margin-bottom 40px .home-download background #eee display flex justify-content space-between align-items center a text-decoration none .home-logo padding 20px 40px 20px 20px img height 120px .home-download-details flex 1 p margin 0 padding 0 .home-download-version display block font-size 1.4rem font-weight 700 color black border-radius 0 4px 0 0 margin-bottom 20px .home-download-list color rgba(0, 0, 0, 0.5) font-size 0.9rem padding-top 0 padding-bottom 0 margin-right 10px a:after content ', ' a:nth-last-child(2):after content ' & ' color rgba(0, 0, 0, 0.5) a:last-child:after content '' .home-secondary-links margin-top 40px p text-align center
Move underlined tabs definition to separate style
@import "nodeca.core/client/common/_variables" .btn + .btn margin-left .4rem .btn-square padding-left 0 !important padding-right 0 !important min-width 2.375em // 38px .btn-sm.btn-square min-width 2.0em // 28px .btn-xs.btn-square min-width 1.917em // 23px .dropdown-toggle.btn-square:after margin-left 0 .dropdown-toggle.icon:after border none width 0 margin 0 // Fix bottom margin when h1..h6 used .card-header margin-bottom 0 !important .form-group small display inline-block line-height 1.3em margin-top .5em .nav-tabs border-bottom unset !important .nav-link border none !important border-radius 0 !important padding .5em .5em !important border-bottom 3px solid transparent !important &.active border-bottom 3px solid $brand-primary !important .nav-item + .nav-item margin-left .7em !important
@import "nodeca.core/client/common/_variables" .btn + .btn margin-left .4rem .btn-square padding-left 0 !important padding-right 0 !important min-width 2.375em // 38px .btn-sm.btn-square min-width 2.0em // 28px .btn-xs.btn-square min-width 1.917em // 23px .dropdown-toggle.btn-square:after margin-left 0 .dropdown-toggle.icon:after border none width 0 margin 0 // Fix bottom margin when h1..h6 used .card-header margin-bottom 0 !important .form-group small display inline-block line-height 1.3em margin-top .5em // Additional tabs style .nav-tabs-underlined .nav-link padding .5em .5em border-bottom 3px solid transparent &.active border-bottom 3px solid $brand-primary .nav-link + .nav-link margin-left .7em
Use a webpack compatible import statement for nib
@import nib .g-item-image-viewer-select select display inline width auto margin-left 25px .image-viewer border 1px solid #f0f0f0 width 100% height 600px -webkit-touch-callout none user-select none &:focus outline none .g-li-full-screen width 100% height 100% position absolute top 0 left 0
@import '~nib/index.styl' .g-item-image-viewer-select select display inline width auto margin-left 25px .image-viewer border 1px solid #f0f0f0 width 100% height 600px -webkit-touch-callout none user-select none &:focus outline none .g-li-full-screen width 100% height 100% position absolute top 0 left 0
Tweak articles margin when with other information
@require '../tabs' .artwork-additional-info // &__content // &__articles // &__article display table width 75% block-margins(gutter / 2) text-decoration none &__image &__metadata display table-cell vertical-align middle &__metadata padding-left (gutter / 2) width 100% &__context &__author sans('s-headline') line-height 1 &__title serif('s-body') line-height 1.25 // compact-line-height margin (gutter / 3) 0 &__author color gray-darker-color
@require '../tabs' .artwork-additional-info // &__content // &__articles // p + &__articles margin-top gutter &__article display table width 75% block-margins(gutter / 2) text-decoration none &__image &__metadata display table-cell vertical-align middle &__metadata padding-left (gutter / 2) width 100% &__context &__author sans('s-headline') line-height 1 &__title serif('s-body') line-height 1.25 // compact-line-height margin (gutter / 3) 0 &__author color gray-darker-color
Add top padding at the body
@import 'defs/colors' header header-height = 75px item-height = 52px background color_text_lighter display block position fixed z-index 1 width 100% height header-height line-height header-height .logo margin 0 1em display block float left img margin-top ( ( header-height - item-height ) / 2 ) nav float right margin 0 1em 0 0 ul li display inline-block vertical-align middle a color color_text_medium !important padding 0 1em height 48px line-height 48px display block &.button button()
@import 'defs/colors' header-height = 75px body padding-top header-height header item-height = 52px background color_text_lighter display block position fixed z-index 1 width 100% height header-height line-height header-height .logo margin 0 1em display block float left img margin-top ( ( header-height - item-height ) / 2 ) nav float right margin 0 1em 0 0 ul li display inline-block vertical-align middle a color color_text_medium !important padding 0 1em height 48px line-height 48px display block &.button button()
Fix the layout of dropdown submenus
.histomicstk-body #g-app-header-container #h-navbar-brand font-size 25px font-weight 700 .g-header-wrapper .h-image-menu-wrapper display inline float right z-index 1000 @media (min-width: 768px) .navbar-right float none margin-right 0 position absolute right 0 white-space nowrap z-index 10 .navbar-nav li float none display inline-block .navbar > .container-fluid .navbar-brand margin-left 0 .navbar-header z-index 20 background #f8f8f8 float none position absolute left 0
.histomicstk-body #g-app-header-container #h-navbar-brand font-size 25px font-weight 700 .g-header-wrapper .h-image-menu-wrapper display inline float right z-index 1000 @media (min-width: 768px) .navbar-right float none margin-right 0 position absolute right 0 white-space nowrap z-index 10 .navbar-nav > li float none display inline-block .navbar > .container-fluid .navbar-brand margin-left 0 .navbar-header z-index 20 background #f8f8f8 float none position absolute left 0
Revert "Hidden class is more important"
@import "vars/colors.styl" @import "vars/layout.styl" @import "blocks/button/button.styl" @import "blocks/popup/popup.styl" @import "blocks/radio-button/radio-button.styl" @import "blocks/select/select.styl" @import "blocks/checkbox/checkbox.styl" @import "blocks/icon/icon.styl" IMG border: 0; ._hidden display: none !important ._link color: #22C cursor: pointer transition: color .15s ease-out a._link text-decoration: none ._link:hover color: #D00 ._link_outer color: #070
@import "vars/colors.styl" @import "vars/layout.styl" @import "blocks/button/button.styl" @import "blocks/popup/popup.styl" @import "blocks/radio-button/radio-button.styl" @import "blocks/select/select.styl" @import "blocks/checkbox/checkbox.styl" @import "blocks/icon/icon.styl" IMG border: 0; ._hidden display: none; ._link color: #22C cursor: pointer transition: color .15s ease-out a._link text-decoration: none ._link:hover color: #D00 ._link_outer color: #070
Use justify to align body text
html background-color: $hl color: $fg margin: 1em body background-color: $bg margin: 0 auto max-width: 23cm border: 1pt solid $comment padding: 1em code background-color: $hl padding: 2px a color: $blue a:visited color: $orange a:hover color: $orange h1 color: $red h2,h3,h4,h5,h6 if $solarized is dark color: $yellow else color: $violet text-align: center pre background-color: $bg color: $fg border: 1pt solid $comment padding: 1em box-shadow: 5pt 5pt 8pt $hl code background-color: @background-color h1 font-size: 2.8em h2 font-size: 2.4em h3 font-size: 1.8em h4 font-size: 1.4em h5 font-size: 1.3em h6 font-size: 1.15em table border: hidden border-color: $comment margin-left:auto; margin-right:auto; colgroup border: 1px solid $comment tr:nth-child(even) background-color: $hl
html background-color: $hl color: $fg margin: 1em body background-color: $bg margin: 0 auto max-width: 23cm border: 1pt solid $comment padding: 1em text-align: justify code background-color: $hl padding: 2px a color: $blue a:visited color: $orange a:hover color: $orange h1 color: $red h2,h3,h4,h5,h6 if $solarized is dark color: $yellow else color: $violet text-align: center pre background-color: $bg color: $fg border: 1pt solid $comment padding: 1em box-shadow: 5pt 5pt 8pt $hl code background-color: @background-color h1 font-size: 2.8em h2 font-size: 2.4em h3 font-size: 1.8em h4 font-size: 1.4em h5 font-size: 1.3em h6 font-size: 1.15em table border: hidden border-color: $comment margin-left:auto; margin-right:auto; colgroup border: 1px solid $comment tr:nth-child(even) background-color: $hl
Add bespoke-scale styles for Firefox
<% if (syntax) { %>// Import CSS from "bower_components" // thanks to Stylus' "import css" and "paths" options @import 'prism/themes/prism-okaidia.css' // Check out "bower_components/prism/themes/" for available themes <% } %>// New to Stylus? Check out http://learnboost.github.io/stylus // Use modern CSS thanks to Autoprefixer: https://github.com/ai/autoprefixer <% if (!useTheme) { %> // Style using Bespoke Classes: https://github.com/markdalgleish/bespoke-classes .bespoke-parent position: absolute top: 0 left: 0 right: 0 bottom: 0 .bespoke-slide width: 640px height: 480px position: absolute top: 50% left: 50% margin-left: -(@width / 2) margin-top: -(@height / 2) .bespoke-inactive display: none .bespoke-bullet-inactive display: none <% } %>
<% if (syntax) { %>// Import CSS from "bower_components" // thanks to Stylus' "import css" and "paths" options @import 'prism/themes/prism-okaidia.css' // Check out "bower_components/prism/themes/" for available themes <% } %>// New to Stylus? Check out http://learnboost.github.io/stylus // Use modern CSS thanks to Autoprefixer: https://github.com/ai/autoprefixer <% if (!useTheme) { %> // Style using Bespoke Classes: https://github.com/markdalgleish/bespoke-classes .bespoke-parent position: absolute top: 0 left: 0 right: 0 bottom: 0 .bespoke-scale-parent position: absolute top: 0 left: 0 right: 0 bottom: 0 .bespoke-slide width: 640px height: 480px position: absolute top: 50% left: 50% margin-left: -(@width / 2) margin-top: -(@height / 2) .bespoke-inactive display: none .bespoke-bullet-inactive display: none <% } %>
Increase project status badge padding
.project-details .title color #fff max-width 290px overflow-x hidden text-overflow ellipsis white-space nowrap .projectStatus padding: 1px 4px
.project-details .title color #fff max-width 290px overflow-x hidden text-overflow ellipsis white-space nowrap .projectStatus padding: 5px 7px
Fix button color sticking on IE
.meiosis, .meiosis-parent position: relative border: 1px solid lightgrey width: 300px height: 300px .cell width: 300px height: 304px .controls margin-top: 10px .buttons display: inline-block button width: 38px height: 38px padding: 5px .scrub width: 125px display: inline-block margin-left: 15px position: relative top: -4px .ui-slider-handle width: 6px margin-left: -3px
.meiosis, .meiosis-parent position: relative border: 1px solid lightgrey width: 300px height: 300px .cell width: 300px height: 304px .controls margin-top: 10px .buttons display: inline-block button width: 38px height: 38px padding: 5px &:hover // This is dumb, but it prevents the buttons from sticking in an active color on IE width: 38px .scrub width: 125px display: inline-block margin-left: 15px position: relative top: -4px .ui-slider-handle width: 6px margin-left: -3px
Improve layout for parameter summaries for model pages. PP-10
.y-model-view dock() padding 0 35px .y-tag font-size 11px text-transform uppercase display inline-block background y-color-yellow padding 3px 5px .y-title font-size 36px font-weight 300 .y-subtitle font-size 22px font-weight 300 .y-summary background #f5f5f5 padding 20px 0 .y-summary-item display inline-block padding 0 10px .y-summary-key text-transform uppercase font-size 11px color #888
.y-model-view dock() padding 0 35px .y-tag font-size 11px text-transform uppercase display inline-block background y-color-yellow padding 3px 5px .y-title font-size 36px font-weight 300 .y-subtitle font-size 22px font-weight 300 .y-summary background #f5f5f5 padding 5px 0 .y-summary-item display inline-block padding 10px .y-summary-key text-transform uppercase font-size 11px color #888
Move md-dialog on top of leaflet
yunity-orange = #f66c41; .splash height: 100% background-color: yunity-orange padding: 5em 0 .translucent-1 background-color: rgba(255, 255, 255, .1) // the main layout panel .main-panel padding: 16px margin-top: 1em .md-dialog-container > md-dialog width: 95% max-width: 40em .multiline white-space: pre; // styles for angular-xeditable md-input-container.editable-controls padding 0 width 100% md-input-container.editable-controls [ng-message] position static .editable-wrap width 100% .editable-click color inherit border-bottom none .editable-click:hover opacity 0.8 color inherit .footer opacity 0.6 text-align center .footer a opacity 0.8 text-decoration: none; font-weight: 500; .footer a:hover opacity 1.0
yunity-orange = #f66c41; .splash height: 100% background-color: yunity-orange padding: 5em 0 .translucent-1 background-color: rgba(255, 255, 255, .1) // the main layout panel .main-panel padding: 16px margin-top: 1em .md-dialog-container > md-dialog width: 95% max-width: 40em .multiline white-space: pre; // styles for angular-xeditable md-input-container.editable-controls padding 0 width 100% md-input-container.editable-controls [ng-message] position static .editable-wrap width 100% .editable-click color inherit border-bottom none .editable-click:hover opacity 0.8 color inherit .footer opacity 0.6 text-align center .footer a opacity 0.8 text-decoration: none; font-weight: 500; .footer a:hover opacity 1.0 // display md-dialog on top of leaflet md-backdrop.md-dialog-backdrop z-index 1010 !important .md-dialog-container z-index 1020 !important
Change tabs style to underlined
@import "nodeca.core/client/common/_variables" .btn + .btn margin-left .4rem .btn-square padding-left 0 !important padding-right 0 !important min-width 2.375em // 38px .btn-sm.btn-square min-width 2.0em // 28px .btn-xs.btn-square min-width 1.917em // 23px .dropdown-toggle.btn-square:after margin-left 0 .dropdown-toggle.icon:after border none width 0 margin 0 // Fix bottom margin when h1..h6 used .card-header margin-bottom 0 !important .form-group small display inline-block line-height 1.3em margin-top .5em
@import "nodeca.core/client/common/_variables" .btn + .btn margin-left .4rem .btn-square padding-left 0 !important padding-right 0 !important min-width 2.375em // 38px .btn-sm.btn-square min-width 2.0em // 28px .btn-xs.btn-square min-width 1.917em // 23px .dropdown-toggle.btn-square:after margin-left 0 .dropdown-toggle.icon:after border none width 0 margin 0 // Fix bottom margin when h1..h6 used .card-header margin-bottom 0 !important .form-group small display inline-block line-height 1.3em margin-top .5em .nav-tabs border-bottom unset !important .nav-link border none !important border-radius 0 !important padding .5em .5em !important border-bottom 3px solid transparent !important &.active border-bottom 3px solid $brand-primary !important .nav-item + .nav-item margin-left .7em !important
Remove NIB import - unused
@import 'nib' body color: #222 font-family: 'Droid Sans', sans-serif padding-bottom: 40px ul#url line-height: 36px font-size: 20px color: #222 span.divider padding: 2px; .getpost padding: 5px font-size: 12px margin-right: 10px .hero-unit background-color: #3A87AD border-top-left-radius: 0px; border-top-right-radius: 0px; color: white h1 color: inherit #credits .span11 { line-height: 60px; font-size: 20px; }
body color: #222 font-family: 'Droid Sans', sans-serif padding-bottom: 40px ul#url line-height: 36px font-size: 20px color: #222 span.divider padding: 2px; .getpost padding: 5px font-size: 12px margin-right: 10px .hero-unit background-color: #3A87AD border-top-left-radius: 0px; border-top-right-radius: 0px; color: white h1 color: inherit #credits .span11 { line-height: 60px; font-size: 20px; }
Add fix height to top line
* box-sizing: border-box html, body height: 100% body background: #F9F7F4 font-family: Arial, Helvetica, sans-serif cursor: default .app-container .app height: 100vh display: flex flex-direction: column align-items: center box-shadow: 0 2px 15px 0 rgba(0,0,0,0.2), 0 2px 10px 0 rgba(0, 0, 0, 0.12) background: url("../../images/main_background.jpg") background-size: cover position: relative .top display: flex align-items: center padding: 25px 0 .middle width: 100% position: relative .img-container img width: 100% height: 60vh opacity: 0.7 box-shadow: 0 10px 55px 5px rgba(0,0,0,0.27) mix-blend-mode: soft-light .show-box position: absolute top: 0 z-index: 1 width: 100% height: 100% display: flex align-items: center justify-content: center .bottom width: 100% flex: 1
* box-sizing: border-box html, body height: 100% body background: #F9F7F4 font-family: Arial, Helvetica, sans-serif cursor: default .app-container .app height: 100vh display: flex flex-direction: column align-items: center box-shadow: 0 2px 15px 0 rgba(0,0,0,0.2), 0 2px 10px 0 rgba(0, 0, 0, 0.12) background: url("../../images/main_background.jpg") background-size: cover position: relative .top display: flex align-items: center padding: 25px 0 max-height: 100px .middle width: 100% position: relative .img-container img width: 100% height: 60vh opacity: 0.7 box-shadow: 0 10px 55px 5px rgba(0,0,0,0.27) mix-blend-mode: soft-light .show-box position: absolute top: 0 z-index: 1 width: 100% height: 100% display: flex align-items: center justify-content: center .bottom width: 100% flex: 1
Align all headings in the center
html background-color: $hl color: $fg margin: 1em body background-color: $bg margin: 0 auto max-width: 23cm border: 1pt solid $comment padding: 1em code background-color: $hl padding: 2px a color: $yellow a:visited color: $orange a:hover color: $orange h1 color: $magenta h2,h3,h4,h5,h6 color: $green pre background-color: $bg color: $fg border: 1pt solid $comment padding: 1em box-shadow: 5pt 5pt 8pt $hl code background-color: @background-color h1 font-size: 2.8em h2 font-size: 2.4em h3 font-size: 1.8em h4 font-size: 1.4em h5 font-size: 1.3em h6 font-size: 1.15em table border: hidden border-color: $comment margin-left:auto; margin-right:auto; colgroup border: 1px solid $comment tr:nth-child(even) background-color: $hl
html background-color: $hl color: $fg margin: 1em body background-color: $bg margin: 0 auto max-width: 23cm border: 1pt solid $comment padding: 1em code background-color: $hl padding: 2px a color: $yellow a:visited color: $orange a:hover color: $orange h1 color: $magenta h2,h3,h4,h5,h6 color: $green text-align: center pre background-color: $bg color: $fg border: 1pt solid $comment padding: 1em box-shadow: 5pt 5pt 8pt $hl code background-color: @background-color h1 font-size: 2.8em h2 font-size: 2.4em h3 font-size: 1.8em h4 font-size: 1.4em h5 font-size: 1.3em h6 font-size: 1.15em table border: hidden border-color: $comment margin-left:auto; margin-right:auto; colgroup border: 1px solid $comment tr:nth-child(even) background-color: $hl
Refactor defaults values for gs
ks-grid-fixed-col-width = 60px ks-grid-fixed-gut-width = 20px ks-grid-fixed-columns = 12 ks-grid-fixed-computed-total-width = ( ks-grid-fixed-col-width + ks-grid-fixed-gut-width ) * ks-grid-fixed-columns ks-grid-fixed-total-width = ks-grid-fixed-computed-total-width // default to fixed layout ks-grid-config = { "column-width": ks-grid-fixed-col-width, "gutter-width": ks-grid-fixed-gut-width, "columns": ks-grid-fixed-columns, "computed-total-width": ks-grid-fixed-computed-total-width, "total-width": ks-grid-fixed-total-width } @import "grid" @import "row" @import "column" @import "offset"
ks-grid-fixed-col-width = 60px ks-grid-fixed-gut-width = 20px ks-grid-fixed-columns = 12 ks-grid-config = {} @import "grid" @import "row" @import "column" @import "offset" // default to fixed layout gs()
Make it a normal a selector
.BlogPost // Classes come through with Jekyll generated HTML // Not going to bother with correcting *that* // So for now, force things to look correct .post // > .post-header collapsed-margins(2em) > .post-category-title collapsed-margins(2em) > h1 margin 0 text-align center font-size font-size-h2 font-weight normal > .post-author > .post-meta text-align center font-size font-size-base line-height line-height-base > .post-author font-weight bold > .post-content // p collapsed-margins(1em) font-size font-size-base line-height line-height-tall > a, > strong a text-decoration underline img iframe display block max-width 100% vertical-align bottom border 1px solid colors-gray-border margin 2em auto iframe box-shadow 4px 4px 4px colors-gray-background height 2150px !important padding 1px +below(400px) height 2000px !important +below(380px) height 1950px !important +below(340px) height 1700px !important h2 collapsed-margins(4em) hr height 2px background-color colors-gray-border border none
.BlogPost // Classes come through with Jekyll generated HTML // Not going to bother with correcting *that* // So for now, force things to look correct .post // > .post-header collapsed-margins(2em) > .post-category-title collapsed-margins(2em) > h1 margin 0 text-align center font-size font-size-h2 font-weight normal > .post-author > .post-meta text-align center font-size font-size-base line-height line-height-base > .post-author font-weight bold > .post-content // p collapsed-margins(1em) font-size font-size-base line-height line-height-tall a text-decoration underline img iframe display block max-width 100% vertical-align bottom border 1px solid colors-gray-border margin 2em auto iframe box-shadow 4px 4px 4px colors-gray-background height 2150px !important padding 1px +below(400px) height 2000px !important +below(380px) height 1950px !important +below(340px) height 1700px !important h2 collapsed-margins(4em) hr height 2px background-color colors-gray-border border none
Add relative font url imports (not used atm atm).
// These will not work if docs are file://local @css { @import url('///fonts.googleapis.com/css?family=Inconsolata'); @import url('///fonts.googleapis.com/css?family=PT+Sans'); @import url('///fonts.googleapis.com/css?family=PT+Sans+Narrow:400,700'); }
Add `.filtered` styling for `table`s (in addition to `tr`s)
@import nib a cursor pointer a.disabled cursor none pointer-events none color #999 a.disabled:hover background-color transparent .link-spacer opacity 0.2 padding 0px 5px #top-level-nav visibility hidden html.light-theme, html.dark-theme #top-level-nav visibility visible .subtle opacity 0.5 .ellipsis overflow ellipsis .hard-wrap word-wrap break-word tr.filtered display none // Overrides #nav-user-name cursor default .btn-navbar:hover background-position initial transition none .navbar .btn-navbar:active box-shadow inset 0px 1px 3px rgba(0, 0, 0, 0.2) .navbar-fixed-top .brand transition none .navbar .nav > li > a padding 10px 10px 11px table th text-align left .well table margin-bottom 0px h2 margin-bottom 10px overflow ellipsis &.well-nav padding 8px 0 .modal position fixed top 20% margin-top 0px @media (max-width: 480px) .well h2 margin-top 0px .modal position fixed top 10px #page padding-bottom: 40px
@import nib a cursor pointer a.disabled cursor none pointer-events none color #999 a.disabled:hover background-color transparent .link-spacer opacity 0.2 padding 0px 5px #top-level-nav visibility hidden html.light-theme, html.dark-theme #top-level-nav visibility visible .subtle opacity 0.5 .ellipsis overflow ellipsis .hard-wrap word-wrap break-word tr.filtered display none table.filtered display none // Overrides #nav-user-name cursor default .btn-navbar:hover background-position initial transition none .navbar .btn-navbar:active box-shadow inset 0px 1px 3px rgba(0, 0, 0, 0.2) .navbar-fixed-top .brand transition none .navbar .nav > li > a padding 10px 10px 11px table th text-align left .well table margin-bottom 0px h2 margin-bottom 10px overflow ellipsis &.well-nav padding 8px 0 .modal position fixed top 20% margin-top 0px @media (max-width: 480px) .well h2 margin-top 0px .modal position fixed top 10px #page padding-bottom: 40px
Move page progress base styles here from forum
@import "nodeca.core/client/common/_variables" .page-progress padding 0 margin 0 .page-progress__item display inline-block vertical-align middle .page-progress__button-first .page-progress__button-last display block position relative padding 0 10px height 50px line-height 50px color grayDark &:hover text-decoration none .page-progress__info display block position relative font-size 12px padding 15px 0 height 50px color grayDark &:hover text-decoration none .page-progress__bar width 100% background-color grayLighter .page-progress__bar-fill background-color grayDark height 2px transition width .3s .page-progress__menu min-width 150px padding 7px 10px // // Highlight on hover // .page-progress__button-first .page-progress__button-last .page-progress__info &:after position absolute left 0 right 0 bottom 0 height 2px content '' background-color grayLighter opacity 0 transition opacity .3s .page-progress__item:hover .page-progress__button-first .page-progress__button-last .page-progress__info &:after opacity 1
Add flip and return animation for Luna_sprite
/*********************************\ Components / Luna Sprite \*********************************/ .c-luna-sprite__container position absolute left 0 width 100% .c-luna-sprite__sprite position absolute width 60px height 51px z-index Z-ANIMATIONS background url('images/luna-boot-scoot.png') 0 0 animation play-luna-boot-scoot 600ms steps(4) infinite, play-across-window 10s linear infinite @keyframes play-luna-boot-scoot 0% { background-position 0 0 } 100% { background-position -240px } @keyframes play-across-window 0% { right -60px } 100% { right calc(100% + 60px) }
/*********************************\ Components / Luna Sprite \*********************************/ .c-luna-sprite__container position absolute left 0 width 100% .c-luna-sprite__sprite position absolute width 60px height 51px z-index Z-ANIMATIONS background url('images/luna-boot-scoot.png') 0 0 animation play-luna-boot-scoot 600ms steps(4) infinite, play-across-window__small 20s linear infinite @keyframes play-luna-boot-scoot 0% { background-position 0 0 } 100% { background-position -240px } @keyframes play-across-window__small 0% { right -60px transform scaleX(1) } 50% { right calc(100% + 60px) transform scaleX(1) } 51% { transform scaleX(-1) } 100% { right -60px transform scaleX(-1) }
Add Commons SVG logo file
<?xml version="1.0" encoding="UTF-8"?> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="1024" height="1376" viewBox="-305 -516 610 820"> <title>Wikimedia Commons Logo</title> <defs> <clipPath id="c"><circle r="298"/></clipPath> </defs> <circle r="100" fill="#900"/> <g fill="#069"> <g id="arrow" clip-path="url(#c)"> <path d="m-11 180v118h22v-118"/> <path d="m-43 185l43-75 43 75"/> </g> <g id="arrows3"> <use xlink:href="#arrow" transform="rotate(45)"/> <use xlink:href="#arrow" transform="rotate(90)"/> <use xlink:href="#arrow" transform="rotate(135)"/> </g> <use xlink:href="#arrows3" transform="scale(-1 1)"/> <path id="blue_path" transform="rotate(-45)" stroke="#069" stroke-width="84" fill="none" d="M 0,-256 A 256 256 0 1 0 256,0 C 256,-100 155,-150 250,-275"/> <path id="arrow_top" d="m-23-515s-36 135-80 185 116-62 170-5-90-180-90-180z"/> </g> </svg>
Test showing problem on objectBoundingBox on text gradient. PR: Obtained from: Submitted by: Reviewed by:
<?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN" "http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd"> <!-- ========================================================================= --> <!-- Copyright (C) The Apache Software Foundation. All rights reserved. --> <!-- --> <!-- This software is published under the terms of the Apache Software License --> <!-- version 1.1, a copy of which has been included with this distribution in --> <!-- the LICENSE file. --> <!-- ========================================================================= --> <!-- ========================================================================= --> <!-- Test created after bug submitted by cjolif@ilog.fr showing a problem with --> <!-- radialGradient with objectBoundingBox on a text element. --> <!-- @author vhardy@apache.org --> <!-- @version $Id$ --> <!-- ========================================================================= --> <?xml-stylesheet type="text/css" href="test.css" ?> <svg id="body" width="450" height="500" viewBox="0 0 450 500"> <title>ObjectBounding box on TextNode</title> <defs> <radialGradient id="gradient" gradientUnits="objectBoundingBox" cx="0.4953271150588989" cy="0.4933333396911621" fx="0.5" fy="0.5" r="0.6560132"> <stop offset="0.0" style="stop-color:blue" /> <stop offset="0.57697475" style="stop-color:blue" /> <stop offset="1.0" style="stop-color:#ff0033" /> </radialGradient> </defs> <text x="50%" y="100" text-anchor="middle" font-size="30" font-family="Verdana" fill="url(#gradient)"> ObjectBoudingBox </text> <!-- ============================================================= --> <!-- Batik sample mark --> <!-- ============================================================= --> <use xlink:href="../batikLogo.svg#Batik_Tag_Box" /> </svg>
Set default test for Vidualize
<?xml version="1.0"?> <svg xmlns="http://www.w3.org/2000/svg" version="1.2" baseProfile="tiny" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>Bender</title> <script xlink:href="flexo.js"/> <script xlink:href="bender.js"/> <script xlink:href="lib.js"/> <g id="dest-body"/> <script><![CDATA[ var args = bender.get_args("app=core/tests/hello-svg&debug=1"); if (args.app) { bender.init_app(args.path + args.app + args.suffix, args, function(app) { if (args.debug) { $APP = app; flexo.log("Bender/SVG app started OK"); } }); } else { alert("Error: No app to show; missing app parameter."); } window.onerror = function(msg) { alert("Error: {0}".fmt(msg)); }; ]]></script> </svg>
<?xml version="1.0"?> <svg xmlns="http://www.w3.org/2000/svg" version="1.2" baseProfile="tiny" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>Bender</title> <script xlink:href="flexo.js"/> <script xlink:href="bender.js"/> <script xlink:href="lib.js"/> <g id="dest-body"/> <script><![CDATA[ var args = bender.get_args("app=core/tests/svg-button&debug=1"); if (args.app) { bender.init_app(args.path + args.app + args.suffix, args, function(app) { if (args.debug) { $APP = app; flexo.log("Bender/SVG app started OK"); } }); } else { alert("Error: No app to show; missing app parameter."); } window.onerror = function(msg) { alert("Error: {0}".fmt(msg)); }; ]]></script> </svg>
Add icon image for a load button
<svg width="1792" height="1792" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1596 380q28 28 48 76t20 88v1152q0 40-28 68t-68 28h-1344q-40 0-68-28t-28-68v-1600q0-40 28-68t68-28h896q40 0 88 20t76 48zm-444-244v376h376q-10-29-22-41l-313-313q-12-12-41-22zm384 1528v-1024h-416q-40 0-68-28t-28-68v-416h-768v1536h1280z" fill="#333"/></svg>
Complete template part part-performance. Include the template part in the front page with php.
<?xml version="1.0" encoding="utf-8"?> <!-- Generator: Avocode 2.6.0 - http://avocode.com --> <svg height="110" width="110" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 110 110"> <path fill="#f6f8f9" fill-rule="evenodd" d="M 55 0 C 85.38 0 110 24.62 110 55 C 110 85.38 85.38 110 55 110 C 24.62 110 0 85.38 0 55 C 0 24.62 24.62 0 55 0 Z" /> </svg>
Fix icon using correct XML namespace
<?xml version="1.0"?> <svg height="64" width="64"> <path filter="url(#a)" stroke="#fff" stroke-width="2" d="m12.95 11.536-1.414 1.414-3.536-3.5358-3.5355 3.5358-1.4142-1.414 3.5355-3.536-3.5355-3.5356 1.4142-1.4142 3.5355 3.5356 3.516-3.5547 1.434 1.4333-3.5357 3.5356z" fill="#fff"/> <path d="m12.95 11.536-1.414 1.414-3.536-3.5358-3.5355 3.5358-1.4142-1.414 3.5355-3.536-3.5355-3.5356 1.4142-1.4142 3.5355 3.5356 3.516-3.5547 1.434 1.4333-3.5357 3.5356z"/> </svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns="http://www.w3.org/2000/svg" height="16" width="16"> <path d="m12.95 11.536-1.414 1.414-3.536-3.5358-3.5355 3.5358-1.4142-1.414 3.5355-3.536-3.5355-3.5356 1.4142-1.4142 3.5355 3.5356 3.516-3.5547 1.434 1.4333-3.5357 3.5356z"/> <path d="m12.95 11.536-1.414 1.414-3.536-3.5358-3.5355 3.5358-1.4142-1.414 3.5355-3.536-3.5355-3.5356 1.4142-1.4142 3.5355 3.5356 3.516-3.5547 1.434 1.4333-3.5357 3.5356z"/> </svg>
Replace North Frisian flag with SVG equivalent
<?xml version="1.0"?> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="30" height="20"><image xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAUBAMAAABohZD3AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAVUExURRwt//8AAP/QAP/YABIu/14ftP+TAJf9yMoAAAAkSURBVBjTY1BCBQyU8o1RAUMaKmAQRAVU54eiAgYXVMBAZQAAyNch36s/YkYAAAAASUVORK5CYII=" width="30" height="20"/></svg>
<?xml version="1.0"?><svg xmlns="http://www.w3.org/2000/svg" width="100" height="60"><rect width="100" height="60" fill="#1c2dff"/><rect width="100" height="40" fill="#f00"/><rect width="100" height="20" fill="#ffd000"/></svg>
Remove redundant <path> in Bitbucket svg
<svg aria-labelledby="simpleicons-bitbucket-icon" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title id="simpleicons-bitbucket-icon">Bitbucket icon</title><path d="M.778 1.211c-.424-.006-.772.334-.778.758 0 .045.002.09.01.134l3.263 19.811c.084.499.515.867 1.022.872H19.95c.382.004.708-.271.77-.646l3.27-20.03c.068-.418-.216-.813-.635-.881-.045-.008-.089-.011-.133-.01L.778 1.211zM14.52 15.528H9.522L8.17 8.464h7.561l-1.211 7.064z"/><path d="M22.944 8.464H15.73l-1.211 7.064H9.522l-5.899 7.007c.187.162.424.252.672.254h15.66c.38.005.708-.27.769-.646l2.22-13.679z"/></g></svg>
<svg aria-labelledby="simpleicons-bitbucket-icon" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title id="simpleicons-bitbucket-icon">Bitbucket icon</title><path d="M.778 1.211c-.424-.006-.772.334-.778.758 0 .045.002.09.01.134l3.263 19.811c.084.499.515.867 1.022.872H19.95c.382.004.708-.271.77-.646l3.27-20.03c.068-.418-.216-.813-.635-.881-.045-.008-.089-.011-.133-.01L.778 1.211zM14.52 15.528H9.522L8.17 8.464h7.561l-1.211 7.064z"/></g></svg>
Update href svg test case to include viewBox.
<svg class="marks" width="400" height="200" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><clipPath id="clip1"><rect x="0" y="0" width="400" height="200"></rect></clipPath></defs><g transform="translate(0,0)"><g class="mark-group"><g transform="translate(0,0)" clip-path="url(#clip1)"><path class="background" d="M0,0h400v200h-400Z" style="pointer-events: none; fill: none;"></path><g class="mark-rect"><a xlink:href="./test/resources/image0.png"><path d="M0,144h99v56h-99Z" style="fill: steelblue;"></path></a><a xlink:href="./test/resources/image1.png"><path d="M100,90h99v110h-99Z" style="fill: steelblue;"></path></a><a xlink:href="./test/resources/image2.png"><path d="M200,114h99v86h-99Z" style="fill: steelblue;"></path></a><path d="M300,18h99v182h-99Z" style="fill: steelblue;"></path></g></g></g></g></svg>
<svg class="marks" width="400" height="200" viewBox="0 0 400 200" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><clipPath id="clip1"><rect x="0" y="0" width="400" height="200"></rect></clipPath></defs><g transform="translate(0,0)"><g class="mark-group"><g transform="translate(0,0)" clip-path="url(#clip1)"><path class="background" d="M0,0h400v200h-400Z" style="pointer-events: none; fill: none;"></path><g class="mark-rect"><a xlink:href="./test/resources/image0.png"><path d="M0,144h99v56h-99Z" style="fill: steelblue;"></path></a><a xlink:href="./test/resources/image1.png"><path d="M100,90h99v110h-99Z" style="fill: steelblue;"></path></a><a xlink:href="./test/resources/image2.png"><path d="M200,114h99v86h-99Z" style="fill: steelblue;"></path></a><path d="M300,18h99v182h-99Z" style="fill: steelblue;"></path></g></g></g></g></svg>
Add icon image for hiding port of the module
<svg width="1792" height="1792" viewBox="-896 -896 3584 3584" xmlns="http://www.w3.org/2000/svg"><path d="M1344 800v64q0 14-9 23t-23 9h-832q-14 0-23-9t-9-23v-64q0-14 9-23t23-9h832q14 0 23 9t9 23zm128 448v-832q0-66-47-113t-113-47h-832q-66 0-113 47t-47 113v832q0 66 47 113t113 47h832q66 0 113-47t47-113zm128-832v832q0 119-84.5 203.5t-203.5 84.5h-832q-119 0-203.5-84.5t-84.5-203.5v-832q0-119 84.5-203.5t203.5-84.5h832q119 0 203.5 84.5t84.5 203.5z" fill="#333"/></svg>
Add some permitted and not permitted elements to the unknown element test
<svg xmlns="http://www.w3.org/2000/svg"> <metadata> <sfw> <slices></slices> <sliceSourceBounds height="67.3" width="85.9" y="-40.8" x="-42.5" bottomLeftOrigin="true"></sliceSourceBounds> </sfw> </metadata> </svg> @@@ <svg xmlns="http://www.w3.org/2000/svg"> <metadata> <sfw> <slices/> <sliceSourceBounds height="67.3" width="85.9" y="-40.8" x="-42.5" bottomLeftOrigin="true"/> </sfw> </metadata> </svg>
<svg xmlns="http://www.w3.org/2000/svg"> <metadata> <sfw> <slices></slices> <sliceSourceBounds height="67.3" width="85.9" y="-40.8" x="-42.5" bottomLeftOrigin="true"></sliceSourceBounds> </sfw> <ellipse/> </metadata> <ellipse> <font-face/> </ellipse> </svg> @@@ <svg xmlns="http://www.w3.org/2000/svg"> <metadata> <ellipse/> </metadata> <ellipse/> </svg>
Add an SVG snippet for a 3-point circle
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="64px" height="64px" viewBox="0 0 64 64"> <path stroke="#000" fill="#fff" d="M48,32c0-12.2711449-13.3754692-19.9822502-24.0180588-13.8466778S13.3393545,39.7111092,23.981945,45.8466797S48,44.2711449,48,32z"/> </svg>
Make svg a sensible width
<svg version="1.1" width="75%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="1700.79px" height="11px" viewBox="0 0 1700.79 11" enable-background="new 0 0 1700.79 11" xml:space="preserve"> <rect y="0" fill="none" width="1700.79" height="11"/> </svg>
<svg version="1.1" width="75%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="100px" height="11px" viewBox="0 0 100 11" enable-background="new 0 0 100 11" xml:space="preserve"> <rect y="0" fill="none" width="100" height="11"/> </svg>
Add svg logo to project
<?xml version="1.0" encoding="utf-8"?> <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve"> <path fill="#333333" d="M25.001,0c-13.808,0-25,11.193-25,25c0,13.807,11.192,25,25,25S50,38.807,50,25C50,11.193,38.809,0,25.001,0 z M32.734,23.765l-5.857,12.704l-0.004-0.002C26.703,36.783,26.377,37,25.999,37c-0.551,0-0.998-0.451-0.998-1.008v-6.926H18.84 c-1.015,0-1.839-0.832-1.839-1.857c0-0.356,0.104-0.686,0.275-0.967l-0.009-0.008l5.856-12.703l0.005,0.003 C23.298,13.218,23.625,13,24.004,13c0.552,0,0.997,0.451,0.997,1.007v6.926h6.161c1.016,0,1.838,0.833,1.838,1.859 c0,0.355-0.104,0.685-0.275,0.967L32.734,23.765z"/> </svg>
Add the French Flag as SVG image.
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="1200" height="600"> <rect width="1200" height="600" fill="#ED2939"/> <rect width="800" height="600" fill="#FFF"/> <rect width="400" height="600" fill="#002395"/> </svg>
Disable IRGen test case that tests vectorization of arrays to unblock a bot
// RUN: %target-swift-frontend -assume-parsing-unqualified-ownership-sil -Ounchecked %s -emit-ir | %FileCheck %s // REQUIRES: CPU=x86_64 // FIXME: https://bugs.swift.org/browse/SR-2808 // XFAIL: resilient_stdlib // We were missing target transform info and not vectorizing the loop below. // CHECK: xor <2 x i64> public func f(a: UnsafePointer<Int>, b: UnsafePointer<Int>, count: Int) -> Int { var c = 0 for i in 0..<count { c = a[i] ^ b[i] ^ c } return c }
// RUN: %target-swift-frontend -assume-parsing-unqualified-ownership-sil -Ounchecked %s -emit-ir | %FileCheck %s // REQUIRES: CPU=x86_64 // rdar://30579970 // REQUIRES: optimized_stdlib // FIXME: https://bugs.swift.org/browse/SR-2808 // XFAIL: resilient_stdlib // We were missing target transform info and not vectorizing the loop below. // CHECK: xor <2 x i64> public func f(a: UnsafePointer<Int>, b: UnsafePointer<Int>, count: Int) -> Int { var c = 0 for i in 0..<count { c = a[i] ^ b[i] ^ c } return c }
Fix to reflect the value of isSelected in button value
// // ButtonStyleSelectableBase.swift // ButtonStyleKit // // Created by keygx on 2016/08/04. // Copyright © 2016年 keygx. All rights reserved. // import UIKit open class ButtonStyleSelectableBase: ButtonStyleKit { override public final var isEnabled: Bool { set { if newValue { currentState = .normal } else { currentState = .disabled } } get { return super.isEnabled } } override public final var isSelected: Bool { set { if newValue { currentState = .selected } else { currentState = .normal } } get { return super.isSelected } } public final var value: Bool = false { didSet { currentState = { if value { return .selected } else { return .normal } }() } } }
// // ButtonStyleSelectableBase.swift // ButtonStyleKit // // Created by keygx on 2016/08/04. // Copyright © 2016年 keygx. All rights reserved. // import UIKit open class ButtonStyleSelectableBase: ButtonStyleKit { override public final var isEnabled: Bool { set { if newValue { currentState = .normal } else { currentState = .disabled } } get { return super.isEnabled } } override public final var isSelected: Bool { set { if newValue { value = true } else { value = false } } get { return super.isSelected } } public final var value: Bool = false { didSet { currentState = { if value { return .selected } else { return .normal } }() } } }
Fix swift 2.2 in standalone project
// // ViewController.swift // KonamiCode // // Created by Sebastien Morel on 10/17/14. // Copyright (c) 2014 Plopix. All rights reserved. // import UIKit class ViewController: UIViewController { @IBOutlet var stateLabel : UILabel!; override func viewDidLoad() { super.viewDidLoad() let recognizer = PlopixKonamiGesture(target: self, action: "launchEasterEgg:") view.addGestureRecognizer(recognizer) } func launchEasterEgg(recognizer: UIGestureRecognizer) { if ( recognizer.state == .Ended ) { stateLabel.text = "Yeah you did it!" } if ( recognizer.state == .Failed || recognizer.state == .Cancelled ) { stateLabel.text = "Try again!" } } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } }
// // ViewController.swift // KonamiCode // // Created by Sebastien Morel on 10/17/14. // Copyright (c) 2014 Plopix. All rights reserved. // import UIKit class ViewController: UIViewController { @IBOutlet var stateLabel : UILabel!; override func viewDidLoad() { super.viewDidLoad() let recognizer = PlopixKonamiGesture(target: self, action: #selector(ViewController.launchEasterEgg(_:))) view.addGestureRecognizer(recognizer) } func launchEasterEgg(recognizer: UIGestureRecognizer) { if ( recognizer.state == .Ended ) { stateLabel.text = "Yeah you did it!" } if ( recognizer.state == .Failed || recognizer.state == .Cancelled ) { stateLabel.text = "Try again!" } } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } }
Replace open func to public func
// // QueueController.swift // AbstractPlayer // // Created by 林達也 on 2016/09/28. // Copyright © 2016年 jp.sora0077. All rights reserved. // import Foundation import AVKit import AVFoundation import RxSwift public final class QueueController<Response> { private var workerQueue: WorkerQueue<Response>! private var queueCondition: Bool { return queueingCount <= bufferSize } private let bufferSize: Int private var queueingCount: Int = 0 { didSet { if queueCondition { workerQueue.run() } } } private let disposeBag = DisposeBag() public init(bufferSize: Int = 3, queueingCount: Observable<Int>, call: @escaping (Response) -> Void) { self.bufferSize = bufferSize workerQueue = WorkerQueue { [weak self] item in guard let item = item else { return true } call(item) return self?.queueCondition ?? true } queueingCount.distinctUntilChanged() .subscribe(onNext: { [weak self] count in self?.queueingCount = count }) .addDisposableTo(disposeBag) } open func add<W: Worker>(_ worker: W, priority: Priority = .default) where W.Response == Response { workerQueue.add(worker, priority: priority) } }
// // QueueController.swift // AbstractPlayer // // Created by 林達也 on 2016/09/28. // Copyright © 2016年 jp.sora0077. All rights reserved. // import Foundation import AVKit import AVFoundation import RxSwift public final class QueueController<Response> { private var workerQueue: WorkerQueue<Response>! private var queueCondition: Bool { return queueingCount <= bufferSize } private let bufferSize: Int private var queueingCount: Int = 0 { didSet { if queueCondition { workerQueue.run() } } } private let disposeBag = DisposeBag() public init(bufferSize: Int = 3, queueingCount: Observable<Int>, call: @escaping (Response) -> Void) { self.bufferSize = bufferSize workerQueue = WorkerQueue { [weak self] item in guard let item = item else { return true } call(item) return self?.queueCondition ?? true } queueingCount.distinctUntilChanged() .subscribe(onNext: { [weak self] count in self?.queueingCount = count }) .addDisposableTo(disposeBag) } public func add<W: Worker>(_ worker: W, priority: Priority = .default) where W.Response == Response { workerQueue.add(worker, priority: priority) } }
Update test for Windows path
extension (Int, Int) {} // RUN: %sourcekitd-test -req=sema %s -- -Xfrontend -enable-descriptive-diagnostics -Xfrontend -diagnostic-documentation-path -Xfrontend /educational/notes/path/prefix %s | %FileCheck %s -check-prefix=DESCRIPTIVE // DESCRIPTIVE: key.description: "non-nominal type // DESCRIPTIVE: key.educational_note_paths: [ // DESCRIPTIVE-NEXT: "/educational/notes/path/prefix/nominal-types.md" // DESCRIPTIVE-NEXT: ] // RUN: %sourcekitd-test -req=sema %s -- %s | %FileCheck %s -check-prefix=DESCRIPTIVE-DISABLED // DESCRIPTIVE-DISABLED: key.description: "non-nominal type // DESCRIPTIVE-DISABLED-NOT: key.educational_note_paths
extension (Int, Int) {} // RUN: %sourcekitd-test -req=sema %s -- -Xfrontend -enable-descriptive-diagnostics -Xfrontend -diagnostic-documentation-path -Xfrontend /educational/notes/path/prefix %s | %FileCheck %s -check-prefix=DESCRIPTIVE // DESCRIPTIVE: key.description: "non-nominal type // DESCRIPTIVE: key.educational_note_paths: [ // DESCRIPTIVE-NEXT: "{{/|\\}}educational{{/|\\}}notes{{/|\\}}path{{/|\\}}prefix{{/|\\}}nominal-types.md" // DESCRIPTIVE-NEXT: ] // RUN: %sourcekitd-test -req=sema %s -- %s | %FileCheck %s -check-prefix=DESCRIPTIVE-DISABLED // DESCRIPTIVE-DISABLED: key.description: "non-nominal type // DESCRIPTIVE-DISABLED-NOT: key.educational_note_paths
Add test case for `Pair`
// // PairSpec.swift // SwiftyEcharts // // Created by Pluto Y on 15/02/2017. // Copyright © 2017 com.pluto-y. All rights reserved. // import Quick import Nimble import SwiftyEcharts class PairSpec : QuickSpec { override func spec() { describe("Testing for type named 'SECTwoElement'") { it(" needs to check constructor and jsonString ") { let noArgElements = Pair<LengthValue>() expect(noArgElements.jsonString).to(equal("null")) let percentValue: Float = 3 let floatValue: Float = 2.1 let twoElements: Pair<LengthValue> = [floatValue, percentValue%] expect(twoElements.jsonString).to(equal([floatValue, percentValue%].jsonString)) let toMuchElements: Pair<LengthValue> = [3, 4, 5, 6%] expect(toMuchElements.jsonString).to(equal("null")) // 如果不是 LengthValue 的话,就会产生编译错误 // let errorType: Pair = ["hello", 4] } } } }
// // PairSpec.swift // SwiftyEcharts // // Created by Pluto Y on 15/02/2017. // Copyright © 2017 com.pluto-y. All rights reserved. // import Quick import Nimble import SwiftyEcharts class PairSpec : QuickSpec { override func spec() { describe("Testing for type named 'SECTwoElement'") { it(" needs to check constructor and jsonString ") { let errorJsonString = "null" let noArgElements = Pair<LengthValue>() expect(noArgElements.jsonString).to(equal(errorJsonString)) let percentValue: Float = 3 let floatValue: Float = 2.1 let twoElements: Pair<LengthValue> = [floatValue, percentValue%] expect(twoElements.jsonString).to(equal([floatValue, percentValue%].jsonString)) let toMuchElements: Pair<LengthValue> = [3, 4, 5, 6%] expect(toMuchElements.jsonString).to(equal(errorJsonString)) let errorElements = Pair([floatValue]) expect(errorElements.jsonString).to(equal(errorJsonString)) // 如果不是 LengthValue 的话,就会产生编译错误 // let errorType: Pair = ["hello", 4] } } } }
Exclude userId and userToken from post params
// // Copyright © 2019 Ingresse. All rights reserved. // extension Request { public struct UpdateUser: Encodable { public struct BasicInfos: Encodable { public var userId: String = "" public var userToken: String = "" public var name: String? public var lastname: String? public var email: String? public var phone: String? public var cpf: String? public init() {} } public struct BillingInfos: Encodable { public var userId: String = "" public var userToken: String = "" public var zip: String = "" public var street: String = "" public var number: String = "" public var complement: String = "" public var district: String = "" public var city: String = "" public var state: String = "" public init() {} } } }
// // Copyright © 2019 Ingresse. All rights reserved. // extension Request { public struct UpdateUser: Encodable { public struct BasicInfos: Encodable { public var userId: String = "" public var userToken: String = "" public var name: String? public var lastname: String? public var email: String? public var phone: String? public var cpf: String? public init() {} private enum CodingKeys: String, CodingKey { case name case lastname case email case phone case cpf } } public struct BillingInfos: Encodable { public var userId: String = "" public var userToken: String = "" public var zip: String = "" public var street: String = "" public var number: String = "" public var complement: String = "" public var district: String = "" public var city: String = "" public var state: String = "" public init() {} private enum CodingKeys: String, CodingKey { case zip case street case number case complement case district case city case state } } } }
Remove items that aren't supported by the version of iOS.
// // Copyright (c) 2015 Itty Bitty Apps. All rights reserved. // import Foundation private enum Attributes: String { case Title = "title" case Rows = "rows" } struct CollectableGroup<I: Collectable>: Collection { typealias T = I let items: [I] let title: String? init(dictionary: [String: AnyObject]) { guard let rowsData = dictionary[Attributes.Rows.rawValue] as? [[String: AnyObject]] else { fatalError("Unable to deserialize Group rows") } self.title = dictionary[Attributes.Title.rawValue] as? String self.items = rowsData.map { I(dictionary: $0) } } }
// // Copyright (c) 2015 Itty Bitty Apps. All rights reserved. // import Foundation private enum Attributes: String { case Title = "title" case Rows = "rows" } struct CollectableGroup<I: Collectable>: Collection { typealias T = I let items: [I] let title: String? init(dictionary: [String: AnyObject]) { guard let rowsData = dictionary[Attributes.Rows.rawValue] as? [[String: AnyObject]] else { fatalError("Unable to deserialize Group rows") } self.title = dictionary[Attributes.Title.rawValue] as? String let unfilteredItems = rowsData.map { I(dictionary: $0) } self.items = unfilteredItems.filter { (element) -> Bool in if let requiredClassName = element.requiredClassName { return nil != NSClassFromString(requiredClassName) } return true } } }
Remove the default value for the index parameter in `fold`.
// Copyright © 2015 Rob Rix. All rights reserved. public enum Telescope { indirect case Recursive(Telescope) indirect case Argument(Term, Telescope) case End public func fold(recur: Term, terminal: Term, index: Int = 0, combine: (Term, Term) -> Term) -> Term { switch self { case .End: return terminal case let .Recursive(rest): return combine(recur, rest.fold(recur, terminal: terminal, index: index + 1, combine: combine)) case let .Argument(type, rest): return (Name.Local(index), type) => rest.fold(recur, terminal: terminal, index: index + 1, combine: combine) } } }
// Copyright © 2015 Rob Rix. All rights reserved. public enum Telescope { indirect case Recursive(Telescope) indirect case Argument(Term, Telescope) case End public func fold(recur: Term, terminal: Term, index: Int, combine: (Term, Term) -> Term) -> Term { switch self { case .End: return terminal case let .Recursive(rest): return combine(recur, rest.fold(recur, terminal: terminal, index: index + 1, combine: combine)) case let .Argument(type, rest): return (Name.Local(index), type) => rest.fold(recur, terminal: terminal, index: index + 1, combine: combine) } } }
Refactor URLPredicate tests and fix typo
import XCTest import Peppermint class URLPredicateTests: XCTestCase { var predicate: URLPredicate! override func setUp() { super.setUp() predicate = URLPredicate() } override func tearDown() { predicate = nil super.tearDown() } func testThatItEvaluatesValuidURLToTrue() { let result = predicate.evaluate(with: "http://www.url.com") XCTAssertTrue(result) } func testThatItEvaluatesInvaluidURLToFalse() { let result = predicate.evaluate(with: "http:\\www.url.com") XCTAssertFalse(result) } } extension URLPredicateTests { func testDynamicLookupExtension() { let sut: URLPredicate = .url let result = sut.evaluate(with: "http://www.url.com") XCTAssertTrue(result) } }
import XCTest import Peppermint class URLPredicateTests: XCTestCase { func testThatItEvaluatesValidURLToTrue() { let sut = URLPredicate() let result = sut.evaluate(with: "http://www.url.com") XCTAssertTrue(result) } func testThatItEvaluatesInvalidURLToFalse() { let sut = URLPredicate() let result = sut.evaluate(with: "http:\\www.url.com") XCTAssertFalse(result) } } extension URLPredicateTests { func testDynamicLookupExtension() { let sut: URLPredicate = .url let result = sut.evaluate(with: "http://www.url.com") XCTAssertTrue(result) } }
Format multiple minutes using relative formatter
// // RelativeTimeFormatterTests.swift // Peekazoo // // Created by Thomas Sherwood on 23/05/2017. // Copyright © 2017 Peekazoo. All rights reserved. // import Peekazoo import XCTest struct RelativeTimeFormatter: TimeFormatter { func string(from date: Date) -> String { let now = Date() if now.timeIntervalSince(date) > 60 { return "1 minute ago" } else { return "Just now" } } } class RelativeTimeFormatterTests: XCTestCase { func testRequestingTimeWithinOneMinuteReturnsJustNow() { let formatter = RelativeTimeFormatter() let withinOneMinute = Date(timeIntervalSinceNow: -59) let formattedString = formatter.string(from: withinOneMinute) XCTAssertEqual("Just now", formattedString) } func testRequestingTimeWithinTwoMinutesReturnOneMinuteAgo() { let formatter = RelativeTimeFormatter() let withinTwoMinutes = Date(timeIntervalSinceNow: -119) let formattedString = formatter.string(from: withinTwoMinutes) XCTAssertEqual("1 minute ago", formattedString) } }
// // RelativeTimeFormatterTests.swift // Peekazoo // // Created by Thomas Sherwood on 23/05/2017. // Copyright © 2017 Peekazoo. All rights reserved. // import Peekazoo import XCTest struct RelativeTimeFormatter: TimeFormatter { func string(from date: Date) -> String { let now = Date() let distance = now.timeIntervalSince(date) if distance > 60 { if distance > 120 { return "2 minutes ago" } else { return "1 minute ago" } } else { return "Just now" } } } class RelativeTimeFormatterTests: XCTestCase { func testRequestingTimeWithinOneMinuteReturnsJustNow() { let formatter = RelativeTimeFormatter() let withinOneMinute = Date(timeIntervalSinceNow: -59) let formattedString = formatter.string(from: withinOneMinute) XCTAssertEqual("Just now", formattedString) } func testRequestingTimeWithinTwoMinutesReturnOneMinuteAgo() { let formatter = RelativeTimeFormatter() let withinTwoMinutes = Date(timeIntervalSinceNow: -119) let formattedString = formatter.string(from: withinTwoMinutes) XCTAssertEqual("1 minute ago", formattedString) } func testRequestingTimeTwoMinutesAgoReturnsTwoMinutes() { let formatter = RelativeTimeFormatter() let twoMinutesAgo = Date(timeIntervalSinceNow: -120) let formattedString = formatter.string(from: twoMinutesAgo) XCTAssertEqual("2 minutes ago", formattedString) } }
Call willMove before removing from parent vc
import UIKit extension UIViewController { // Adds a peekable view controller on top of another view controller. Since the view controller is the one we want to show when the user peeks through, we're saving time by loading it behind the peekable view controller. @objc func wmf_setupPeekable(_ peekableViewController: UIViewController, on viewController: UIViewController) -> UIViewController { viewController.addChildViewController(peekableViewController) viewController.view.wmf_addSubviewWithConstraintsToEdges(peekableViewController.view) peekableViewController.didMove(toParentViewController: viewController) return viewController } @objc func wmf_removePeekable(_ peekableViewController: UIViewController) { peekableViewController.view.removeFromSuperview() peekableViewController.removeFromParentViewController() } }
import UIKit extension UIViewController { // Adds a peekable view controller on top of another view controller. Since the view controller is the one we want to show when the user peeks through, we're saving time by loading it behind the peekable view controller. @objc func wmf_setupPeekable(_ peekableViewController: UIViewController, on viewController: UIViewController) -> UIViewController { viewController.addChildViewController(peekableViewController) viewController.view.wmf_addSubviewWithConstraintsToEdges(peekableViewController.view) peekableViewController.didMove(toParentViewController: viewController) return viewController } @objc func wmf_removePeekable(_ peekableViewController: UIViewController) { peekableViewController.view.removeFromSuperview() peekableViewController.willMove(toParentViewController: peekableViewController.parent) peekableViewController.removeFromParentViewController() } }
Remove NSAttributedString height(considering) extention method
/* MIT License Copyright (c) 2017-2018 MessageKit Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ import Foundation extension NSAttributedString { internal func height(considering width: CGFloat) -> CGFloat { let constraintBox = CGSize(width: width, height: .greatestFiniteMagnitude) let rect = self.boundingRect(with: constraintBox, options: [.usesLineFragmentOrigin, .usesFontLeading], context: nil) return rect.height } internal func width(considering height: CGFloat) -> CGFloat { let constraintBox = CGSize(width: .greatestFiniteMagnitude, height: height) let rect = self.boundingRect(with: constraintBox, options: [.usesLineFragmentOrigin, .usesFontLeading], context: nil) return rect.width } }
/* MIT License Copyright (c) 2017-2018 MessageKit Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ import Foundation extension NSAttributedString { internal func width(considering height: CGFloat) -> CGFloat { let constraintBox = CGSize(width: .greatestFiniteMagnitude, height: height) let rect = self.boundingRect(with: constraintBox, options: [.usesLineFragmentOrigin, .usesFontLeading], context: nil) return rect.width } }
Drop expected-* annotations from test; it's too messy to -verify. NFC
// Distributed under the terms of the MIT license // Test case submitted to project by https://github.com/practicalswift (practicalswift) // Test case found by fuzzing // RUN: not %swift %s -parse struct c<e> { let d: [( h // expected-note 4{{to match this opening}} // expected-note @-1{{undeclared type}} } func b(g: f) -> <e>(()-> e) -> i
// Distributed under the terms of the MIT license // Test case submitted to project by https://github.com/practicalswift (practicalswift) // Test case found by fuzzing // RUN: not %swift %s -parse struct c<e> { let d: [( h } func b(g: f) -> <e>(()-> e) -> i
Set json init with string public
// // JSON+String.swift // // // Created by Vladislav Fitc on 13.03.2020. // import Foundation extension JSON { init(jsonString: String) throws { let data = jsonString.data(using: .utf8)! let decoder = JSONDecoder() self = try decoder.decode(JSON.self, from: data) } }
// // JSON+String.swift // // // Created by Vladislav Fitc on 13.03.2020. // import Foundation public extension JSON { init(jsonString: String) throws { let data = jsonString.data(using: .utf8)! let decoder = JSONDecoder() self = try decoder.decode(JSON.self, from: data) } }
Add missing import required to use a conformance
//===--- Error.swift ------------------------------------------*- swift -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2020 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// import ComplexModule public func relativeError(_ tst: Float, _ ref: Double) -> Double { let scale = max(ref.magnitude, Double(Float.leastNormalMagnitude)) let error = (Double(tst) - ref).magnitude return error / scale } public func componentwiseError(_ tst: Complex<Float>, _ ref: Complex<Double>) -> Double { return max(relativeError(tst.real, ref.real), relativeError(tst.imaginary, ref.imaginary)) } public func relativeError(_ tst: Complex<Float>, _ ref: Complex<Double>) -> Double { let scale = max(ref.magnitude, Double(Float.leastNormalMagnitude)) let dtst = Complex(Double(tst.real), Double(tst.imaginary)) let error = (dtst - ref).magnitude return error / scale }
//===--- Error.swift ------------------------------------------*- swift -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2020 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// import ComplexModule import RealModule public func relativeError(_ tst: Float, _ ref: Double) -> Double { let scale = max(ref.magnitude, Double(Float.leastNormalMagnitude)) let error = (Double(tst) - ref).magnitude return error / scale } public func componentwiseError(_ tst: Complex<Float>, _ ref: Complex<Double>) -> Double { return max(relativeError(tst.real, ref.real), relativeError(tst.imaginary, ref.imaginary)) } public func relativeError(_ tst: Complex<Float>, _ ref: Complex<Double>) -> Double { let scale = max(ref.magnitude, Double(Float.leastNormalMagnitude)) let dtst = Complex(Double(tst.real), Double(tst.imaginary)) let error = (dtst - ref).magnitude return error / scale }
Remove un-used internal name from observeNotification method.
// // NotificationObservable.swift // ESNotification // // Created by Tomohiro Kumagai on H27/11/22. // Copyright © 平成27年 EasyStyle G.K. All rights reserved. // public protocol NotificationObservable : AnyObject { } extension NotificationObservable { /// Observe an named notification. When the named notification was post, the `handler` called in main thread. public func observeNotificationNamed(name:String, handler:(NamedNotification)->Void) -> NotificationManager.HandlerID { return _notificationManager.observe(self, notificationName: name, handler: handler) } /// Observe an Native notification. When the native notification was post, the `handler` called in main thread. public func observeNotification<T:NotificationProtocol>(handler:(T)->Void) -> NotificationManager.HandlerID { return _notificationManager.observe(self, handler: handler) } /// Observe an Native notification. When the native notification was post, the `handler` called in main thread. /// The argument `notification` is used to help type inference. public func observeNotification<T:NotificationProtocol>(type:T.Type, handler:(T)->Void) -> NotificationManager.HandlerID { return _notificationManager.observe(self, handler: handler) } /// Release all observing handler for `self`. public func releaseObservingNotifications() { _notificationManager.release(observer: self) } }
// // NotificationObservable.swift // ESNotification // // Created by Tomohiro Kumagai on H27/11/22. // Copyright © 平成27年 EasyStyle G.K. All rights reserved. // public protocol NotificationObservable : AnyObject { } extension NotificationObservable { /// Observe an named notification. When the named notification was post, the `handler` called in main thread. public func observeNotificationNamed(name:String, handler:(NamedNotification)->Void) -> NotificationManager.HandlerID { return _notificationManager.observe(self, notificationName: name, handler: handler) } /// Observe an Native notification. When the native notification was post, the `handler` called in main thread. public func observeNotification<T:NotificationProtocol>(handler:(T)->Void) -> NotificationManager.HandlerID { return _notificationManager.observe(self, handler: handler) } /// Observe an Native notification. When the native notification was post, the `handler` called in main thread. /// The argument `notification` is used to help type inference. public func observeNotification<T:NotificationProtocol>(_ :T.Type, handler:(T)->Void) -> NotificationManager.HandlerID { return _notificationManager.observe(self, handler: handler) } /// Release all observing handler for `self`. public func releaseObservingNotifications() { _notificationManager.release(observer: self) } }
Fix UIView Rotation Degrees TODO
// // LayerView.swift // BFWControls // // Created by Tom Brodhurst-Hill on 9/01/2016. // Copyright © 2016 BareFeetWare. // Free to use at your own risk, with acknowledgement to BareFeetWare. // import UIKit extension UIView { var rotationDegrees: CGFloat { get { // TODO: Reverse engineer angle from transform. return 0.0 } set { transform = CGAffineTransform(rotationAngle: .pi / 180.0 * newValue) } } }
// // LayerView.swift // BFWControls // // Created by Tom Brodhurst-Hill on 9/01/2016. // Copyright © 2016 BareFeetWare. // Free to use at your own risk, with acknowledgement to BareFeetWare. // import UIKit extension UIView { var rotationDegrees: CGFloat { get { let angleInRadians = atan2(transform.b, transform.a) return angleInRadians * 180.0 / CGFloat(M_PI) } set { transform = CGAffineTransform(rotationAngle: .pi / 180.0 * newValue) } } }
Set the title to the ContactsVC
// // ContactsViewController.swift // V // // Created by Dulio Denis on 7/5/16. // Copyright © 2016 Dulio Denis. All rights reserved. // import UIKit import CoreData import Contacts import ContactsUI class ContactsViewController: UIViewController, ContextViewController { // in order to fulfill the ContextVC Protocol var context: NSManagedObjectContext? private let tableView = UITableView(frame: CGRectZero, style: .Plain) private let cellIdentifier = "ContactCell" override func viewDidLoad() { super.viewDidLoad() title = "All Contacts" navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(named: "add"), style: .Plain, target: self, action: "newContact") // Account for the Navigation Bar automaticallyAdjustsScrollViewInsets = false tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: cellIdentifier) tableView.tableFooterView = UIView(frame: CGRectZero) fillViewWith(tableView) } func newContact() { print("New Contact") } }
// // ContactsViewController.swift // V // // Created by Dulio Denis on 7/5/16. // Copyright © 2016 Dulio Denis. All rights reserved. // import UIKit import CoreData import Contacts import ContactsUI class ContactsViewController: UIViewController, ContextViewController { // in order to fulfill the ContextVC Protocol var context: NSManagedObjectContext? private let tableView = UITableView(frame: CGRectZero, style: .Plain) private let cellIdentifier = "ContactCell" override func viewDidLoad() { super.viewDidLoad() navigationController?.navigationBar.topItem?.title = "All Contacts" navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(named: "add"), style: .Plain, target: self, action: "newContact") // Account for the Navigation Bar automaticallyAdjustsScrollViewInsets = false tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: cellIdentifier) tableView.tableFooterView = UIView(frame: CGRectZero) fillViewWith(tableView) } func newContact() { print("New Contact") } }
Disable timing-sensitive test that's periodically failing in CI, rdar://38378503.
// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1 // REQUIRES: tools-release,no_asserts // expected-no-diagnostics let a: [Double] = [] _ = a.map { $0 - 1.0 } .map { $0 * $0 } .reduce(0, +) / Double(a.count)
// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1 // REQUIRES: tools-release,no_asserts // REQUIRES: rdar38378503 // expected-no-diagnostics let a: [Double] = [] _ = a.map { $0 - 1.0 } .map { $0 * $0 } .reduce(0, +) / Double(a.count)
Migrate typealias to associatedtype due to typealias deprecation
// // Paging.swift // GeneratedResults // // Created by Marcin Krzyzanowski on 22/06/15. // Copyright (c) 2015 Marcin Krzyżanowski. All rights reserved. // import Foundation //MARK: Generator protocol AsyncGeneratorType { typealias Element typealias Fetch mutating func next(fetchNextBatch: Fetch, onFinish: ((Element) -> Void)?) } /// Generator is the class because struct is captured in asynchronous operations so offset won't update. class PagingGenerator<T>: AsyncGeneratorType { typealias Element = Array<T> typealias Fetch = (offset: Int, limit: Int, completion: (result: Element) -> Void) -> Void var offset:Int let limit: Int init(startOffset: Int = 0, limit: Int = 25) { self.offset = startOffset self.limit = limit } func next(fetchNextBatch: Fetch, onFinish: ((Element) -> Void)? = nil) { fetchNextBatch(offset: offset, limit: limit) { [unowned self] (items) in onFinish?(items) self.offset += items.count } } }
// // Paging.swift // GeneratedResults // // Created by Marcin Krzyzanowski on 22/06/15. // Copyright (c) 2015 Marcin Krzyżanowski. All rights reserved. // import Foundation //MARK: Generator protocol AsyncGeneratorType { associatedtype Element associatedtype Fetch mutating func next(fetchNextBatch: Fetch, onFinish: ((Element) -> Void)?) } /// Generator is the class because struct is captured in asynchronous operations so offset won't update. class PagingGenerator<T>: AsyncGeneratorType { typealias Element = Array<T> typealias Fetch = (offset: Int, limit: Int, completion: (result: Element) -> Void) -> Void var offset:Int let limit: Int init(startOffset: Int = 0, limit: Int = 25) { self.offset = startOffset self.limit = limit } func next(fetchNextBatch: Fetch, onFinish: ((Element) -> Void)? = nil) { fetchNextBatch(offset: offset, limit: limit) { [unowned self] (items) in onFinish?(items) self.offset += items.count } } }
Change Swift TSan test to use pthreads rather than GCD.
// main.swift // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See http://swift.org/LICENSE.txt for license information // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // // ----------------------------------------------------------------------------- import Foundation var my_global: Int = 0 // global variable func main() { let q = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) dispatch_async(q) { my_global = 42 sleep(100) } dispatch_async(q) { usleep(10000) my_global = 43 exit(1) } sleep(100) } main()
// main.swift // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See http://swift.org/LICENSE.txt for license information // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // // ----------------------------------------------------------------------------- import Foundation var my_global: Int = 0 // global variable func main() { var thread1: pthread_t? = nil var thread2: pthread_t? = nil pthread_create(&thread1, nil, { _ in my_global = 42 sleep(100) return nil }, nil) pthread_create(&thread2, nil, { _ in usleep(10000) my_global = 43 exit(1) }, nil) } main()
Fix a memory leak issue
import UIKit /// Converts a generic element to `NSAttributedString`. Should only be used if a specific converter is not found. /// class GenericElementConverter: ElementConverter { let serializer: AttributedStringSerializer init(using serializer: AttributedStringSerializer) { self.serializer = serializer } // MARK: - ElementConverter func canConvert(element: ElementNode) -> Bool { return true } func convert(_ element: ElementNode, inheriting attributes: [AttributedStringKey: Any]) -> NSAttributedString { let content = NSMutableAttributedString() for child in element.children { let childContent = serializer.serialize(child, inheriting: attributes) content.append(childContent) } return content } }
import UIKit /// Converts a generic element to `NSAttributedString`. Should only be used if a specific converter is not found. /// class GenericElementConverter: ElementConverter { unowned let serializer: AttributedStringSerializer init(using serializer: AttributedStringSerializer) { self.serializer = serializer } // MARK: - ElementConverter func canConvert(element: ElementNode) -> Bool { return true } func convert(_ element: ElementNode, inheriting attributes: [AttributedStringKey: Any]) -> NSAttributedString { let content = NSMutableAttributedString() for child in element.children { let childContent = serializer.serialize(child, inheriting: attributes) content.append(childContent) } return content } }
Fix parsing of push payloads
// // PushPayload.swift // Ello // // Created by Gordon Fontenot on 5/20/15. // Copyright (c) 2015 Ello. All rights reserved. // public struct PushPayload { let info: [String: AnyObject] } public extension PushPayload { var applicationTarget: String { return info["application_target"] as? String ?? "" } var message: String { let aps = info["aps"] as? [String: AnyObject] return aps?["alert"] as? String ?? "New Notification" } }
// // PushPayload.swift // Ello // // Created by Gordon Fontenot on 5/20/15. // Copyright (c) 2015 Ello. All rights reserved. // public struct PushPayload { let info: [String: AnyObject] } public extension PushPayload { var applicationTarget: String { return info["application_target"] as? String ?? "" } var message: String { let aps = info["aps"] as? [String: AnyObject] let alert = aps?["alert"] as? [String: String] return alert?["body"] ?? "New Notification" } }
Add helper method to detect if video is a WP shortcode.
import Foundation import Aztec // MARK: - VideoAttachment // extension VideoAttachment { @objc var videoPressID: String? { get { return extraAttributes[VideoShortcodeProcessor.videoPressHTMLAttribute]?.toString() } set { if let nonNilValue = newValue { extraAttributes[VideoShortcodeProcessor.videoPressHTMLAttribute] = .string(nonNilValue) } else { extraAttributes.remove(named: VideoShortcodeProcessor.videoPressHTMLAttribute) } } } }
import Foundation import Aztec // MARK: - VideoAttachment // extension VideoAttachment { @objc var videoPressID: String? { get { return extraAttributes[VideoShortcodeProcessor.videoPressHTMLAttribute]?.toString() } set { if let nonNilValue = newValue { extraAttributes[VideoShortcodeProcessor.videoPressHTMLAttribute] = .string(nonNilValue) } else { extraAttributes.remove(named: VideoShortcodeProcessor.videoPressHTMLAttribute) } } } @objc var isShortcode: Bool { get { return extraAttributes[VideoShortcodeProcessor.videoWPShortcodeHTMLAttribute]?.toString() == "true" } set { if newValue { extraAttributes[VideoShortcodeProcessor.videoWPShortcodeHTMLAttribute] = .string(String("true")) } else { extraAttributes.remove(named: VideoShortcodeProcessor.videoWPShortcodeHTMLAttribute) } } } }
Make rounded border button public
// // RoundedBorderButton.swift // Swiftlier // // Created by Andrew J Wagner on 5/29/16. // Copyright © 2016 Drewag LLC. All rights reserved. // #if os(iOS) import UIKit @IBDesignable class RoundedBorderButton: UIButton { @IBInspectable var borderColor: UIColor = UIColor.clear { didSet { self.update() } } @IBInspectable var borderSize: CGFloat = 1 / UIScreen.main.scale { didSet { self.update() } } @IBInspectable var cornerRadius: CGFloat = 10 { didSet { self.update() } } override func awakeFromNib() { super.awakeFromNib() self.update() } } private extension RoundedBorderButton { func update() { self.layer.borderWidth = self.borderSize self.layer.borderColor = self.borderColor.cgColor self.layer.cornerRadius = self.cornerRadius } } #endif
// // RoundedBorderButton.swift // Swiftlier // // Created by Andrew J Wagner on 5/29/16. // Copyright © 2016 Drewag LLC. All rights reserved. // #if os(iOS) import UIKit @IBDesignable public class RoundedBorderButton: UIButton { @IBInspectable public var borderColor: UIColor = UIColor.clear { didSet { self.update() } } @IBInspectable public var borderSize: CGFloat = 1 / UIScreen.main.scale { didSet { self.update() } } @IBInspectable public var cornerRadius: CGFloat = 10 { didSet { self.update() } } open override func awakeFromNib() { super.awakeFromNib() self.update() } } private extension RoundedBorderButton { func update() { self.layer.borderWidth = self.borderSize self.layer.borderColor = self.borderColor.cgColor self.layer.cornerRadius = self.cornerRadius } } #endif
Update dependency SwiftyBeaver/SwiftyBeaver to from: "1.9.4"
// swift-tools-version:5.0 import PackageDescription let package = Package( name: "Conductor", products: [ .executable( name: "Conductor", targets: ["Conductor"] ), ], dependencies: [ .package(url: "https://github.com/danger/swift.git", from: "3.10.1"), .package(url: "https://github.com/kylef/Commander.git", from: "0.9.1"), .package(url: "https://github.com/davecom/SwiftGraph.git", .branch("master")), .package(url: "https://github.com/jmmaloney4/Squall.git", .branch("master")), .package(url: "https://github.com/jpsim/Yams.git", from: "4.0.6"), .package(url: "https://github.com/SwiftyBeaver/SwiftyBeaver.git", .upToNextMajor(from: "1.9.0")), ], targets: [ .target( name: "Conductor", dependencies: ["Danger", "Commander", "SwiftGraph", "Squall", "Yams", "SwiftyBeaver"] ), ], swiftLanguageVersions: [.v5] )
// swift-tools-version:5.0 import PackageDescription let package = Package( name: "Conductor", products: [ .executable( name: "Conductor", targets: ["Conductor"] ), ], dependencies: [ .package(url: "https://github.com/danger/swift.git", from: "3.10.1"), .package(url: "https://github.com/kylef/Commander.git", from: "0.9.1"), .package(url: "https://github.com/davecom/SwiftGraph.git", .branch("master")), .package(url: "https://github.com/jmmaloney4/Squall.git", .branch("master")), .package(url: "https://github.com/jpsim/Yams.git", from: "4.0.6"), .package(url: "https://github.com/SwiftyBeaver/SwiftyBeaver.git", from: "1.9.4"), ], targets: [ .target( name: "Conductor", dependencies: ["Danger", "Commander", "SwiftGraph", "Squall", "Yams", "SwiftyBeaver"] ), ], swiftLanguageVersions: [.v5] )
Update Multiset to Swift 4.2
//: Playground - noun: a place where people can play #if swift(>=4.0) print("Hello, Swift 4!") #endif import Cocoa var set = Multiset<String>() set.add("Foo") set.add("Foo") set.add("Bar") set.add("Baz") set.count set.count(for: "Foo") set.allItems var set2 = Multiset<String>() set2.add("Foo") set2.add("Foo") set2.isSubSet(of: set) // true set.isSubSet(of: set2) // false // Convenience constructor: pass a Collection of Hashables to the constructor var cacti = Multiset<Character>("cacti") cacti.allItems var tactical = Multiset<Character>("tactical") cacti.isSubSet(of: tactical) // true tactical.isSubSet(of: cacti) // false // Test ExpressibleByArrayLiteral protocol let set3: Multiset<String> = ["foo", "bar"] set3.count(for: "foo") // Test Equatable protocol let set4 = Multiset<String>(set3.allItems) set4 == set3 // true set4 == set // false
//: Playground - noun: a place where people can play import Cocoa var set = Multiset<String>() set.add("Foo") set.add("Foo") set.add("Bar") set.add("Baz") set.count set.count(for: "Foo") set.allItems var set2 = Multiset<String>() set2.add("Foo") set2.add("Foo") set2.isSubSet(of: set) // true set.isSubSet(of: set2) // false // Convenience constructor: pass a Collection of Hashables to the constructor var cacti = Multiset<Character>("cacti") cacti.allItems var tactical = Multiset<Character>("tactical") cacti.isSubSet(of: tactical) // true tactical.isSubSet(of: cacti) // false // Test ExpressibleByArrayLiteral protocol let set3: Multiset<String> = ["foo", "bar"] set3.count(for: "foo") // Test Equatable protocol let set4 = Multiset<String>(set3.allItems) set4 == set3 // true set4 == set // false
Fix broken test on Linux
// RUN: %target-typecheck-verify-swift -enable-objc-interop -import-objc-header %S/Inputs/diag_ownership_incompatibility.h class C { weak var weakVar: NoWeakClass? = nil // expected-error {{'NoWeakClass' is incompatible with 'weak' references}} unowned var unownedVar = NoWeakClass() // expected-error {{'NoWeakClass' is incompatible with 'unowned' references}} } _ = C() weak var weakVar: NoWeakClass? = nil // expected-error {{'NoWeakClass' is incompatible with 'weak' references}} unowned var unownedVar = NoWeakClass() // expected-error {{'NoWeakClass' is incompatible with 'unowned' references}} // Subclasses are also incompatible. class SwiftNoWeakClass: NoWeakClass { } class D { weak var weakVar: SwiftNoWeakClass? = nil // expected-error {{'SwiftNoWeakClass' is incompatible with 'weak' references}} unowned var unownedVar = SwiftNoWeakClass() // expected-error {{'SwiftNoWeakClass' is incompatible with 'unowned' references}} } _ = D() weak var weakSwiftVar: SwiftNoWeakClass? = nil // expected-error {{'SwiftNoWeakClass' is incompatible with 'weak' references}} unowned var unownedSwiftVar = SwiftNoWeakClass() // expected-error {{'SwiftNoWeakClass' is incompatible with 'unowned' references}}
// REQUIRES: objc_interop // RUN: %target-typecheck-verify-swift -enable-objc-interop -import-objc-header %S/Inputs/diag_ownership_incompatibility.h class C { weak var weakVar: NoWeakClass? = nil // expected-error {{'NoWeakClass' is incompatible with 'weak' references}} unowned var unownedVar = NoWeakClass() // expected-error {{'NoWeakClass' is incompatible with 'unowned' references}} } _ = C() weak var weakVar: NoWeakClass? = nil // expected-error {{'NoWeakClass' is incompatible with 'weak' references}} unowned var unownedVar = NoWeakClass() // expected-error {{'NoWeakClass' is incompatible with 'unowned' references}} // Subclasses are also incompatible. class SwiftNoWeakClass: NoWeakClass { } class D { weak var weakVar: SwiftNoWeakClass? = nil // expected-error {{'SwiftNoWeakClass' is incompatible with 'weak' references}} unowned var unownedVar = SwiftNoWeakClass() // expected-error {{'SwiftNoWeakClass' is incompatible with 'unowned' references}} } _ = D() weak var weakSwiftVar: SwiftNoWeakClass? = nil // expected-error {{'SwiftNoWeakClass' is incompatible with 'weak' references}} unowned var unownedSwiftVar = SwiftNoWeakClass() // expected-error {{'SwiftNoWeakClass' is incompatible with 'unowned' references}}
Remove value(forKeyPath:) method call because is not supported by Linux
// // CliArgsParser.swift // Danger // // Created by Franco Meloni on 12/11/2018. // import Foundation public final class CliArgsParser { public init() {} public func parseCli(fromData data: Data) -> CliArgs? { if let dictionary = try? JSONSerialization.jsonObject(with: data, options: .allowFragments) as? NSDictionary, let cliArgsDictionary = dictionary?.value(forKeyPath: "danger.settings.cliArgs") as? [String:Any] { return CliArgs(dictionary: cliArgsDictionary) } return nil } }
// // CliArgsParser.swift // Danger // // Created by Franco Meloni on 12/11/2018. // import Foundation public final class CliArgsParser { public init() {} public func parseCli(fromData data: Data) -> CliArgs? { if let dictionary = try? JSONSerialization.jsonObject(with: data, options: .allowFragments) as? [String:Any], let danger = dictionary?["danger"] as? [String:Any], let settings = danger["settings"] as? [String:Any], let cliArgsDictionary = settings["cliArgs"] as? [String:Any] { return CliArgs(dictionary: cliArgsDictionary) } return nil } }
Fix the gates on a test that needs statistics
// REQUIRES: rdar61348443 // RUN: %empty-directory(%t) // RUN: %target-swift-frontend -emit-module -module-name Multi -o %t/multi-file.swiftmodule -primary-file %s %S/Inputs/multi-file-type-eraser.swift // RUN: %target-swift-frontend -emit-module -module-name Multi -o %t/multi-file-2.swiftmodule %s -primary-file %S/Inputs/multi-file-type-eraser.swift // RUN: %target-swift-frontend -emit-module -module-name Multi %t/multi-file.swiftmodule %t/multi-file-2.swiftmodule -o %t -print-stats 2>&1 | %FileCheck %s // RUN: %target-swift-frontend -emit-module -module-name Multi %t/multi-file-2.swiftmodule %t/multi-file.swiftmodule -o %t -print-stats 2>&1 | %FileCheck %s // Ensure we don't crash during merge-modules - no matter the order of inputs. // CHECK: Statistics // CHECK: 2 Serialization - # of normal protocol conformances completed public struct AnyWindows : Vista { public init<V: Vista>(erasing vista: V) { fatalError() } public var dlls: Never { fatalError() } }
// REQUIRES: asserts // RUN: %empty-directory(%t) // RUN: %target-swift-frontend -emit-module -module-name Multi -o %t/multi-file.swiftmodule -primary-file %s %S/Inputs/multi-file-type-eraser.swift // RUN: %target-swift-frontend -emit-module -module-name Multi -o %t/multi-file-2.swiftmodule %s -primary-file %S/Inputs/multi-file-type-eraser.swift // RUN: %target-swift-frontend -emit-module -module-name Multi %t/multi-file.swiftmodule %t/multi-file-2.swiftmodule -o %t -print-stats 2>&1 | %FileCheck %s // RUN: %target-swift-frontend -emit-module -module-name Multi %t/multi-file-2.swiftmodule %t/multi-file.swiftmodule -o %t -print-stats 2>&1 | %FileCheck %s // Ensure we don't crash during merge-modules - no matter the order of inputs. // CHECK: Statistics // CHECK: 2 Serialization - # of normal protocol conformances completed public struct AnyWindows : Vista { public init<V: Vista>(erasing vista: V) { fatalError() } public var dlls: Never { fatalError() } }
Add decode extension for Array
// // Decodable.swift // Decodable // // Created by Johannes Lund on 2015-07-07. // Copyright © 2015 anviking. All rights reserved. // import Foundation public protocol Decodable { static func decode(json: AnyObject) throws -> Self } public protocol Castable: Decodable {} extension Castable { public static func decode(j: AnyObject) throws -> Self { guard let result = j as? Self else { let info = DecodingError.Info(object: j) throw DecodingError.TypeMismatch(type: self, info: info) } return result } } extension String: Castable {} extension Int: Castable {} extension Double: Castable {} extension Bool: Castable {} extension Dictionary: Castable {} extension NSDictionary { public static func decode(j: AnyObject) throws -> NSDictionary { guard let result = j as? NSDictionary else { let info = DecodingError.Info(object: j) throw DecodingError.TypeMismatch(type: self, info: info) } return result } }
// // Decodable.swift // Decodable // // Created by Johannes Lund on 2015-07-07. // Copyright © 2015 anviking. All rights reserved. // import Foundation public protocol Decodable { static func decode(json: AnyObject) throws -> Self } public protocol Castable: Decodable {} extension Castable { public static func decode(j: AnyObject) throws -> Self { guard let result = j as? Self else { let info = DecodingError.Info(object: j) throw DecodingError.TypeMismatch(type: self, info: info) } return result } } extension String: Castable {} extension Int: Castable {} extension Double: Castable {} extension Bool: Castable {} extension Dictionary: Castable {} extension NSDictionary { public static func decode(j: AnyObject) throws -> NSDictionary { guard let result = j as? NSDictionary else { let info = DecodingError.Info(object: j) throw DecodingError.TypeMismatch(type: self, info: info) } return result } } extension Array where Element: Decodable { public static func decode(j: AnyObject, ignoreInvalidObject: Bool = false) throws -> [Element] { return try decodeArray(ignoreInvalidObjects: ignoreInvalidObject)(json: j) } }
Remove printing a warning to console because we have a stable feature.
// // TextInputFormats+BankCardNumber.swift // TextInputKit // // Created by Artem Starosvetskiy on 25/11/2016. // Copyright © 2016 Artem Starosvetskiy. All rights reserved. // public extension TextInputFormats { static func bankCardNumber(_ options: BankCardNumberTextInputOptions = .options()) -> TextInputFormat<BankCardNumber> { // TODO: Remove when phone number text input formatting is supported. print("TextInputFormats.\(#function) isn't supported yet.") let serializer = TextInputSerializer.identical.map( direct: { BankCardNumber(formattedString: $0) }, reverse: { $0.formattedString }) let formatter = BankCardNumberTextInputFormatter(options) return TextInputFormat<String>.from(serializer, formatter) } }
// // TextInputFormats+BankCardNumber.swift // TextInputKit // // Created by Artem Starosvetskiy on 25/11/2016. // Copyright © 2016 Artem Starosvetskiy. All rights reserved. // public extension TextInputFormats { static func bankCardNumber(_ options: BankCardNumberTextInputOptions = .options()) -> TextInputFormat<BankCardNumber> { let serializer = TextInputSerializer.identical.map( direct: { BankCardNumber(formattedString: $0) }, reverse: { $0.formattedString }) let formatter = BankCardNumberTextInputFormatter(options) return TextInputFormat<String>.from(serializer, formatter) } }
Return error to the error closure
// // PHLoadPostOperation.swift // Product Hunt // // Created by Vlado on 5/3/16. // Copyright © 2016 ProductHunt. All rights reserved. // import Foundation import ReSwift class PHLoadPostOperation { class func performNewer(store: Store<PHAppState>? = store) { guard let store = store else { return } perform(store, api: PHAPI.sharedInstance, daysAgo: store.state.posts.today) } class func performOlder(store: Store<PHAppState>? = store) { guard let store = store else { return } perform(store, api: PHAPI.sharedInstance, daysAgo: store.state.posts.nextDay) } class func perform(app: Store<PHAppState>, api: PHAPI, daysAgo: Int) { if api.isThereOngoingRequest { return } let operation = createOperation(daysAgo) { (posts) in app.dispatch( PHPostsLoadAction(posts: posts) ) } PHAPIOperation.perform(app, api: api, operation: operation) } class func createOperation(daysAgo: Int, complete: ([PHPost]) -> ()) -> PHAPIOperationClosure { return { (api: PHAPI,errorClosure: PHAPIErrorClosure) in api.getPosts(daysAgo, completion: { (posts, error) in complete(posts) }) } } }
// // PHLoadPostOperation.swift // Product Hunt // // Created by Vlado on 5/3/16. // Copyright © 2016 ProductHunt. All rights reserved. // import Foundation import ReSwift class PHLoadPostOperation { class func performNewer(store: Store<PHAppState>? = store) { guard let store = store else { return } perform(store, api: PHAPI.sharedInstance, daysAgo: store.state.posts.today) } class func performOlder(store: Store<PHAppState>? = store) { guard let store = store else { return } perform(store, api: PHAPI.sharedInstance, daysAgo: store.state.posts.nextDay) } class func perform(app: Store<PHAppState>, api: PHAPI, daysAgo: Int) { if api.isThereOngoingRequest { return } let operation = createOperation(daysAgo) { (posts) in app.dispatch( PHPostsLoadAction(posts: posts) ) } PHAPIOperation.perform(app, api: api, operation: operation) } class func createOperation(daysAgo: Int, complete: ([PHPost]) -> ()) -> PHAPIOperationClosure { return { (api: PHAPI, errorClosure: PHAPIErrorClosure) in api.getPosts(daysAgo, completion: { (posts, error) in if let error = error { errorClosure(error: error) } complete(posts) }) } } }
Mark this test as depending on ObjC bridging specifics.
// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s public struct Q<T> { let x: T } public func foo<T>(arg: [Q<T>]) { // CHECK: define {{.*}}_TF12generic_arg43foourFGSaGVS_1Qx__T_ // CHECK: store %[[TY:.*]]* %0, %[[TY]]** %[[ALLOCA:.*]], align // CHECK: call void @llvm.dbg.declare(metadata %[[TY]]** %[[ALLOCA]], // CHECK-SAME: metadata ![[ARG:.*]], metadata ![[EXPR:.*]]) // No deref here: the array argument is passed by value. // CHECK: ![[EXPR]] = !DIExpression() // CHECK: ![[ARG]] = !DILocalVariable(name: "arg", arg: 1, // CHECK-SAME: line: 5, // CHECK-SAME: type: !"_TtGSaGV12generic_arg41QQq_FS_3foourFGSaGS0_x__T___") }
// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s // REQUIRES: objc_interop public struct Q<T> { let x: T } public func foo<T>(arg: [Q<T>]) { // CHECK: define {{.*}}_TF12generic_arg43foourFGSaGVS_1Qx__T_ // CHECK: store %[[TY:.*]]* %0, %[[TY]]** %[[ALLOCA:.*]], align // CHECK: call void @llvm.dbg.declare(metadata %[[TY]]** %[[ALLOCA]], // CHECK-SAME: metadata ![[ARG:.*]], metadata ![[EXPR:.*]]) // No deref here: the array argument is passed by value. // CHECK: ![[EXPR]] = !DIExpression() // CHECK: ![[ARG]] = !DILocalVariable(name: "arg", arg: 1, // CHECK-SAME: line: 5, // CHECK-SAME: type: !"_TtGSaGV12generic_arg41QQq_FS_3foourFGSaGS0_x__T___") }
Move left bar button items over a bit
// // UINavigationItem.swift // Ello // // Created by Colin Gray on 3/20/2015. // Copyright (c) 2015 Ello. All rights reserved. // import Foundation extension UINavigationItem { func fixNavBarItemPadding() { let negativeSpacer = UIBarButtonItem(barButtonSystemItem: .FixedSpace, target: nil, action: nil) negativeSpacer.width = -22 if let rightBarButtonItems = self.rightBarButtonItems { self.rightBarButtonItems = [negativeSpacer] + rightBarButtonItems } if let leftBarButtonItems = self.leftBarButtonItems { self.leftBarButtonItems = [negativeSpacer] + leftBarButtonItems } } }
// // UINavigationItem.swift // Ello // // Created by Colin Gray on 3/20/2015. // Copyright (c) 2015 Ello. All rights reserved. // import Foundation extension UINavigationItem { func fixNavBarItemPadding() { let negativeSpacer = UIBarButtonItem(barButtonSystemItem: .FixedSpace, target: nil, action: nil) negativeSpacer.width = -22 let leftNegativeSpacer = UIBarButtonItem(barButtonSystemItem: .FixedSpace, target: nil, action: nil) leftNegativeSpacer.width = -17 if let rightBarButtonItems = self.rightBarButtonItems { self.rightBarButtonItems = [negativeSpacer] + rightBarButtonItems } if let leftBarButtonItems = self.leftBarButtonItems { self.leftBarButtonItems = [leftNegativeSpacer] + leftBarButtonItems } } }
Undo the XFAIL of this test
// RUN: not --crash %target-swift-frontend %s -typecheck // See <rdar://32555384> // XFAIL: * protocol P {} func bar(p: P?) { foo(p is String) } func foo<T>(_: T, _: T) {} func foo<T>(_: T?, _: T?) {}
// RUN: not --crash %target-swift-frontend %s -typecheck protocol P {} func bar(p: P?) { foo(p is String) } func foo<T>(_: T, _: T) {} func foo<T>(_: T?, _: T?) {}
Remove a redundant parameter for UIApplication
// // Copyright © 2015 Onefootball GmbH. All rights reserved. // import UIKit #if DEBUG autoreleasepool { if Process.arguments.contains("--ResetData") { ApplicationResetManager.reset() } } #endif autoreleasepool { UIApplicationMain(Process.argc, Process.unsafeArgv, NSStringFromClass(UIApplication), NSStringFromClass(AppDelegate)) }
// // Copyright © 2015 Onefootball GmbH. All rights reserved. // import UIKit #if DEBUG autoreleasepool { if Process.arguments.contains("--ResetData") { ApplicationResetManager.reset() } } #endif autoreleasepool { UIApplicationMain(Process.argc, Process.unsafeArgv, nil, NSStringFromClass(AppDelegate)) }
Use a functional approach for character reading
class EntryReader { static let lineLength = 27 class func read(_ lines: [String]) -> String? { guard lines.count == 4 else { return nil } return characters(in: lines) } private class func characters(in lines: [String]) -> String { var output = "" for i in characterStride() { output += characterForDigit(atIndex: i, in: lines) } return output } private class func characterStride() -> StrideTo<Int> { return stride(from: 0, to: lineLength, by: CharacterReader.length) } private class func characterForDigit(atIndex i: Int, in lines: [String]) -> String { let characterLines = componentsForDigit(atIndex: i, in: lines) if let character = CharacterReader.read(characterLines) { return String(character) } return "" } private class func componentsForDigit(atIndex i: Int, in lines: [String]) -> [String] { return lines.dropLast().map { componentsForDigit(atIndex: i, on: $0) } } private class func componentsForDigit(atIndex i: Int, on line: String) -> String { let start = line.index(line.startIndex, offsetBy: i) let end = line.index(start, offsetBy: CharacterReader.length) return line[start..<end] } }
class EntryReader { static let lineLength = 27 class func read(_ lines: [String]) -> String? { guard lines.count == 4 else { return nil } return characters(in: lines) } private class func characters(in lines: [String]) -> String { return characterStride().reduce("") { output, i in return output + characterForDigit(atIndex: i, in: lines) } } private class func characterStride() -> StrideTo<Int> { return stride(from: 0, to: lineLength, by: CharacterReader.length) } private class func characterForDigit(atIndex i: Int, in lines: [String]) -> String { let characterLines = componentsForDigit(atIndex: i, in: lines) if let character = CharacterReader.read(characterLines) { return String(character) } return "" } private class func componentsForDigit(atIndex i: Int, in lines: [String]) -> [String] { return lines.dropLast().map { componentsForDigit(atIndex: i, on: $0) } } private class func componentsForDigit(atIndex i: Int, on line: String) -> String { let start = line.index(line.startIndex, offsetBy: i) let end = line.index(start, offsetBy: CharacterReader.length) return line[start..<end] } }
Add missing JFIF format enum case.
public enum TextureFormat : UInt32 { /* DirectX standard formats */ case D3DFMT_R8G8B8 = 20 // RGB888 case D3DFMT_A8R8G8B8 = 21 // ARGB888 case D3DFMT_R5G6B5 = 23 // RGB565 case D3DFMT_A4R4G4B4 = 26 // ARGB4444 case D3DFMT_P8 = 41 // 8-bit index case D3DFMT_DXT1 = 0x31545844 // MAKEFOURCC('D', 'X', 'T', '1') case D3DFMT_DXT3 = 0x33545844 // MAKEFOURCC('D', 'X', 'T', '3') case D3DFMT_DXT5 = 0x35545844 // MAKEFOURCC('D', 'X', 'T', '5') case D3DFMT_INDEX16 = 101 // 16-bit index /* Custom formats */ case CUSTOM_B8R8G8 = 0xF3 // BGR888 case CUSTOM_I8 = 0xF4 // Intensity (I, I, I, I) }
public enum TextureFormat : UInt32 { /* DirectX standard formats */ case D3DFMT_R8G8B8 = 20 // RGB888 case D3DFMT_A8R8G8B8 = 21 // ARGB888 case D3DFMT_R5G6B5 = 23 // RGB565 case D3DFMT_A4R4G4B4 = 26 // ARGB4444 case D3DFMT_P8 = 41 // 8-bit index case D3DFMT_DXT1 = 0x31545844 // MAKEFOURCC('D', 'X', 'T', '1') case D3DFMT_DXT3 = 0x33545844 // MAKEFOURCC('D', 'X', 'T', '3') case D3DFMT_DXT5 = 0x35545844 // MAKEFOURCC('D', 'X', 'T', '5') case D3DFMT_INDEX16 = 101 // 16-bit index /* Custom formats */ case CUSTOM_B8R8G8 = 0xF3 // BGR888 case CUSTOM_I8 = 0xF4 // Intensity (I, I, I, I) case CUSTOM_JFIF = 0x01F4 // JFIF (https://en.wikipedia.org/wiki/JPEG_File_Interchange_Format) }
Add border color name to collection view cell
/* | _ ____ ____ _ | | |‾| ⚈ |-| ⚈ |‾| | | | | ‾‾‾‾| |‾‾‾‾ | | | ‾ ‾ ‾ */ import UIKit @IBDesignable open class CustomCollectionCell: UICollectionViewCell, BackgroundColorNameable, TintColorNameable { // MARK: - Inspectable properties @IBInspectable open var backgroundColorName: String? { didSet { applyBackgroundColorName() } } @IBInspectable open var tintColorName: String? { didSet { applyTintColorName() } } // MARK: - Initializers public override init(frame: CGRect) { super.init(frame: frame) registerForNotifications() } public required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) registerForNotifications() } // MARK: - Functions func registerForNotifications() { NotificationCenter.default.addObserver(self, selector: #selector(updateColors), name: Notification.Name.AppearanceColorsUpdated, object: nil) } func updateColors() { applyBackgroundColorName() applyTintColorName() } }
/* | _ ____ ____ _ | | |‾| ⚈ |-| ⚈ |‾| | | | | ‾‾‾‾| |‾‾‾‾ | | | ‾ ‾ ‾ */ import UIKit @IBDesignable open class CustomCollectionCell: UICollectionViewCell, BackgroundColorNameable, TintColorNameable, BorderColorNameable { // MARK: - Inspectable properties @IBInspectable open var backgroundColorName: String? { didSet { applyBackgroundColorName() } } @IBInspectable open var tintColorName: String? { didSet { applyTintColorName() } } @IBInspectable open var borderColorName: String? { didSet { applyBorderColorName() } } // MARK: - Initializers public override init(frame: CGRect) { super.init(frame: frame) registerForNotifications() } public required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) registerForNotifications() } // MARK: - Functions func registerForNotifications() { NotificationCenter.default.addObserver(self, selector: #selector(updateColors), name: Notification.Name.AppearanceColorsUpdated, object: nil) } func updateColors() { applyBackgroundColorName() applyTintColorName() applyBorderColorName() } }
Use SF Symbols for recents cell button, make it a bit larger
import AppKit class RecentsCellView: NSTableCellView { @IBOutlet weak var downloadDateTextField: NSTextField! @IBOutlet weak var downloadAgainButton: NSButton! }
import AppKit class RecentsCellView: NSTableCellView { @IBOutlet weak var downloadDateTextField: NSTextField! @IBOutlet weak var downloadAgainButton: NSButton! override func awakeFromNib() { super.awakeFromNib() if #available(OSX 11.0, *) { downloadAgainButton.image = NSImage( systemSymbolName: "arrow.clockwise.circle.fill", accessibilityDescription: nil )?.withSymbolConfiguration(.init(scale: .large)) } } }
Adjust default nib extension to use the bundle of the type
// // UIView+Nib.swift // iExtra // // Created by Daniel Saidi on 2016-11-09. // Copyright © 2018 Daniel Saidi. All rights reserved. // import UIKit public extension UIView { // MARK: - Properties public static var defaultNib: UINib { return UINib(nibName: defaultNibName, bundle: nil) } public static var defaultNibName: String { return className } // MARK: - Functions public static func initWithDefaultNib(owner: Any?) -> Self { return initWithDefaultNibTyped(owner: owner, nibName: defaultNibName) } public static func initWithDefaultNib(owner: Any?, fileNameSuffix: String) -> Self { let nib = "\(defaultNibName)\(fileNameSuffix)" return initWithDefaultNibTyped(owner: owner, nibName: nib) } public static func initWithDefaultNibTyped<T>(owner: Any?, nibName: String) -> T { let bundle = Bundle.main let nibs = bundle.loadNibNamed(nibName, owner: owner, options: nil) guard let nib = nibs?[0] as? T else { fatalError("initWithDefaultNibTyped: Invalid class") } return nib } }
// // UIView+Nib.swift // iExtra // // Created by Daniel Saidi on 2016-11-09. // Copyright © 2018 Daniel Saidi. All rights reserved. // import UIKit public extension UIView { // MARK: - Properties public static var defaultNib: UINib { return defaultNib(in: Bundle(for: self)) } public static var defaultNibName: String { return className } // MARK: - Functions public static func defaultNib(in bundle: Bundle?) -> UINib { return UINib(nibName: defaultNibName, bundle: bundle) } public static func initWithDefaultNib(owner: Any?) -> Self { return initWithDefaultNibTyped(owner: owner, nibName: defaultNibName) } public static func initWithDefaultNib(owner: Any?, fileNameSuffix: String) -> Self { let nib = "\(defaultNibName)\(fileNameSuffix)" return initWithDefaultNibTyped(owner: owner, nibName: nib) } public static func initWithDefaultNibTyped<T>(owner: Any?, nibName: String) -> T { let bundle = Bundle.main let nibs = bundle.loadNibNamed(nibName, owner: owner, options: nil) guard let nib = nibs?[0] as? T else { fatalError("initWithDefaultNibTyped: Invalid class") } return nib } }