Skip to content

Releases: edemaine/svgtiler

v3.1.7

16 Apr 01:09
Compare
Choose a tag to compare
  • Fix bug with global defs not getting assigned the correct id when re-used

Full Changelog: v3.1.6...v3.1.7

v3.1.6

08 Sep 19:21
Compare
Choose a tag to compare
  • 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

30 Aug 17:05
Compare
Choose a tag to compare
  • 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

28 Jan 20:28
Compare
Choose a tag to compare
  • Fix re-use of global svgtiler.defs in multiple drawings

Full Changelog: v3.1.3...v3.1.4

v3.1.3

25 Jan 15:40
Compare
Choose a tag to compare
  • 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 a viewBox 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

25 Jan 02:55
Compare
Choose a tag to compare
  • Fix: Don't automatically set viewBox of svgtiler.added content. This was causing issues from <rect> or <image> with width and height setting the wrong bounding box (because x and y was ignored).
  • Fix global svgtiler.def content used in svgtiler.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

25 Jan 00:49
Compare
Choose a tag to compare
  • Fix boundingBox handling of null values to have zero impact on x or y dimensions of bounding box

Full Changelog: v3.1.0...v3.1.1

v3.1.0

31 Dec 19:02
Compare
Choose a tag to compare
  • Render gains forEach helper that iterates over all cells with a Context
  • Render gains context helper to make new Context instances at arbitrary locations
  • Context gains startsWith/endsWith shortcut helpers (to query the key even when it might be undefined)
  • 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 is undefined, not null, when out of bounds
    • How to upgrade with NPM

Full Changelog: v3.0.0...v3.1.0

v3.0.0

25 Dec 13:54
Compare
Choose a tag to compare
  • 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 and make). (#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 or Maketile.coffee can export make (or export default) with a function that runs svgtiler with computed arguments.
      • svgtiler(...args) is like running svgtiler on the command line with the specified arguments. String arguments are parsed as in .args, while Array arguments are treated as is without further processing. You can also pass in already loaded Drawing, Mapping, or Style 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 via svgtiler.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 like prefix_*_suffix (#84)
    • -s key=value sets share.key to the string "value", as shorthand for creating a mapping file that sets share.
    • ( ... ) contains mapping files, -s share settings, and other command-line options to within the parentheses.
    • --bg color for specifying background color. (#57)
    • --use-data adds data-{key,i,j,k} attributes to <use> tags. (#48)
    • --use-href uses href attributes instead of xlink: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.
  • 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 (after key) in addition to this, which is helpful for passing context around or when using => arrow functions (which can't receive this). Current context can also be found via getContext().
    • Mapping can defined by Map or WeakMap 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, Maps, Mappings, or Arrays (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 own z-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 on z-index). (#83)
  • <symbol>s in mappings no longer need viewBox; you can simply specify width and height and the viewBox will default to 0 0 width height. You can also specify both and it behaves as in SVG. (#44)
  • boundingBox is the new name for the overflowBox attribute (though the old name is still supported). The box can now be smaller than the layout box (specified via width/height or viewBox), which trims the overall bounding box when possible (#86). Technically this is a BREAKING CHANGE if your overflowBox is smaller than the layout box, but this is what it ought to happen then.
  • .js/.coffee mapping files can now have many new exports:
    • init is useful for applying side effects to the shared object; it runs once per "load" of the mapping file, with mapping files always initing 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 than default.
    • 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 via svgtiler.background(color). (#57) This is a helpful special case of postprocessing.
  • 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.
  • 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
  • API changes:
    • renderDOM (and other render methods) now take mappings and styles as part of general settings object, instead of as separate arguments. These mappings and styles are now automatically cast into Mapping and Style objects if needed. But mappings can no longer be a map object; it needs to be of the form {map: ...} (or {default: ...}), just like what would be import *ed from a mapping file. BREAKING CHANGES
    • svgtiler.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 a preprocess or postprocess 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 a Mapping, Drawing, Drawings, Style, Args, or SVGFile object.
    • svgtiler.needVersion for specifying version constraints on SVG Tiler, e.g. svgtiler.needVersion('3.x') in your Maketile.coffee. (#99)
    • svgtiler.getContext() to find the current Context for a tile rendering, so you don't need to pass it through to auxiliary functions. svgtiler.runWithContext() allows you to override the result of svgtiler.getContext().
    • Context has new at method for absolute indexing (#78) and set method for modifying keys (#69)
    • Context no longer has symbols or symbol 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 has render attribute pointing to current Render instance, in addition to drawing attribute pointer to current Drawing instance.
    • Drawing keys are now allowed to be objects other than Strings, e.g., via preprocessing or when creating manually via new Drawing.
    • Drawing has new at, get, and set methods.
    • Drawing's main attribute renamed from data to keys, and Mapping's main attribute renamed from data to map. (#88)
    • Drawing has new margins and unevenLengths attributes for understanding what happened during margin trimming and uneven length fixing.
    • Mapping's module attribute renamed to exports.
    • New Render class represents a rendering task for one Drawing, including all render parameters (e.g. drawing, mappings, and styles).
      • xMin, xMax, yMin, yMax, width, height, and layers attributes which are useful in preprocess and postprocess.
      • 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...
Read more

v2.4.1

10 Aug 22:42
Compare
Choose a tag to compare
  • 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