npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@txdot-gis/txdot-toolbox-js

v1.0.18

Published

Shared processing and web map functions for TxDOT applications

Downloads

37

Readme

txdot-toolbox-js

Shared processing and web map JS functions for TxDOT applications alongside shared styling properties and content (e.g. logos)

Overview

TxDOT uses a variety of shared functionality and styling across web applications and sites. This package serves as a toolbox with these JS functions and CSS styling properties for easy import and use.

The styling properties are created both from classic CSS and modern SCSS but unique and are not duplicated in either. They are each organized in their respective folders src/style/css and src/style/scss. Individual files in each folder are recognized via import in their folder's _index.scss file. All TxDOT styling classes are named with prefix txdot-.

The JS tools available in this package are organized by subfolder under the primary package variable txdotToolbox. Call them via dot notation from the package variable. Their specific argument requirement documentation can be found in their specific function file (i.e. src/<subfolder>/<function file>.js).
They include:

└── txdotToolbox
    ├── spm
    │   ├── jumpToGoogle(lat, lon, level)
    │   ├── jumpToGoogleEsri(mapView)
    │   ├── jumpToSpm(lat, lon, level, points, routes)
    │   ├── jumpToSpmEsri(mapView, points, routes)
    │   └── jumpToSrd(routeId, beginDfo, endDfo, attributes)
    ├── elrs
    │   ├── buildPointGeoJson(convertedData)
    │   └── buildLineGeoJson(routes)
    ├── logo
    │   ├── cdnUrl(logoItem)
    │   ├── icon
    │   │   ├── black
    │   │   │   └── jpg
    │   │   ├── blue
    │   │   │   ├── jpg
    │   │   │   ├── png
    │   │   │   └── svg
    │   │   ├── cmyk
    │   │   │   └── jpg
    │   │   ├── gray
    │   │   │   └── jpg
    │   │   ├── rgb
    │   │   │   ├── png
    │   │   │   └── svg
    │   │   └── white
    │   │       ├── png
    │   │       └── svg
    │   ├── square
    │   │   └── <...same as icon>
    │   ├── wide
    │   │   └── <...same as icon>
    │   └── misc
    │       ├── architect
    │       │   ├── png
    │       │   ├── blue
    │       │   │   ├── png
    │       │   │   └── square
    │       │   ├── compass
    │       │   │   └── black
    │       │   └── globe
    │       │       ├── black
    │       │       └── white
    │       ├── darrelBarrel
    │       │   └── svg
    │       ├── dataDictionary
    │       │   └── png
    │       ├── dataDictionaryPdf
    │       │   └── png
    │       ├── elrs
    │       │   └── png
    │       ├── geolab
    │       │   └── png
    │       ├── openDataPoral
    │       │   └── svg
    │       └── r2d2
    │           └── png
    └── tailwind 
        └── config

Usage

Install

npm install @txdot-gis/txdot-toolbox-js --save

Basic ES6 Usage

To make styling available, import style.css in entry .css or .js file. If tailwind is installed and being used in your project, this will enable preprocessed styling classes.

/* index.css */
@import url('@txdot-gis/txdot-toolbox-js/dist/style.css');

OR

// index.js
import '@txdot-gis/txdot-toolbox-js/dist/style.css'

THEN

<!-- index.html -->
<div id='scss-example'>
	<button type='button' className='background text'>SCSS Example</button>
</div>
<div>
	<button type='button' className='css-example'>CSS Example</button>
</div>

To access functions, import the npm package

import { spm } from '@txdot-gis/txdot-toolbox-js' // all JS objects and functions available through individual import

...

const latitude = 29.212940817521442
const longitude = -103.28362089838606
const zoomLevel = 9

spm.jumpToGoogle(latitude, longitude, zoomLevel)

Basic CDN Usage

<head>
	<link rel="stylesheet" href="https://unpkg.com/@txdot-gis/txdot-toolbox-js@latest/dist/style.css" /> <!-- source CSS -->
	<script src="https://unpkg.com/@txdot-gis/txdot-toolbox-js@latest/dist/index.js"></script> <!-- source JS -->
	
	<script >
		const latitude = 29.212940817521442
		const longitude = -103.28362089838606
		const zoomLevel = 9

		const jumpGoogleListener = document.querySelector('#jumpToGoogle')
		jumpGoogleListener.addEventListener('click', (event) => {
			txdotToolbox.spm.jumpToGoogle(latitude, longitude, zoomLevel)  // all JS objects and functions available through dot notation
		})
	</script>
</head>
<body>
	<div id='scss-example'>
		<button type='button' class='background text'>SCSS Example</button>
	</div>
	<div>
		<button type='button' class='css-example'>CSS Example</button>
	</div>
	<br>
	<button type="button" id="jumpToGoogle">Jump To Google</button>
</body>

Tailwind Configuration

Utilize the shared TxDOT Tailwind configuration by importing the config object and exporting as the default in your project's tailwind.config.js file. Notice, depending on your project structure, the file itself will likely need to be imported opposed to dot notation from the package root.

import config from '@txdot-gis/txdot-toolbox-js/src/tailwind/config.js'
export default config