├── .gitignore ├── README.md ├── elm-package.json ├── src └── Svg │ └── Extra.elm └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore build files 2 | /elm-stuff 3 | 4 | # Ignore backup files 5 | *~ 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Additional functions for working with Svg 2 | 3 | Experimental package with convenience functions for working with Svg. 4 | Note that this API is experimental and likely to go through many more iterations. 5 | 6 | Feedback and contributions are very welcome. 7 | -------------------------------------------------------------------------------- /elm-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0.1", 3 | "summary": "Additional functions for working with Svg", 4 | "repository": "https://github.com/elm-community/svg-extra.git", 5 | "license": "MIT", 6 | "source-directories": [ 7 | "src" 8 | ], 9 | "exposed-modules": [ 10 | "Svg.Extra" 11 | ], 12 | "dependencies": { 13 | "elm-lang/core": "5.0.0 <= v < 6.0.0", 14 | "elm-lang/svg": "2.0.0 <= v < 3.0.0" 15 | }, 16 | "elm-version": "0.18.0 <= v < 0.19.0" 17 | } 18 | -------------------------------------------------------------------------------- /src/Svg/Extra.elm: -------------------------------------------------------------------------------- 1 | module Svg.Extra 2 | exposing 3 | ( static 4 | ) 5 | 6 | {-| Convenience functionality on 7 | [`Svg`](http://package.elm-lang.org/packages/elm-lang/svg/latest/Svg#Svg) 8 | 9 | @docs static 10 | -} 11 | 12 | import Svg exposing (Svg) 13 | 14 | 15 | {-| Embedding static svg. 16 | 17 | The type argument 18 | [`Never`](http://package.elm-lang.org/packages/elm-lang/core/latest/Basics#Never) 19 | in `Svg Never` tells us that the svg has no event handlers attached, 20 | it will not generate any messages. We may want such static svg to be 21 | embedded into or combined with arbitrary other svg, while using types 22 | to enforce the staticness. That is what this function provides. 23 | 24 | *Note:* To call this function, the argument need not be literally of type 25 | `Svg Never`. It suffices if it is a fully polymorphic (in the message type) 26 | `Svg` value. For example, this works: `static (Svg.text "abcdef")`. 27 | -} 28 | static : Svg Never -> Svg msg 29 | static = 30 | Svg.map never 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Elm Community members 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. --------------------------------------------------------------------------------