Skip to content

Instantly share code, notes, and snippets.

View mationai's full-sized avatar
🎯
Focusing

John Leung mationai

🎯
Focusing
View GitHub Profile
@mationai
mationai / d3-svg-textwrap.js
Created November 16, 2021 21:57
svg text wrap within d3
d3.selection.prototype.textwrap = function(spec){
d3.addTspans(this, this.text(), spec);
return this;
}
d3.addTspans = function(textElm, text, spec){
var tspans = textElm.selectAll('tspan');
if (tspans.notNull() && text==textElm.datum().txt){
return tspans[0].map(function(tspan){
return d3.select(tspan);
<script>
import { onMount } from 'svelte'
import { deepValue } from '@jsier/deep-value'
import stickybits from 'stickybits/dist/stickybits.es'
import { sortByDefinition, sortByColumn } from '../../node_modules/extended-table/src/sortBy'
import { getCellClasses, getRowClasses, getHeaderClasses } from './tableClassNames'
const defaultRowClickHandler = (_) => true
export let data = []

The browser field is provided by a module author as a hint to javascript bundlers or component tools when preparing modules for client side use.

terms

Below are common terms used in the rest of the document

server

This is a non-dom based javascript execution environment. It usually only contains the base javascript language spec libraries and objects along with modules to communicate with OS features (available through commonjs require).

client