Here is the begenning of a proposal for a better SVG library. I introduce some of the motivation and lead with a couple of examples. Then I present the new types that would be used in this library. Finally, I go through a number of SVG attributes to show how they would look and give breif justification to the changes. This last part is not complete, as there are hundreds of these attributes and I wanted to get some feedback on this document before progressing further.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module FunctionFuzzers exposing (..) | |
| import Fuzz exposing (Fuzzer) | |
| import Test.Runner exposing (fuzz) | |
| import Shrink | |
| import Random.Pcg as Random | |
| import Murmur3 | |
| function : Fuzzer a -> Fuzzer (b -> a) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| macro module ExampleImplementation exposing ([|glsl|], [|r|], [|s|], [|css|]) | |
| -- ^ not sure this is necessary | |
| import Elm exposing (AST, ParseError, [|quote|]) | |
| import Result | |
| import Regex.Parser -- hypothetical module | |
| [|r|] : String -> Result ParseError AST | |
| [|r|] s = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var origModule = angular.module; | |
| angular.module = function() { | |
| var module = origModule.apply(angular, arguments); | |
| module.chart = function(name, factory) { | |
| return module.directive(name + 'Chart', wrapChart(name + 'Chart', factory)); | |
| }; | |
| return module; | |
| } | |
| var orig = Highcharts.SVGRenderer.prototype.html; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| angular.module('DocBrowser', ['PraxisDocBrowser']).config(function(ExamplesProvider) { | |
| ExamplesProvider.register('browser-javascript', 'JavaScript', function($compile, $action, Documentation, $version) { | |
| return Documentation.info($version).then(function(info) { | |
| var code = 'var request = new XMLHttpRequest();\n\n'; | |
| if (!info.endpoint) { | |
| throw 'Endpoint not defined in schema'; | |
| } | |
| code += 'request.open(\'' + $action.urls[0].verb +'\', \'' + info.endpoint + $action.urls[0].example + '\');\n\n'; | |
| code += _.map($action.headers.type.attributes, function(value, key) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.directive('readableList', function(Repeater) { | |
| return { | |
| restrict: 'E', | |
| transclude: true, | |
| compile: Repeater.compile('repeat', function($scope, $element, $attr, ctrl, $repeat) { | |
| $repeat.$watch(function(inputList) { | |
| $element.empty(); | |
| if (inputList.length == 1) { | |
| $repeat.$transclude(1, inputList[0], null, 0, function(clone) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Tree(label, branches) { | |
| this.label = label; | |
| this.branches = branches || []; | |
| } | |
| _.mixin({ | |
| mapTree: function(tree, fn, thisArg) { | |
| var cb = _.callback(fn, thisArg), | |
| agregate = []; | |
| function recurse(tree) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| angular.module('ui.router').config(['$provide', function($provide) { | |
| $provide.decorator('$controller', [ | |
| '$delegate', '$state', | |
| function($delegate, $state) { | |
| // the `later` and `ident` are private angular variables, | |
| // that break the app if not present | |
| return function(expression, locals, later, ident) { | |
| if ($state.$current) { | |
| locals = _.extend(locals, $state.$current.locals.globals); | |
| } |
(but not necessarily found elsewhere)
- Native Sourcemap support: JavaScript and CSS often need these for debugging purposses. Managing this manually tends to be a complete PITA. Also we want a way to globally turn these off, if we need better build time (see next).
- Native Watch & Serve: Setting up a dev environment should be straightforward, as the build tool should support mutliple environments, but also the abbility to watch source files and serve them from itself.
- Lazy: Shouldn't rebuild stuff if it doesn't need to.
- Native concurrency: Detect dependencies and parallelize automatically.
This algorithm when passed a DOM node will find a very short selector for that element.