lukesutton / uut Goto Github PK
View Code? Open in Web Editor NEWCan you write CSS using pure Swift? Yes you can.
License: MIT License
Can you write CSS using pure Swift? Yes you can.
License: MIT License
There are two ways we could define media queries. One is a media query block that wraps a bunch of styles. The other is defining media queries inline in a block then extracting them. They could also be hoisted out and grouped together ala SASS.
A bit more complicated than other properties, since the syntax for specifying the shadows can be a bit involved.
Coverage of media queries is only partial at this point. We need to go over what's missing and add them. Pretty straight forward.
I'm probably not going to make the worlds-most-complete test suite for the 1.0 release, but it's prudent to do at least some testing. Already I've turned up and fixed some issues because of tests, so ๐
It's likely they may need to use something clever like generics to work. Existing property values could be extended to take a CSSVariable
, but for type safety, we need to make sure invalid types can't be provided.
This is a bit of a mystery, since there is a lot of ambiguity around how to write and process Swift documentation. There is the Apple way, which formats nicely in Xcode, but then there are other approaches as well.
Properties are made available in different CSS specs. It might be useful to be able to inspect a collection of styles and see what the CSS level is i.e. is it purely CSS-2. This could be done via types, perhaps something as simple as making the property structs extend a protocol e.g. extension Properties.FontSize: CSS1 {}
Support for this is mostly gated behind vendor-specific prefixes, so this requires investigating methods for outputting different levels of browser support. Currently we only output what the spec dictates.
Firstly, having styles and properties being responsible for their own compilation is a bit messy. Secondly, it's inflexible, since it makes it difficult to do additional processing. Instead we should step back from this and just set a few rules for the base styles and properties.
Compilation is then abstracted away and can be implemented in different ways. It would be relatively easy to make an architecture that is pluggable, where middleware functions can provide intermediate steps. A rough sketch:
The types for each step are:
[Style] -> [Style]
[Style] -> [Style]
[Style] -> String
String -> String
Processing could be made even richer if middleware received an intermediate-representation rather than the standard styles. Processors would then need less knowledge of the style-types, just the IR.
The types in that case could be:
[Style] -> [IRStyle]
[IRStyle] -> [IRStyle]
[IRStyle] -> String
String -> String
This is a maybe, since it is more work and does mean losing the type information available in the Style
type.
We don't have any of these at all.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.