Releases: edemaine/svgtiler
Releases · edemaine/svgtiler
v3.1.7
v3.1.6
- The Witness definitions are now much more extensive, thanks to the corresponding paper, with several more examples
- API documentation fleshed out more, in particular relating to DOM methods
- Fix handling of spaces in JSX (#107)
- Upgrade babel, glob, preact, stylus, xmldom dependencies
Full Changelog: v3.1.5...v3.1.6
v3.1.5
- Update dependencies, in particular removing some (unlikely) security issues
- Examples improvements
- Mario tileset now includes items and allows for firebars made of multiple fires. Example of Mario clause gadget.
- Fix tests of
unevenLengths
Full Changelog: v3.1.4...v3.1.5
v3.1.4
- Fix re-use of global
svgtiler.def
s in multiple drawings
Full Changelog: v3.1.3...v3.1.4
v3.1.3
- Fix wrapping to keep
z-index
,boundingBox
,overflow
properties of top-level tag. This is useful with layer stacking via arrays, for example, where we don't need aviewBox
in any but the first layer. - Fix paths for re-used (cached) mapping files from multiple directories. Previously, if you re-used a file from multiple directories (when recursing into directories), relative paths might not work.
- Improve "bad SVG Tiler version number" error message to say how to upgrade (
npm install -g svgtiler@latest
).
Full Changelog: v3.1.2...v3.1.3
v3.1.2
- Fix: Don't automatically set
viewBox
ofsvgtiler.add
ed content. This was causing issues from<rect>
or<image>
withwidth
andheight
setting the wrong bounding box (becausex
andy
was ignored). - Fix global
svgtiler.def
content used insvgtiler.add
content (which previously wasn't getting checked so the def didn't get included).
Full Changelog: v3.1.1...v3.1.2
v3.1.1
- Fix
boundingBox
handling ofnull
values to have zero impact on x or y dimensions of bounding box
Full Changelog: v3.1.0...v3.1.1
v3.1.0
Render
gainsforEach
helper that iterates over all cells with aContext
Render
gainscontext
helper to make newContext
instances at arbitrary locationsContext
gainsstartsWith
/endsWith
shortcut helpers (to query thekey
even when it might beundefined
)- Empty fragments returned from mapping now treated like empty symbols (just like empty-string SVG content); previously crashed (#104)
- Empty content returned from mapping always treated as having width/height 0 instead of warning
- Not-first symbols in an array stack no longer warn about missing width/height (#105)
- Documentation improvements:
- Render class
key
isundefined
, notnull
, when out of bounds- How to upgrade with NPM
Full Changelog: v3.0.0...v3.1.0
v3.0.0
- Major rewrite to improve usage and add a ton of features, including Maketiles, stacked symbols in a single tile, automatically dynamic map functions, arbitrary pre/postprocessing, global underlays/overlays,
<def>
s support, better SVG cropping, improved performance, and smaller SVG outputs. - New "Maketile" feature for setting default
svgtiler
command-line arguments (replacing the need for Makefiles andmake
). (#84, #99)Maketile.args
can specify default command-line arguments, as if they were in a shell. In particular, you can use glob patterns like**/*.asc
, quotes and backslash escapes, and comments via#
. Unlike shells, you can freely use multiple lines.Maketile.js
orMaketile.coffee
canexport make
(orexport default
) with a function that runssvgtiler
with computed arguments.svgtiler(...args)
is like runningsvgtiler
on the command line with the specified arguments. String arguments are parsed as in.args
, whileArray
arguments are treated as is without further processing. You can also pass in already loadedDrawing
,Mapping
, orStyle
objects.- You can write multiple make rules (chosen on the command line) by wrapping functions in an object or
Map
(similar to mapping files), or write a generic function that takes the rule name as an argument. - You can loop over files matching a glob pattern via
svgtiler.glob
, and check for additional glob pattern matches viasvgtiler.match
.
- If you specify an actual file (mapping and/or drawing), default Maketiles get ignored.
- You can still specify additional arguments to add to what's run by the
Maketile
, e.g.svgtiler -v
. - You can specify a differently named Maketile via
--maketile
.
- Other command-line changes: (#84, #99)
- Specifying a directory name on the command line recurses into that directory, running the
Maketile
within. -O
lets you override the generated output filename stem (sans extension), including specifying patterns likeprefix_*_suffix
(#84)-s key=value
setsshare.key
to the string"value"
, as shorthand for creating a mapping file that setsshare
.( ... )
contains mapping files,-s
share settings, and other command-line options to within the parentheses.--bg color
for specifying background color. (#57)--use-data
addsdata-{key,i,j,k}
attributes to<use>
tags. (#48)--use-href
useshref
attributes instead ofxlink:href
--clean
for deleting files that would be generated.- Support multiple single-dash arguments like
-pP
as shorthand for-p -P
. -v
/--verbose
option to help debug e.g. Babel processing.
- Specifying a directory name on the command line recurses into that directory, running the
- Generalized mappings (#13)
- All function mappings are now automatically dynamic; no need to wrap in a second layer of function.
- For efficiency, you can force a function (or any mapping) to be treated as static (dependent only on key, not e.g. neighbors) via
svgtiler.static
wrapper. - Function mappings get
context
as a second argument (afterkey
) in addition tothis
, which is helpful for passingcontext
around or when using=>
arrow functions (which can't receivethis
). Current context can also be found viagetContext()
. - Mapping can defined by
Map
orWeakMap
as alternative to raw object. - Sequential composition mapping via
new Mappings map1, map2
applies both maps and takes the first match, as if two maps were specified on the command line. (#89) - Can nest functions, objects,
Map
s,Mappings
, orArray
s (see below) arbitrarily deep.
- Tiles can stack multiple
<symbol>
s on top of each other, by returning an array of SVG content from a mapping function (#33). The first non-null symbol defines defines the tile size.- Each
<symbol>
can have its ownz-index
, for proper component stacking. - Deduplication of the individual
<symbol>
s makes for smaller SVG output. - Parallel composition mapping via
[map1, map2]
applies both maps and stacks one on top of the other (depending onz-index
). (#83)
- Each
<symbol>
s in mappings no longer needviewBox
; you can simply specifywidth
andheight
and theviewBox
will default to0 0 width height
. You can also specify both and it behaves as in SVG. (#44)boundingBox
is the new name for theoverflowBox
attribute (though the old name is still supported). The box can now be smaller than the layout box (specified viawidth
/height
orviewBox
), which trims the overall bounding box when possible (#86). Technically this is a BREAKING CHANGE if youroverflowBox
is smaller than the layout box, but this is what it ought to happen then..js
/.coffee
mapping files can now have many newexport
s:init
is useful for applying side effects to theshared
object; it runs once per "load" of the mapping file, with mapping files alwaysinit
ing in command-line order (but sometimes more than once to restore an old state).preprocess
lets you scan and/or modify the tile keys in a drawing (#79)postprocess
lets you draw global content after tiles have been rendered (#81)- The mapping object can be exported as
map
, as a more descriptive name thandefault
. - For the final expression to be implicitly exported as the default, it must be an object expression (literal) or function expression; in particular, it cannot be an assignment or function call. Potentially BREAKING CHANGE, but fixes the behavior in many other files.
- You can specify a background fill (drawn via a big backing rectangle) via the
--bg
command-line option, or viasvgtiler.background(color)
. (#57) This is a helpful special case ofpostprocess
ing. - Tiles causing errors in your
.js
/.coffee
code now render as a warning symbol, and will no longer prevent the rest of the drawing from rendering. This makes it easier to see where your mapping code is crashing, and helps you write mappings incrementally. (#49) - Drawing file behavior tweaks (BREAKING CHANGES)
- Lines in ASCII art and CSV/TSV/SSV files are automatically normalized to have the same length, by appending blank strings (
''
) to short lines (same as XLSX files were). You can get the old behavior via--uneven
. (#85) - A blank sheet name in a spreadsheet file no longer has
_
in the generated filename. - If a spreadsheet file has only one sheet and it has a nonblank name, it will be in the generated filename.
- Lines in ASCII art and CSV/TSV/SSV files are automatically normalized to have the same length, by appending blank strings (
- Examples
- New grid-graph example, including
<marker>
demonstration - Chess examples with attack graph via
postprocess
- Tilt example modernized to use Preact
- Improve mario example to use tile arrays to reduce duplication and demonstrate background feature.
- Modernize to new generalized mappings, e.g. avoiding excess function wrappers and using
svgtiler.static
- New grid-graph example, including
- API changes:
renderDOM
(and otherrender
methods) now takemappings
andstyles
as part of general settings object, instead of as separate arguments. Thesemappings
andstyles
are now automatically cast intoMapping
andStyle
objects if needed. Butmappings
can no longer be a map object; it needs to be of the form{map: ...}
(or{default: ...}
), just like what would beimport *
ed from a mapping file. BREAKING CHANGESsvgtiler.def
lets you build markers, gradients, clip masks, etc. with automatically generated IDs, with automatic deduplication and removal of unused defs, and makes it easy to reference them. (#38)svgtiler.id
lets you build unique IDs, e.g. to re-use a graphical object (#38). (svgtiler.def
also uses this internally.)svgtiler.add(svg)
to add SVG content to the current rendering, e.g., in apreprocess
orpostprocess
function. This also enables adding metadata like<title>
(#94).svgtiler.require(filename)
loads a file (including drawings like ASCII art or spreadsheets, mappings, etc.) as if it were on the command line, producing aMapping
,Drawing
,Drawings
,Style
,Args
, orSVGFile
object.svgtiler.needVersion
for specifying version constraints on SVG Tiler, e.g.svgtiler.needVersion('3.x')
in yourMaketile.coffee
. (#99)svgtiler.getContext()
to find the currentContext
for a tile rendering, so you don't need to pass it through to auxiliary functions.svgtiler.runWithContext()
allows you to override the result ofsvgtiler.getContext()
.Context
has newat
method for absolute indexing (#78) andset
method for modifying keys (#69)Context
no longer hassymbols
orsymbol
attributes (as cells are now rendered one at a time, instead of all ahead of time).Context
object now shared throughout each drawing, so you could store extra drawing-specific data there.Context
hasrender
attribute pointing to currentRender
instance, in addition todrawing
attribute pointer to currentDrawing
instance.Drawing
keys are now allowed to be objects other thanString
s, e.g., via preprocessing or when creating manually vianew Drawing
.Drawing
has newat
,get
, andset
methods.Drawing
's main attribute renamed fromdata
tokeys
, andMapping
's main attribute renamed fromdata
tomap
. (#88)Drawing
has newmargins
andunevenLengths
attributes for understanding what happened during margin trimming and uneven length fixing.Mapping
'smodule
attribute renamed toexports
.- New
Render
class represents a rendering task for oneDrawing
, including all render parameters (e.g.drawing
,mappings
, andstyles
).xMin
,xMax
,yMin
,yMax
,width
,height
, andlayers
attributes which are useful inpreprocess
andpostprocess
.id
method for generating unique IDs;svgtiler.id
calls this.def
method for including<defs>
content;svgtiler.def
calls this.add
method for adding SVG content;svgtiler.add
calls this.makeDOM
,makeSVG
,makeTeX
re...
v2.4.1
- Fix
svgtiler
CLI on Windows, broken in v2.3.0 when fixing Linux, by wrapping CLI in another NodeJS layer - Revise Mario example to use new
share
feature - Improve documentation, e.g., what "SKIPPED" and "UNCHANGED" mean.
- Minor code cleanup
Full Changelog: v2.4.0...v2.4.1