How to use mapData method in storybook-root

Best JavaScript code snippet using storybook-root

pickonmap.js

Source:pickonmap.js Github

copy

Full Screen

1/* ----------------------------------------------------------------------2 * js/google/pickonmap.js3 * ----------------------------------------------------------------------4 * CollectiveAccess5 * Open-source collections management software6 * ----------------------------------------------------------------------7 *8 * Software by Whirl-i-Gig (http://www.whirl-i-gig.com)9 * Copyright 2010-2012 Whirl-i-Gig10 *11 * For more information visit http://www.CollectiveAccess.org12 *13 * This program is free software; you may redistribute it and/or modify it under14 * the terms of the provided license as published by Whirl-i-Gig15 *16 * CollectiveAccess is distributed in the hope that it will be useful, but17 * WITHOUT ANY WARRANTIES whatsoever, including any implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 19 *20 * This source code is free and modifiable under the terms of 21 * GNU General Public License. (http://www.gnu.org/copyleft/gpl.html). See22 * the "license.txt" file for details, or visit the CollectiveAccess web site at23 * http://www.CollectiveAccess.org24 *25 * ----------------------------------------------------------------------26 */27 /**28 * Use initNewMap for a new map29 * Use initExiMap initialize an existing map again30 * Mapdata needs folowing properties to work fine:31 * mapID, mapholder, searchDefaultText, zoomlevel, initialLocation, map, geocoder, marker, markers, selectionIndex, coordinates(to init saved maps)32 */33 /**34 * 35 * @param mapdata36 * @param mapOptions37 * initializes a new map in the mapdata with the given mapoptions38 * 39 */40 function initNewMap(mapdata,mapOptions){41 mapdata.map = new google.maps.Map(jQuery(mapdata.mapholder).find('.map:first').get(0), mapOptions);42 /*****************************/43 /* GeoLocation functionality */44 /*****************************/45 function setDefaultLocation(mapdata) {46 mapdata.initialLocation = new google.maps.LatLng(0,0);47 centerMap(mapdata);48 mapdata.map.setZoom(1);49 }50 if(navigator.geolocation) {51 // Try W3C Geolocation method (Preferred)52 navigator.geolocation.getCurrentPosition(function(position) {53 mapdata.initialLocation = new google.maps.LatLng(position.coords.latitude,position.coords.longitude);54 centerMap(mapdata);55 mapdata.map.setZoom(mapdata.zoomlevel);56 }, function() {57 setDefaultLocation(mapdata);58 });59 } else if (google.gears) {60 // Try Google Gears Geolocation61 var geo = google.gears.factory.create('beta.geolocation');62 geo.getCurrentPosition(function(position) {63 mapdata.initialLocation = new google.maps.LatLng(position.latitude,position.longitude);64 centerMap(mapdata);65 mapdata.map.setZoom(mapdata.zoomlevel);66 }, function() {67 setDefaultLocation(mapdata);68 });69 } else {70 // Browser doesn't support Geolocation71 setDefaultLocation(mapdata);72 }73 74 /*********************************/75 /* End GeoLocation functionality */76 /*********************************/77 }78 79 /**80 * 81 * @param mapdata82 * @param mapOptions83 * 84 * initializes an existing map with the given mapoptions85 */86 function initExistingMap(mapdata,mapOptions){87 if (!mapdata) { return; }88 mapdata.map = new google.maps.Map(jQuery(mapdata.mapholder).find('.map:first').get(0), mapOptions);89 if (!mapdata.coordinates) { initNewMap(mapdata, mapOptions); return; }90 var re = /\[([\d\.\-,; ]+)\]/;91 if (!mapdata || !mapdata.coordinates) { return; }92 var latlong = re.exec(mapdata.coordinates)[1];93 var pointList = latlong.split(';');94 95 re = /^([^\[]*)/;96 jQuery(mapdata.mapholder).data('displayName', re.exec(mapdata.coordinates)[1]);97 98 if (pointList.length > 1) {99 var newmarkers = new Array();100 var westMostLong = null;eastMostLong = null;northMostLat = null;southMostLat = null;101 for(i=0; i < pointList.length; i++) {102 var tmp = pointList[i].split(',');103 var pt = new google.maps.LatLng(tmp[0], tmp[1]);104 if((eastMostLong >= tmp[1]) || (eastMostLong === null)) {105 eastMostLong = tmp[1];106 }107 if((westMostLong <= tmp[1]) || (westMostLong === null)) {108 westMostLong = tmp[1];109 }110 if((northMostLat >= tmp[0]) || (northMostLat === null)) {111 northMostLat = tmp[0];112 }113 if((southMostLat <= tmp[0]) || (southMostLat === null)) {114 southMostLat = tmp[0];115 }116 var mark = new google.maps.Marker({117 position: pt, 118 map: mapdata.map,119 zIndex: i120 }); 121 newmarkers.push(mark);122 mapdata.markers = newmarkers;123 }124 var bounds = new google.maps.LatLngBounds(new google.maps.LatLng(southMostLat, westMostLong), new google.maps.LatLng(northMostLat, eastMostLong));125 mapdata.map.fitBounds(bounds);126 127 jQuery(mapdata.mapholder).find('.mapKMLInput:first').show();128 jQuery(mapdata.mapholder).find('.mapCoordInput:first').hide();129 jQuery(mapdata.mapholder).find('.map:first').show();130 } else {131 var tmppoints = pointList[0].split(',');132 placeMarker(mapdata, tmppoints[0], tmppoints[1]);133 }134 }135 136 /* Place marker at location */137 function placeMarker(mapdata, lat, lng) {138 removeMarker(mapdata);139 mapdata.marker = new google.maps.Marker({140 position: new google.maps.LatLng(lat, lng, true),141 map: mapdata.map,142 draggable: true143 });144 setMarkerEventListeners(mapdata);145 showMarker(mapdata);146 }147 148 /* Set the event listeners for the marker */149 function setMarkerEventListeners(mapdata) {150 /* Click on map: place marker */151 google.maps.event.addListener(mapdata.map, 'click', function(event) {152 placeMarker(mapdata,event.latLng.lat(), event.latLng.lng());153 });154 if (mapdata.marker) {155 /* Click on marker: remove marker */156 google.maps.event.addListener(mapdata.marker, 'click', function() {157 removeMarker(mapdata);158 updateCoordinates(mapdata);159 });160 /* Drag marker: update coordinates */161 google.maps.event.addListener(mapdata.marker, 'position_changed', function() {162 updateCoordinates(mapdata);163 });164 /* Drag marker end: center map on marker */165 google.maps.event.addListener(mapdata.marker, 'dragend', function() {166 centerMapOnMarker(mapdata);167 });168 }169 }170 /*****************************/171 /* Google Maps functionality */172 /*****************************/173 /**174 * Initializes the rest of the app, containing the google maps objects175 */176 function initMapsApp(mapdata){177 /* Initialization of the geocoder */178 mapdata.geocoder = new google.maps.Geocoder();179 mapsInitializeEvents(mapdata);180 }181 /* Show marker on map, if marker exists */182 function showMarker(mapdata) {183 if (mapdata.marker) {184 mapdata.marker.setMap(mapdata.map);185 }186 centerMapOnMarker(mapdata);187 updateCoordinates(mapdata);188 }189 /* Update the coordinates */190 function updateCoordinates(mapdata) {191 if (mapdata.marker) {192 setCoordinates(mapdata,mapdata.marker.getPosition().lat(), mapdata.marker.getPosition().lng());193 } else {194 setCoordinates(mapdata,null, null);195 }196 }197 /* Center the map on the marker */198 function centerMapOnMarker(mapdata) {199 centerMapLocation(mapdata,mapdata.marker.position);200 }201 /* Center the map on location */202 function centerMap(mapdata) {203 centerMapLocation(mapdata,mapdata.initialLocation);204 }205 function centerMapLocation(mapdata,location) {206 if (mapdata.map) {207 mapdata.map.setCenter(location);208 }209 }210 /* Check if a string is a valid string of coordinates: 'latitude, longitude' --> if so, return LatLng */211 function checkValidCoordinatesString(string) {212 string = string.replace(/ /g, ''); // remove all spaces213 var reg = new RegExp('[-]?[0-9]{1,2}[.]{0,1}[0-9]{0,6}[,][-]?[0-9]{1,3}[.]{0,1}[0-9]{0,6}');214 if (reg.test(string)) {215 string = string.split(',');216 var lat = parseFloat(string[0]);217 var lng = parseFloat(string[1]);218 /*219 * Latitude: -90.000000 to 90.000000220 * Longitude: -180.000000 to 180.000000221 */222 if (Math.abs(lat) <= 90.0 && Math.abs(lng) <= 180.0) {223 return new google.maps.LatLng(lat, lng);224 } else {225 return null;226 }227 } else {228 return null;229 }230 }231 /* Get XML for the search text on google maps */232 function searchGoogleMaps(mapdata,searchText) {233 clearSuggestions(mapdata);234 if (mapdata.geocoder && searchText.length > 1 && searchText != mapdata.searchDefaultText) {235 var latLng = checkValidCoordinatesString(searchText);236 if (latLng) {237 var suggestionLatLng = '<div class="mapSuggestLink">' + latLng.lat() + ', ' + latLng.lng() + '<span>' + latLng.lat() + '</span><span>' + latLng.lng() + '</span></div>';238 jQuery(mapdata.mapholder).find('.mapSearchSuggest:first').append(suggestionLatLng);239 mapdata.geocoder.geocode({'latLng': latLng}, function(results, status) {240 if (results.length > 0) {241 handleResponse(mapdata,results, status);242 } else { // doMakeUp: because otherwise the suggestionLatLng won't be visible!243 doMakeUp(mapdata);244 }245 });246 } else {247 mapdata.geocoder.geocode({'address': formatSearchText(searchText)}, function(results, status) {248 handleResponse(mapdata,results, status);249 });250 }251 } else {252 clearSuggestions(mapdata);253 }254 }255 function handleResponse(mapdata,results, status) {256 if (status == google.maps.GeocoderStatus.OK) {257 var suggestions = '';258 for (var i = 0; i < results.length; i++) {259 var lat = results[i].geometry.location.lat();260 var lng = results[i].geometry.location.lng();261 var address = results[i].formatted_address;262 suggestions += '<div class="mapSuggestLink">' + address + '<span>' + lat + '</span><span>' + lng + '</span></div>';263 }264 jQuery(mapdata.mapholder).find('.mapSearchSuggest:first').append(suggestions);265 doMakeUp(mapdata);266 } else {267 clearSuggestions(mapdata);268 }269 }270 function findSelectedSuggest(mapdata) {271 var selected = mapdata.mapholder.find('.mapSearchSuggest:first').find('.selected:first'); 272 if (selected) { 273 var lat = jQuery(selected).find('span:first').text(); 274 var lng = jQuery(selected).find('span:last').text();275 jQuery(selected).find('span').remove(); 276 jQuery(mapdata.mapholder).data('displayName', selected.text());277 placeMarker(mapdata,lat, lng); 278 279 jQuery(mapdata.mapholder).find('.mapSearchText:first').val(selected.text());280 }281 clearSuggestions(mapdata); 282 }283 function doMakeUp(mapdata) {284 jQuery(mapdata.mapholder).find('.mapSearchSuggest:first').css('display', 'block');285 jQuery(mapdata.mapholder).find('.mapSuggestLink').find('span').css({'display': 'none'});286 jQuery(mapdata.mapholder).find('.mapSuggestLink').css({'padding': '3px 5px', 'cursor': 'pointer'});287 }288 /*********************************/289 /* End Google Maps functionality */290 /*********************************/291 292 function mapsInitializeEvents(mapdata){293 jQuery(mapdata.mapholder).find('.mapSearchText:first').blur(function() {294 setDefaultText(this, mapdata.searchDefaultText);295 });296 297 /**298 * when click on field of searchtext, clear the field299 */300 jQuery(mapdata.mapholder).find('.mapSearchText:first').click(function() {301 clearDefaultText(this, mapdata.searchDefaultText);302 });303 jQuery(mapdata.mapholder).find('.mapSearchSuggest:first').css({304 'background-color': '#FFF',305 'border': '1px solid #000',306 'font-size': '0.85em',307 'position': 'absolute',308 'z-index': '1',309 'display': 'none'310 });311 312 313 jQuery(mapdata.mapholder).find('.mapSuggestLink').live('click mouseover mouseout', function(event) {314 if (event.type == 'click') {315 jQuery(this).attr("class",".mapSuggestLink selected");316 findSelectedSuggest(mapdata);317 } else if (event.type == 'mouseover') {318 setSelectedSuggest(mapdata,jQuery('#mapSearchSuggest .mapSuggestLink').index(jQuery(this)));319 } else {320 setSelectedSuggest(mapdata,-1); 321 }322 });323 324 /**325 * append keyevents for autosuggest326 */327 jQuery(mapdata.mapholder).find('.mapSearchText:first').keydown(function (e) {328 var keyCode = e.keyCode || e.which,329 arrow = {tab: 9, enter: 13, up: 38, down: 40 };330 switch (keyCode) {331 case arrow.tab:332 findSelectedSuggest(mapdata);333 break;334 case arrow.enter:335 findSelectedSuggest(mapdata);336 break;337 case arrow.up:338 navigateSuggestions(mapdata,'up');339 break;340 case arrow.down:341 navigateSuggestions(mapdata,'down');342 break;343 default:344 jQuery(this).stopTime('suggest').oneTime(1000, 'suggest', function() {345 searchGoogleMaps(mapdata,jQuery(this).val());346 });347 break;348 }349 });350 jQuery(mapdata.mapholder).find('.mapCoordInput:first').find('a:first').click(function(event) {351 event.preventDefault();352 jQuery(this).parent().hide(200, function() {353 jQuery(mapdata.mapholder).find('.mapKMLInput:first').slideDown(200);354 });355 jQuery(mapdata.mapholder).find('.map:first').hide(200);356 cleanMap(mapdata);357 });358 359 jQuery(mapdata.mapholder).find('.mapKMLInput:first').find('a:first').click(function(event) {360 event.preventDefault();361 jQuery(this).parent().hide(200, function() {362 jQuery(mapdata.mapholder).find('.mapCoordInput:first .mapSearchBox').slideDown(200);363 jQuery(mapdata.mapholder).find('.map:first').slideDown(200);364 });365 cleanMap(mapdata);366 });367 }368 369 /* Set the coordinates */370 function setCoordinates(mapdata, lat, lng) {371 if (lat && lng) {372 var displayName = jQuery(mapdata.mapholder).data('displayName');373 if (!displayName) { displayName = ''; }374 jQuery(mapdata.mapholder).find('.coordinates:first').val(displayName + ' [' + lat + ', ' + lng + ']');375 } else {376 jQuery(mapdata.mapholder).find('.coordinates:first').val('');377 }378 }379 /* Format the search text */380 function formatSearchText(searchText) {381 var formatted = searchText;382 formatted = formatted.replace(/ /g, '+');383 formatted = formatted.replace(/\n/g, '');384 formatted = formatted.replace(/\r/g, '');385 return formatted;386 }387 388 function navigateSuggestions(mapdata,direction) {389 var suggestSize = jQuery(mapdata.mapholder).find('.mapSearchSuggest:first').children().size();390 if (direction == 'down' && mapdata.selectionIndex < (suggestSize - 1)) {391 mapdata.selectionIndex++; // go one item down 392 } else if (direction == 'up' && mapdata.selectionIndex == -1) {393 mapdata.selectionIndex = suggestSize - 1; // go to last item394 } else if (direction == 'up' && mapdata.selectionIndex > -1) {395 mapdata.selectionIndex--; // go one item up 396 } else { 397 mapdata.selectionIndex = -1; 398 }399 setSelectedSuggest(mapdata,mapdata.selectionIndex); 400 }401 402 function setSelectedSuggest(mapdata,index) { 403 jQuery(mapdata.mapholder).find('.mapSuggestLink').css({'background-color': 'transparent'}); 404 jQuery(mapdata.mapholder).find('.mapSuggestLink').removeClass('selected'); 405 var suggestSize = jQuery(mapdata.mapholder).find('.mapSearchSuggest:first').children().size(); 406 if (index < suggestSize && index > -1) { 407 jQuery(mapdata.mapholder).find('.mapSuggestLink').eq(index).css({'background-color': '#D5DDF3'}); 408 jQuery(mapdata.mapholder).find('.mapSuggestLink').eq(index).addClass('selected'); 409 } 410 } 411 412 function clearSuggestions(mapdata) {413 jQuery(mapdata.mapholder).find('.mapSearchSuggest:first').css('display', 'none');414 jQuery(mapdata.mapholder).find('.mapSearchSuggest:first').empty();415 }416 function clearDefaultText(thisI, defaultText) {417 if (thisI.value == defaultText) {418 thisI.value = '';419 }420 }421 function setDefaultText(thisI, defaultText) {422 if (thisI.value == '') {423 thisI.value = defaultText;424 }425 }426 427 function cleanMap(mapdata) {428 removeMarker(mapdata);429 for (i = 0; i < mapdata.markers.length; i++) {430 mapdata.markers[i].setMap(null);431 }432 }433 434 /* Remove marker from map, if marker exists */435 function removeMarker(mapdata) {436 if (mapdata.marker) {437 mapdata.marker.setMap(null);438 }439 mapdata.marker = null;...

Full Screen

Full Screen

source-map-resolve-node.js

Source:source-map-resolve-node.js Github

copy

Full Screen

1// Copyright 2014, 2015, 2016, 2017 Simon Lydell2// X11 (“MIT”) Licensed. (See LICENSE.)3var sourceMappingURL = require("source-map-url")4var resolveUrl = require("./resolve-url")5var decodeUriComponent = require("./decode-uri-component")6var urix = require("urix")7var atob = require("atob")8function callbackAsync(callback, error, result) {9 setImmediate(function() { callback(error, result) })10}11function parseMapToJSON(string, data) {12 try {13 return JSON.parse(string.replace(/^\)\]\}'/, ""))14 } catch (error) {15 error.sourceMapData = data16 throw error17 }18}19function readSync(read, url, data) {20 var readUrl = decodeUriComponent(url)21 try {22 return String(read(readUrl))23 } catch (error) {24 error.sourceMapData = data25 throw error26 }27}28function resolveSourceMap(code, codeUrl, read, callback) {29 var mapData30 try {31 mapData = resolveSourceMapHelper(code, codeUrl)32 } catch (error) {33 return callbackAsync(callback, error)34 }35 if (!mapData || mapData.map) {36 return callbackAsync(callback, null, mapData)37 }38 var readUrl = decodeUriComponent(mapData.url)39 read(readUrl, function(error, result) {40 if (error) {41 error.sourceMapData = mapData42 return callback(error)43 }44 mapData.map = String(result)45 try {46 mapData.map = parseMapToJSON(mapData.map, mapData)47 } catch (error) {48 return callback(error)49 }50 callback(null, mapData)51 })52}53function resolveSourceMapSync(code, codeUrl, read) {54 var mapData = resolveSourceMapHelper(code, codeUrl)55 if (!mapData || mapData.map) {56 return mapData57 }58 mapData.map = readSync(read, mapData.url, mapData)59 mapData.map = parseMapToJSON(mapData.map, mapData)60 return mapData61}62var dataUriRegex = /^data:([^,;]*)(;[^,;]*)*(?:,(.*))?$/63var jsonMimeTypeRegex = /^(?:application|text)\/json$/64function resolveSourceMapHelper(code, codeUrl) {65 codeUrl = urix(codeUrl)66 var url = sourceMappingURL.getFrom(code)67 if (!url) {68 return null69 }70 var dataUri = url.match(dataUriRegex)71 if (dataUri) {72 var mimeType = dataUri[1]73 var lastParameter = dataUri[2] || ""74 var encoded = dataUri[3] || ""75 var data = {76 sourceMappingURL: url,77 url: null,78 sourcesRelativeTo: codeUrl,79 map: encoded80 }81 if (!jsonMimeTypeRegex.test(mimeType)) {82 var error = new Error("Unuseful data uri mime type: " + (mimeType || "text/plain"))83 error.sourceMapData = data84 throw error85 }86 data.map = parseMapToJSON(87 lastParameter === ";base64" ? atob(encoded) : decodeURIComponent(encoded),88 data89 )90 return data91 }92 var mapUrl = resolveUrl(codeUrl, url)93 return {94 sourceMappingURL: url,95 url: mapUrl,96 sourcesRelativeTo: mapUrl,97 map: null98 }99}100function resolveSources(map, mapUrl, read, options, callback) {101 if (typeof options === "function") {102 callback = options103 options = {}104 }105 var pending = map.sources ? map.sources.length : 0106 var result = {107 sourcesResolved: [],108 sourcesContent: []109 }110 if (pending === 0) {111 callbackAsync(callback, null, result)112 return113 }114 var done = function() {115 pending--116 if (pending === 0) {117 callback(null, result)118 }119 }120 resolveSourcesHelper(map, mapUrl, options, function(fullUrl, sourceContent, index) {121 result.sourcesResolved[index] = fullUrl122 if (typeof sourceContent === "string") {123 result.sourcesContent[index] = sourceContent124 callbackAsync(done, null)125 } else {126 var readUrl = decodeUriComponent(fullUrl)127 read(readUrl, function(error, source) {128 result.sourcesContent[index] = error ? error : String(source)129 done()130 })131 }132 })133}134function resolveSourcesSync(map, mapUrl, read, options) {135 var result = {136 sourcesResolved: [],137 sourcesContent: []138 }139 if (!map.sources || map.sources.length === 0) {140 return result141 }142 resolveSourcesHelper(map, mapUrl, options, function(fullUrl, sourceContent, index) {143 result.sourcesResolved[index] = fullUrl144 if (read !== null) {145 if (typeof sourceContent === "string") {146 result.sourcesContent[index] = sourceContent147 } else {148 var readUrl = decodeUriComponent(fullUrl)149 try {150 result.sourcesContent[index] = String(read(readUrl))151 } catch (error) {152 result.sourcesContent[index] = error153 }154 }155 }156 })157 return result158}159var endingSlash = /\/?$/160function resolveSourcesHelper(map, mapUrl, options, fn) {161 options = options || {}162 mapUrl = urix(mapUrl)163 var fullUrl164 var sourceContent165 var sourceRoot166 for (var index = 0, len = map.sources.length; index < len; index++) {167 sourceRoot = null168 if (typeof options.sourceRoot === "string") {169 sourceRoot = options.sourceRoot170 } else if (typeof map.sourceRoot === "string" && options.sourceRoot !== false) {171 sourceRoot = map.sourceRoot172 }173 // If the sourceRoot is the empty string, it is equivalent to not setting174 // the property at all.175 if (sourceRoot === null || sourceRoot === '') {176 fullUrl = resolveUrl(mapUrl, map.sources[index])177 } else {178 // Make sure that the sourceRoot ends with a slash, so that `/scripts/subdir` becomes179 // `/scripts/subdir/<source>`, not `/scripts/<source>`. Pointing to a file as source root180 // does not make sense.181 fullUrl = resolveUrl(mapUrl, sourceRoot.replace(endingSlash, "/"), map.sources[index])182 }183 sourceContent = (map.sourcesContent || [])[index]184 fn(fullUrl, sourceContent, index)185 }186}187function resolve(code, codeUrl, read, options, callback) {188 if (typeof options === "function") {189 callback = options190 options = {}191 }192 if (code === null) {193 var mapUrl = codeUrl194 var data = {195 sourceMappingURL: null,196 url: mapUrl,197 sourcesRelativeTo: mapUrl,198 map: null199 }200 var readUrl = decodeUriComponent(mapUrl)201 read(readUrl, function(error, result) {202 if (error) {203 error.sourceMapData = data204 return callback(error)205 }206 data.map = String(result)207 try {208 data.map = parseMapToJSON(data.map, data)209 } catch (error) {210 return callback(error)211 }212 _resolveSources(data)213 })214 } else {215 resolveSourceMap(code, codeUrl, read, function(error, mapData) {216 if (error) {217 return callback(error)218 }219 if (!mapData) {220 return callback(null, null)221 }222 _resolveSources(mapData)223 })224 }225 function _resolveSources(mapData) {226 resolveSources(mapData.map, mapData.sourcesRelativeTo, read, options, function(error, result) {227 if (error) {228 return callback(error)229 }230 mapData.sourcesResolved = result.sourcesResolved231 mapData.sourcesContent = result.sourcesContent232 callback(null, mapData)233 })234 }235}236function resolveSync(code, codeUrl, read, options) {237 var mapData238 if (code === null) {239 var mapUrl = codeUrl240 mapData = {241 sourceMappingURL: null,242 url: mapUrl,243 sourcesRelativeTo: mapUrl,244 map: null245 }246 mapData.map = readSync(read, mapUrl, mapData)247 mapData.map = parseMapToJSON(mapData.map, mapData)248 } else {249 mapData = resolveSourceMapSync(code, codeUrl, read)250 if (!mapData) {251 return null252 }253 }254 var result = resolveSourcesSync(mapData.map, mapData.sourcesRelativeTo, read, options)255 mapData.sourcesResolved = result.sourcesResolved256 mapData.sourcesContent = result.sourcesContent257 return mapData258}259module.exports = {260 resolveSourceMap: resolveSourceMap,261 resolveSourceMapSync: resolveSourceMapSync,262 resolveSources: resolveSources,263 resolveSourcesSync: resolveSourcesSync,264 resolve: resolve,265 resolveSync: resolveSync,266 parseMapToJSON: parseMapToJSON...

Full Screen

Full Screen

echarts-optimize-conf.js

Source:echarts-optimize-conf.js Github

copy

Full Screen

1exports.modules = {2 main: {3 name: 'echarts/echarts',4 includeShallow: [5 'echarts/component/dataRange'6 ]7 },8 parts: [9 {name: 'echarts/chart/line', weight: 100},10 {name: 'echarts/chart/bar', weight: 100},11 {name: 'echarts/chart/scatter', weight: 90},12 {name: 'echarts/chart/k', weight: 30},13 {name: 'echarts/chart/pie', weight: 90},14 {name: 'echarts/chart/radar', weight: 30},15 {name: 'echarts/chart/chord', weight: 30},16 {name: 'echarts/chart/force', weight: 30},17 {18 name: 'echarts/chart/map',19 weight: 90,20 includeShallow: [21 'echarts/util/mapData/geoJson/an_hui_geo',22 'echarts/util/mapData/geoJson/ao_men_geo',23 'echarts/util/mapData/geoJson/bei_jing_geo',24 'echarts/util/mapData/geoJson/china_geo',25 'echarts/util/mapData/geoJson/chong_qing_geo',26 'echarts/util/mapData/geoJson/fu_jian_geo',27 'echarts/util/mapData/geoJson/gan_su_geo',28 'echarts/util/mapData/geoJson/guang_dong_geo',29 'echarts/util/mapData/geoJson/guang_xi_geo',30 'echarts/util/mapData/geoJson/gui_zhou_geo',31 'echarts/util/mapData/geoJson/hai_nan_geo',32 'echarts/util/mapData/geoJson/hei_long_jiang_geo',33 'echarts/util/mapData/geoJson/he_bei_geo',34 'echarts/util/mapData/geoJson/he_nan_geo',35 'echarts/util/mapData/geoJson/hu_bei_geo',36 'echarts/util/mapData/geoJson/hu_nan_geo',37 'echarts/util/mapData/geoJson/jiang_su_geo',38 'echarts/util/mapData/geoJson/jiang_xi_geo',39 'echarts/util/mapData/geoJson/ji_lin_geo',40 'echarts/util/mapData/geoJson/liao_ning_geo',41 'echarts/util/mapData/geoJson/nei_meng_gu_geo',42 'echarts/util/mapData/geoJson/ning_xia_geo',43 'echarts/util/mapData/geoJson/qing_hai_geo',44 'echarts/util/mapData/geoJson/shang_hai_geo',45 'echarts/util/mapData/geoJson/shan_dong_geo',46 'echarts/util/mapData/geoJson/shan_xi_1_geo',47 'echarts/util/mapData/geoJson/shan_xi_2_geo',48 'echarts/util/mapData/geoJson/si_chuan_geo',49 'echarts/util/mapData/geoJson/tai_wan_geo',50 'echarts/util/mapData/geoJson/tian_jin_geo',51 'echarts/util/mapData/geoJson/world_geo',52 'echarts/util/mapData/geoJson/xiang_gang_geo',53 'echarts/util/mapData/geoJson/xin_jiang_geo',54 'echarts/util/mapData/geoJson/xi_zang_geo',55 'echarts/util/mapData/geoJson/yun_nan_geo',56 'echarts/util/mapData/geoJson/zhe_jiang_geo'57 ]58 },59 {name: 'echarts/chart/gauge', weight: 30},60 {name: 'echarts/chart/funnel', weight: 30},61 {name: 'echarts/chart/eventRiver', weight: 10},62 {name: 'echarts/chart/venn', weight: 10},63 {name: 'echarts/chart/treemap', weight: 10},64 {name: 'echarts/chart/tree', weight: 10},65 {name: 'echarts/chart/wordCloud', weight: 10},66 {name: 'echarts/chart/heatmap', weight: 10, includeShallow: [67 'echarts/layer/heatmap'68 ]}69 ]70};71exports.amd = {72 baseUrl: process.cwd(),73 packages: [74 {75 name: 'echarts',76 location: '../src',77 main: 'echarts'78 },79 {80 name: 'zrender',81 location: '../../zrender/src',82 main: 'zrender'83 }84 ]...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { mapData } from 'storybook-root';2import { mapData } from 'storybook-root';3import { mapData } from 'storybook-root';4import { mapData } from 'storybook-root';5import { mapData } from 'storybook-root';6import { mapData } from 'storybook-root';7import { mapData } from 'storybook-root';8import { mapData } from 'storybook-root';9import { mapData } from 'storybook-root';10import { mapData } from 'storybook-root';11import { mapData } from 'storybook-root';12import { mapData } from 'storybook-root';13import { mapData } from 'storybook-root';14import { mapData } from 'storybook-root';15import { mapData } from 'storybook-root';16import { mapData } from 'storybook-root';17import { mapData } from 'storybook-root';18import { mapData } from 'storybook-root';19import { mapData } from 'storybook-root';20import { mapData } from 'storybook-root';

Full Screen

Using AI Code Generation

copy

Full Screen

1import React from 'react';2import { storiesOf } from '@storybook/react';3import { mapData } from 'storybook-root';4import { withKnobs, text } from '@storybook/addon-knobs';5storiesOf('Test', module)6.addDecorator(withKnobs)7.add('Test', () => {8const data = mapData('data.json');9return (10{data.map(item => (11<div>{item.title}</div>12))}13);14});15{16}17Your name to display (optional):18Your name to display (optional):19import React from 'react';20import { storiesOf } from '@storybook/react';21import { withKnobs, text } from '@storybook/addon-knobs';22import data from './data.json';23storiesOf('Test', module)24.addDecorator(withKnobs)25.add('Test', () => {26return (27{data.map(item => (28<div>{item.title}</div>29))}30);31});32Your name to display (optional):

Full Screen

Using AI Code Generation

copy

Full Screen

1import {mapData} from 'storybook-root';2import {storiesOf} from '@storybook/react';3import React from 'react';4import {withKnobs, text, boolean} from '@storybook/addon-knobs';5import {withInfo} from '@storybook/addon-info';6import {action} from '@storybook/addon-actions';7import {Button} from 'storybook-root';8const stories = storiesOf('Button', module);9stories.addDecorator(withKnobs);10stories.addDecorator(withInfo);11stories.add('Button', () => {12 const label = text('Label', 'Click Me');13 const disabled = boolean('Disabled', false);14 return <Button label={label} disabled={disabled} onClick={action('button-click')} />;15});16stories.add('Button with mapData', () => {17 const label = mapData('Button', 'Label', 'Click Me');18 const disabled = mapData('Button', 'Disabled', false);19 return <Button label={label} disabled={disabled} onClick={action('button-click')} />;20});21import {addStory, addStories} from 'storybook-root';22import {storiesOf} from '@storybook/react';23import React from 'react';24import {withKnobs, text, boolean} from '@storybook/addon-knobs';25import {withInfo} from '@storybook/addon-info';26import {action} from '@storybook/addon-actions';27import {Button} from 'storybook-root';28addStory('Button', 'Button', () => {29 const label = text('Label', 'Click Me');30 const disabled = boolean('Disabled', false);31 return <Button label={label} disabled={disabled} onClick={action('button-click')} />;32});33addStories('Button', {34 'Button': () => {35 const label = text('Label', 'Click Me');36 const disabled = boolean('Disabled', false);37 return <Button label={label} disabled={disabled} onClick={action('button-click')} />;38 },39 'Button with mapData': () => {40 const label = mapData('Button', 'Label', 'Click Me');41 const disabled = mapData('Button', 'Disabled', false);42 return <Button label={label} disabled={disabled} onClick={action('button-click')} />;43 }44});45{

Full Screen

Using AI Code Generation

copy

Full Screen

1const { mapData } = require('storybook-root');2const data = {3};4const mappedData = mapData(data);5console.log(mappedData);6const { mapData } = require('storybook-root');7const data = {8};9const mappedData = mapData(data);10console.log(mappedData);

Full Screen

Using AI Code Generation

copy

Full Screen

1import { mapData } from 'storybook-root';2const data = mapData('data.json');3console.log(data);4{5 "car": {6 }7}8{9 "car": {10 }11}12{13 "car": {14 }15}16{17 "car": {18 }19}20{21 "car": {22 }23}24{25 "car": {26 }27}28{29 "car": {30 }31}32{33 "car": {34 }35}36{37 "car": {38 }39}40{41 "car": {42 }43}44{45 "car": {46 }47}48{

Full Screen

Using AI Code Generation

copy

Full Screen

1import { mapData } from 'storybook-root'2const data = mapData({ test: 'test' })3console.log(data)4import { mapData } from 'storybook-root'5const data = mapData({ test: 'test' })6console.log(data)7import { mapData } from 'storybook-root'8const data = mapData({ test: 'test' })9console.log(data)10import { mapData } from 'storybook-root'11const data = mapData({ test: 'test' })12console.log(data)13import { mapData } from 'storybook-root'14const data = mapData({ test: 'test' })15console.log(data)16import { mapData } from 'storybook-root'17const data = mapData({ test: 'test' })18console.log(data)19import { mapData } from 'storybook-root'20const data = mapData({ test: 'test' })21console.log(data)22import { mapData } from 'storybook-root'23const data = mapData({ test: 'test' })24console.log(data)25import { mapData } from 'storybook-root'26const data = mapData({ test: 'test' })27console.log(data)28import { mapData } from 'storybook-root'29const data = mapData({ test: 'test' })30console.log(data)31import { mapData } from 'storybook-root'32const data = mapData({ test: 'test' })33console.log(data)34import { mapData } from 'storybook-root'

Full Screen

Using AI Code Generation

copy

Full Screen

1import { mapData } from 'storybook-root';2const data = mapData('test', 'test', 'test');3import { mapData } from 'storybook-root';4const data = mapData('test2', 'test2', 'test2');5import { mapData } from 'storybook-root';6const data = mapData('test3', 'test3', 'test3');7import { mapData } from 'storybook-root';8const data = mapData('test4', 'test4', 'test4');9import { mapData } from 'storybook-root';10const data = mapData('test5', 'test5', 'test5');11import { mapData } from 'storybook-root';12const data = mapData('test6', 'test6', 'test6');13import { mapData } from 'storybook-root';14const data = mapData('test7', 'test7', 'test7');15import { mapData } from 'storybook-root';16const data = mapData('test8', 'test8', 'test8');17import

Full Screen

Using AI Code Generation

copy

Full Screen

1import { mapData } from 'storybook-root'2export const mapData = () => {3 const data = {4 address: {5 }6 }7 return mapData(data, {8 address: {9 }10 })11}12import { storiesOf } from '@storybook/react'13import { mapData } from 'storybook-root'14storiesOf('Test', module)15 .add('default', () => {16 return (17 {mapData().id}18 {mapData().name}19 {mapData().address.street}20 {mapData().address.city}21 {mapData().address.state}22 {mapData().address.zipCode}23 })24import { storiesOf } from '@storybook/react'25import { mapData } from 'storybook-root'26storiesOf('Test', module)27 .add('default', () => {28 return (29 {mapData().id}30 {mapData().name}31 {mapData().address.street}32 {mapData().address.city}33 {mapData().address.state}34 {mapData().address.zipCode}35 })

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run storybook-root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful