     path.format filename
 
 class Style extends Input
-  load: (@css) ->
+  ###
+  Base Style class assumes any passed data is in CSS format,
+  stored in `@css` attribute.
+  ###
+  parse: (@css) ->
 
 class CSSStyle extends Style
+  ## Style in CSS format.  Equivalent to Style base class.
   @title: "CSS style file"
-  parse: (filedata) ->
-    @load filedata
 
 class StylusStyle extends Style
+  ## Style in Stylus format.
   @title: "Stylus style file (https://stylus-lang.com/)"
-  parse: (filedata) ->
-    styl = require('stylus') filedata,
+  parse: (stylus) ->
+    styl = require('stylus') stylus,
       filename: @filename
-    @load styl.render()
+    super styl.render()
 
 class ArrayWrapper extends Array
   ###

      #  {...babelConfig, filename: @filename})
      #console.log code
      ## Normally rely on `require` and `CoffeeScript.register` to load code.
      super.parse data
    else
      ## But if file has been explicitly loaded (e.g. in browser),
      ## compile manually.
      super.parse require('coffeescript').compile data,
        bare: true
        inlineMap: true
        filename: @filename

    currentMapping = oldMapping

class Mapping extends Input
  ###
  Base Mapping class.
  The passed-in data can be any supported output from a JavaScript mapping
  file: an object, a Map, or a function resolving to one of the above
  or a String (containing SVG or a filename), Preact VDOM, or null/undefined.
  In this class and subclasses, `@map` stores this data.
  ###
  constructor: (...args) ->
    super ...args
    @cache ?= new Map  # for static tiles
    @settings = {...@settings, dirname: path.dirname @filename} if @filename?
  parse: (@map) ->
    unless typeof @map in ['function', 'object']
      console.warn "Mapping file #{@filename} returned invalid mapping data of type (#{typeof @map}): should be function or object"
      @map = null
    if isPreact @map
      console.warn "Mapping file #{@filename} returned invalid mapping data (Preact DOM): should be function or object"
      @map = null
  lookup: (key, context) ->
    ## `key` normally should be a String (via `AutoDrawing::parse` coercion).
    ## Check cache (used for static tiles).
    if (found = @cache.get key)?
      return found

    ## Repeatedly expand `@map` until we get string, Preact VDOM, or
    ## null/undefined.
    value = @map
    isStatic = undefined
    while value? and typeof value != 'string' and not isPreact value
      if value instanceof Map or value instanceof WeakMap
