semantic-ui-less
Advanced tools
Comparing version 2.0.3 to 2.0.4
@@ -344,3 +344,3 @@ /*! | ||
isLegacySettings = (keys.length > 0) | ||
? (parameters[keys[0]].identifier !== undefined) | ||
? (parameters[keys[0]].identifier !== undefined && parameters[keys[0]].rules !== undefined) | ||
: false | ||
@@ -499,2 +499,5 @@ ; | ||
module.verbose('Checking for existence of a field with identifier', identifier); | ||
if(typeof identifier !== 'string') { | ||
module.error(error.identifier, identifier); | ||
} | ||
if( $field.filter('#' + identifier).length > 0 ) { | ||
@@ -765,5 +768,7 @@ return true; | ||
; | ||
// cast to string | ||
value = $.trim($field.val() + ''); | ||
// cast to string avoiding encoding special values | ||
value = (value === undefined || value === '' || value === null) | ||
? '' | ||
: $.trim(value + '') | ||
; | ||
// if bracket notation is used, pass in extra parameters | ||
@@ -1021,5 +1026,6 @@ if(bracket) { | ||
error: { | ||
oldSyntax : 'Starting in 2.0 forms now only take a single settings object. Validation settings converted to new syntax automatically.', | ||
noRule : 'There is no rule matching the one you specified', | ||
method : 'The method you called is not defined.' | ||
oldSyntax : 'Starting in 2.0 forms now only take a single settings object. Validation settings converted to new syntax automatically.', | ||
identifier : 'You must specify a string identifier for each field', | ||
noRule : 'There is no rule matching the one you specified', | ||
method : 'The method you called is not defined.' | ||
}, | ||
@@ -1052,2 +1058,7 @@ | ||
// is not empty or blank string | ||
empty: function(value) { | ||
return !(value === undefined || '' === value || $.isArray(value) && value.length === 0); | ||
}, | ||
// checkbox checked | ||
@@ -1058,16 +1069,2 @@ checked: function() { | ||
// value contains text (insensitive) | ||
contains: function(value, text) { | ||
// escape regex characters | ||
text = text.replace($.fn.form.settings.regExp.escape, "\\$&"); | ||
return (value.search( new RegExp(text, 'i') ) !== -1); | ||
}, | ||
// value contains text (case sensitive) | ||
containsExactly: function(value, text) { | ||
// escape regex characters | ||
text = text.replace($.fn.form.settings.regExp.escape, "\\$&"); | ||
return (value.search( new RegExp(text) ) !== -1); | ||
}, | ||
// is most likely an email | ||
@@ -1081,8 +1078,28 @@ email: function(value){ | ||
// is not empty or blank string | ||
empty: function(value) { | ||
return !(value === undefined || '' === value || $.isArray(value) && value.length === 0); | ||
// value is most likely url | ||
url: function(value) { | ||
return $.fn.form.settings.regExp.url.test(value); | ||
}, | ||
// is valid integer | ||
// matches specified regExp | ||
regExp: function(value, regExp) { | ||
var | ||
regExpParts = regExp.match($.fn.form.settings.regExp.flags), | ||
flags | ||
; | ||
// regular expression specified as /baz/gi (flags) | ||
if(regExpParts) { | ||
regExp = (regExpParts.length >= 2) | ||
? regExpParts[1] | ||
: regExp | ||
; | ||
flags = (regExpParts.length >= 3) | ||
? regExpParts[2] | ||
: '' | ||
; | ||
} | ||
return value.match( new RegExp(regExp, flags) ); | ||
}, | ||
// is valid integer or matches range | ||
integer: function(value, range) { | ||
@@ -1119,2 +1136,3 @@ var | ||
// is value (case insensitive) | ||
@@ -1138,5 +1156,59 @@ is: function(value, text) { | ||
// is at least string length | ||
// value is not another value (case insensitive) | ||
not: function(value, notValue) { | ||
value = (typeof value == 'string') | ||
? value.toLowerCase() | ||
: value | ||
; | ||
notValue = (typeof notValue == 'string') | ||
? notValue.toLowerCase() | ||
: notValue | ||
; | ||
return (value != notValue); | ||
}, | ||
// value is not another value (case sensitive) | ||
notExactly: function(value, notValue) { | ||
return (value != notValue); | ||
}, | ||
// value contains text (insensitive) | ||
contains: function(value, text) { | ||
// escape regex characters | ||
text = text.replace($.fn.form.settings.regExp.escape, "\\$&"); | ||
return (value.search( new RegExp(text, 'i') ) !== -1); | ||
}, | ||
// value contains text (case sensitive) | ||
containsExactly: function(value, text) { | ||
// escape regex characters | ||
text = text.replace($.fn.form.settings.regExp.escape, "\\$&"); | ||
return (value.search( new RegExp(text) ) !== -1); | ||
}, | ||
// value contains text (insensitive) | ||
doesntContain: function(value, text) { | ||
// escape regex characters | ||
text = text.replace($.fn.form.settings.regExp.escape, "\\$&"); | ||
return (value.search( new RegExp(text, 'i') ) === -1); | ||
}, | ||
// value contains text (case sensitive) | ||
doesntContainExactly: function(value, text) { | ||
// escape regex characters | ||
text = text.replace($.fn.form.settings.regExp.escape, "\\$&"); | ||
return (value.search( new RegExp(text) ) === -1); | ||
}, | ||
// is exactly length | ||
length: function(value, requiredLength) { | ||
return (value !== undefined) | ||
? (value.length == requiredLength) | ||
: false | ||
; | ||
}, | ||
// is at least string length | ||
minLength: function(value, requiredLength) { | ||
return (value !== undefined) | ||
? (value.length >= requiredLength) | ||
@@ -1147,5 +1219,12 @@ : false | ||
// is less than length | ||
maxLength: function(value, maxLength) { | ||
return (value !== undefined) | ||
? (value.length <= maxLength) | ||
: false | ||
; | ||
}, | ||
// matches another field | ||
different: function(value, identifier) { | ||
// use either id or name of field | ||
match: function(value, identifier) { | ||
var | ||
@@ -1168,3 +1247,3 @@ $form = $(this), | ||
return (matchingValue !== undefined) | ||
? ( value.toString() !== matchingValue.toString() ) | ||
? ( value.toString() == matchingValue.toString() ) | ||
: false | ||
@@ -1174,4 +1253,4 @@ ; | ||
// matches another field | ||
match: function(value, identifier) { | ||
// different than another field | ||
different: function(value, identifier) { | ||
// use either id or name of field | ||
@@ -1195,3 +1274,3 @@ var | ||
return (matchingValue !== undefined) | ||
? ( value.toString() == matchingValue.toString() ) | ||
? ( value.toString() !== matchingValue.toString() ) | ||
: false | ||
@@ -1201,65 +1280,30 @@ ; | ||
maxCount: function(value, count) { | ||
value = value.split(','); | ||
return ($.isArray(value) && value.length <= count); | ||
exactCount: function(value, exactCount) { | ||
if(exactCount == 0) { | ||
return (value === ''); | ||
} | ||
if(exactCount == 1) { | ||
return (value !== '' && value.search(',') === -1); | ||
} | ||
return (value.split(',').length == exactCount); | ||
}, | ||
exactCount: function(value, count) { | ||
value = value.split(','); | ||
return ($.isArray(value) && value.length == count); | ||
minCount: function(value, minCount) { | ||
if(minCount == 0) { | ||
return true; | ||
} | ||
if(minCount == 1) { | ||
return (value !== ''); | ||
} | ||
return (value.split(',').length >= minCount); | ||
}, | ||
minCount: function(value, count) { | ||
value = value.split(','); | ||
return ($.isArray(value) && value.length >= count); | ||
}, | ||
regExp: function(value, regExp) { | ||
var | ||
regExpParts = regExp.match($.fn.form.settings.regExp.flags), | ||
flags | ||
; | ||
// regular expression specified as /baz/gi (flags) | ||
if(regExpParts) { | ||
regExp = (regExpParts.length >= 2) | ||
? regExpParts[1] | ||
: regExp | ||
; | ||
flags = (regExpParts.length >= 3) | ||
? regExpParts[2] | ||
: '' | ||
; | ||
maxCount: function(value, maxCount) { | ||
if(maxCount == 0) { | ||
return false; | ||
} | ||
return value.match( new RegExp(regExp, flags) ); | ||
}, | ||
// string length is less than max length | ||
maxLength: function(value, maxLength) { | ||
return (value !== undefined) | ||
? (value.length <= maxLength) | ||
: false | ||
; | ||
}, | ||
// value is not value (case insensitive) | ||
not: function(value, notValue) { | ||
value = (typeof value == 'string') | ||
? value.toLowerCase() | ||
: value | ||
; | ||
notValue = (typeof notValue == 'string') | ||
? notValue.toLowerCase() | ||
: notValue | ||
; | ||
return (value != notValue); | ||
}, | ||
// value is not value (case sensitive) | ||
notExactly: function(value, notValue) { | ||
return (value != notValue); | ||
}, | ||
// value is most likely url | ||
url: function(value) { | ||
return $.fn.form.settings.regExp.url.test(value); | ||
if(maxCount == 1) { | ||
return (value.search(',') === -1); | ||
} | ||
return (value.split(',').length <= maxCount); | ||
} | ||
@@ -1266,0 +1310,0 @@ } |
@@ -1140,5 +1140,14 @@ /*! | ||
// check position immediately on init | ||
initialCheck : true, | ||
// whether to refresh calculations after all page images load | ||
refreshOnLoad : true, | ||
// whether to refresh calculations after page resize event | ||
refreshOnResize : true, | ||
// should call callbacks on refresh event (resize, etc) | ||
checkOnRefresh : true, | ||
// callback should only occur one time | ||
@@ -1159,5 +1168,2 @@ once : true, | ||
// check position immediately on init | ||
initialCheck : true, | ||
// visibility check delay in ms (defaults to animationFrame) | ||
@@ -1176,5 +1182,2 @@ throttle : false, | ||
// should call callbacks on refresh event (resize, etc) | ||
checkOnRefresh : true, | ||
// standard callbacks | ||
@@ -1181,0 +1184,0 @@ onOnScreen : false, |
@@ -180,2 +180,3 @@ /*! | ||
module.toggle(); | ||
$input.focus(); | ||
event.preventDefault(); | ||
@@ -197,3 +198,3 @@ }, | ||
} | ||
if(!event.ctrlKey && (key == keyCode.enter || key == keyCode.space)) { | ||
if(!event.ctrlKey && (key == keyCode.enter)) { | ||
module.verbose('Enter key pressed, toggling checkbox'); | ||
@@ -200,0 +201,0 @@ module.toggle(); |
@@ -123,3 +123,3 @@ /*! | ||
} | ||
if( $offsetParent.is('html') ) { | ||
if( $offsetParent.is('html') && $offsetParent[0] !== $body[0] ) { | ||
module.debug('Setting page as offset parent'); | ||
@@ -445,2 +445,5 @@ $offsetParent = $body; | ||
}, | ||
popupOffset: function() { | ||
return $popup.offset(); | ||
}, | ||
calculations: function() { | ||
@@ -486,2 +489,10 @@ var | ||
// add in container calcs if fluid | ||
if( settings.setFluidWidth && module.is.fluid() ) { | ||
calculations.container = { | ||
width: $popup.parent().outerWidth() | ||
}; | ||
calculations.popup.width = calculations.container.width; | ||
} | ||
// add in margins if inline | ||
@@ -532,2 +543,26 @@ calculations.target.margin.top = (settings.inline) | ||
}, | ||
distanceFromBoundary: function(offset, calculations) { | ||
var | ||
distanceFromBoundary = {}, | ||
popup, | ||
boundary | ||
; | ||
offset = offset || module.get.offset(); | ||
calculations = calculations || module.get.calculations(); | ||
// shorthand | ||
popup = calculations.popup; | ||
boundary = calculations.boundary; | ||
if(offset) { | ||
distanceFromBoundary = { | ||
top : (offset.top - boundary.top), | ||
left : (offset.left - boundary.left), | ||
right : (boundary.right - (offset.left + popup.width) ), | ||
bottom : (boundary.bottom - (offset.top + popup.height) ) | ||
}; | ||
module.verbose('Distance from boundaries determined', offset, distanceFromBoundary); | ||
} | ||
return distanceFromBoundary; | ||
}, | ||
offsetParent: function($target) { | ||
@@ -560,36 +595,2 @@ var | ||
}, | ||
offstagePosition: function(position, calculations) { | ||
var | ||
offset = $popup.offset(), | ||
offstage = {}, | ||
offstagePositions = [], | ||
popup, | ||
boundary | ||
; | ||
position = position || false; | ||
calculations = calculations || module.get.calculations(); | ||
// shorthand | ||
popup = calculations.popup; | ||
boundary = calculations.boundary; | ||
if(offset && position) { | ||
offstage = { | ||
top : (offset.top < boundary.top), | ||
bottom : (offset.top + popup.height > boundary.bottom), | ||
right : (offset.left + popup.width > boundary.right), | ||
left : (offset.left < boundary.left) | ||
}; | ||
module.verbose('Offstage positions determined', offset, offstage); | ||
} | ||
// return only boundaries that have been surpassed | ||
$.each(offstage, function(direction, isOffstage) { | ||
if(isOffstage) { | ||
offstagePositions.push(direction); | ||
} | ||
}); | ||
return (offstagePositions.length > 0) | ||
? offstagePositions.join(' ') | ||
: false | ||
; | ||
}, | ||
positions: function() { | ||
@@ -680,6 +681,7 @@ return { | ||
parent, | ||
computedPosition, | ||
positioning, | ||
offstagePosition | ||
popupOffset, | ||
distanceFromBoundary | ||
; | ||
calculations = calculations || module.get.calculations(); | ||
@@ -729,4 +731,4 @@ position = position || $module.data(metadata.position) || settings.position; | ||
if(searchDepth == settings.maxSearchDepth && settings.lastResort) { | ||
module.debug('Using "last resort" position to display', settings.lastResort); | ||
// if last attempt use specified last resort position | ||
if(searchDepth == settings.maxSearchDepth && typeof settings.lastResort === 'string') { | ||
position = settings.lastResort; | ||
@@ -814,8 +816,10 @@ } | ||
; | ||
// check if is offstage | ||
offstagePosition = module.get.offstagePosition(position, calculations); | ||
// recursively find new positioning | ||
if(offstagePosition) { | ||
module.debug('Popup cant fit into viewport', position, offstagePosition); | ||
popupOffset = module.get.popupOffset(); | ||
// see if any boundaries are surpassed with this tentative position | ||
distanceFromBoundary = module.get.distanceFromBoundary(popupOffset, calculations); | ||
if( module.is.offstage(distanceFromBoundary, position) ) { | ||
module.debug('Position is outside viewport', position); | ||
if(searchDepth < settings.maxSearchDepth) { | ||
@@ -830,16 +834,22 @@ searchDepth++; | ||
} | ||
else if(!settings.lastResort) { | ||
module.debug('Popup could not find a position in view', $popup); | ||
// module.error(error.cannotPlace, element); | ||
module.remove.attempts(); | ||
module.remove.loading(); | ||
module.reset(); | ||
return false; | ||
else { | ||
if(settings.lastResort) { | ||
module.debug('No position found, showing with last position'); | ||
} | ||
else { | ||
module.debug('Popup could not find a position to display', $popup); | ||
module.error(error.cannotPlace, element); | ||
module.remove.attempts(); | ||
module.remove.loading(); | ||
module.reset(); | ||
return false; | ||
} | ||
} | ||
} | ||
module.debug('Position is on stage', position); | ||
module.remove.attempts(); | ||
module.set.fluidWidth(calculations); | ||
module.remove.loading(); | ||
if( settings.setFluidWidth && module.is.fluid() ) { | ||
module.set.fluidWidth(calculations); | ||
} | ||
return true; | ||
@@ -850,5 +860,4 @@ }, | ||
calculations = calculations || module.get.calculations(); | ||
if( settings.setFluidWidth && $popup.hasClass(className.fluid) ) { | ||
$popup.css('width', calculations.parent.width); | ||
} | ||
module.debug('Automatically setting element width to parent width', calculations.parent.width); | ||
$popup.css('width', calculations.container.width); | ||
}, | ||
@@ -970,2 +979,20 @@ | ||
is: { | ||
offstage: function(distanceFromBoundary, position) { | ||
var | ||
offstage = [] | ||
; | ||
// return boundaries that have been surpassed | ||
$.each(distanceFromBoundary, function(direction, distance) { | ||
if(distance < -settings.jitter) { | ||
module.debug('Position exceeds allowable distance from edge', direction, distance, position); | ||
offstage.push(direction); | ||
} | ||
}); | ||
if(offstage.length > 0) { | ||
return true; | ||
} | ||
else { | ||
return false; | ||
} | ||
}, | ||
active: function() { | ||
@@ -977,2 +1004,5 @@ return $module.hasClass(className.active); | ||
}, | ||
fluid: function() { | ||
return ( $popup && $popup.hasClass(className.fluid)); | ||
}, | ||
visible: function() { | ||
@@ -1282,2 +1312,5 @@ return $popup && $popup.hasClass(className.visible); | ||
// number of pixels an element is allowed to be "offstage" for a position to be chosen (allows for rounding) | ||
jitter : 2, | ||
// offset on aligning axis from calculated position | ||
@@ -1287,7 +1320,7 @@ offset : 0, | ||
// maximum times to look for a position before failing (9 positions total) | ||
maxSearchDepth : 20, | ||
maxSearchDepth : 15, | ||
error: { | ||
invalidPosition : 'The position you specified is not a valid position', | ||
cannotPlace : 'No visible position could be found for the popup', | ||
cannotPlace : 'Popup does not fit within the boundaries of the viewport', | ||
method : 'The method you called is not defined.', | ||
@@ -1294,0 +1327,0 @@ noTransition : 'This module requires ui transitions <https://github.com/Semantic-Org/UI-Transition>', |
@@ -123,3 +123,2 @@ /*! | ||
module.verbose('Destroying previous module for', $module); | ||
module.remove.direction(); | ||
$module | ||
@@ -126,0 +125,0 @@ .off(eventNamespace) |
@@ -240,4 +240,3 @@ /*! | ||
offset : $context.offset(), | ||
height : $context.outerHeight(), | ||
bottomPadding : parseInt($context.css('padding-bottom'), 10) | ||
height : $context.outerHeight() | ||
}, | ||
@@ -264,4 +263,3 @@ container = { | ||
height : context.height, | ||
bottomPadding : context.bottomPadding, | ||
bottom : context.offset.top + context.height - context.bottomPadding | ||
bottom : context.offset.top + context.height | ||
} | ||
@@ -462,4 +460,10 @@ }; | ||
module.debug('Element passed, fixing element to page'); | ||
module.fixTop(); | ||
if( (element.height + scroll.top - elementScroll) > context.bottom ) { | ||
module.bindBottom(); | ||
} | ||
else { | ||
module.fixTop(); | ||
} | ||
} | ||
} | ||
@@ -481,2 +485,4 @@ else if( module.is.fixed() ) { | ||
module.set.scroll(elementScroll); | ||
module.save.lastScroll(scroll.top); | ||
module.save.elementScroll(elementScroll); | ||
} | ||
@@ -501,2 +507,4 @@ } | ||
module.set.scroll(elementScroll); | ||
module.save.lastScroll(scroll.top); | ||
module.save.elementScroll(elementScroll); | ||
} | ||
@@ -521,6 +529,2 @@ | ||
} | ||
// save current scroll for next run | ||
module.save.lastScroll(scroll.top); | ||
module.save.elementScroll(elementScroll); | ||
}, | ||
@@ -551,4 +555,3 @@ | ||
left : '', | ||
top : '', | ||
marginBottom : module.cache.context.bottomPadding | ||
top : '' | ||
}) | ||
@@ -555,0 +558,0 @@ .removeClass(className.fixed) |
@@ -770,5 +770,5 @@ /*! | ||
module.set.hidden(); | ||
module.force.hidden(); | ||
settings.onHide.call(this); | ||
settings.onComplete.call(this); | ||
module.force.hidden(); | ||
// module.repaint(); | ||
@@ -781,5 +781,5 @@ }, | ||
module.set.visible(); | ||
module.force.visible(); | ||
settings.onShow.call(this); | ||
settings.onComplete.call(this); | ||
module.force.visible(); | ||
// module.repaint(); | ||
@@ -786,0 +786,0 @@ }, |
@@ -8,3 +8,3 @@ var | ||
summary : 'Semantic UI - LESS Release of Semantic UI', | ||
version : '2.0.3', | ||
version : '2.0.4', | ||
git : 'git://github.com/Semantic-Org/Semantic-UI-LESS.git', | ||
@@ -11,0 +11,0 @@ }); |
{ | ||
"name": "semantic-ui-less", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"title": "Semantic UI", | ||
@@ -5,0 +5,0 @@ "description": "LESS Only distribution of Semantic UI", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
2548417
20833
7