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
| engine = new GSS(document) | |
| var lastWidth = 0; | |
| onResize = function() { | |
| if ((lastWidth > 900) ^ (window.innerWidth) > 900) { | |
| if (window.innerWidth > 900) { | |
| engine.solve({}) | |
| } else { | |
| engine.solve({}) |
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
| getGSS: -> | |
| this.constructor.prototype.engine ||= new GSS | |
| componentWillMount() { | |
| engine = this.getGSS() | |
| engine.data.merge({ | |
| '$my-component-id"foo"[width]': 33, | |
| '$my-component-id"foo"[height]': 55, | |
| }) |
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
| 1) Add ; as alternative to , | |
| a,b;c,d should parse to ;(,(a,b) ,(c,d)) | |
| 2) Make VFL use ; in its block rules | |
| 3) Update vflHook logging. | |
| - Fixes an issue, when it didnt log calls without ruleset | |
| - Uses proper deferred logging (input & output) | |
| - normalizes @horizontal to @h |
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
| describe 'as nested commands', -> | |
| it 'should return final matrix', -> | |
| rotated = engine.intrinsic.Matrix::_mat4.create() | |
| rotated = engine.intrinsic.Matrix::_mat4.rotateY(rotated, rotated, - 18 * (Math.PI / 180)) | |
| rotated = engine.intrinsic.Matrix::_mat4.rotateZ(rotated, rotated, 180 * (Math.PI / 180)) | |
| rotate = ['rotateZ', ['rotateY', -0.05], 0.5] | |
| expect(engine.intrinsic.Command(rotate).solve(engine.intrinsic, rotate)). | |
| to.eql rotated |
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
| describe 'bound to font-size', -> | |
| it 'should be able to compute width', (done) -> | |
| container.innerHTML = """ | |
| <style type="text/gss-ast"> | |
| ["rule", ["tag", "span"], [ | |
| [">=", ["get", "width"], ["em", 10]], | |
| [">=", ["get", "height"], ["em", ["get", "c"]]], | |
| [">=", ["get", "c"], 2] | |
| ]] |
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
| # Run solution in multiple ticks | |
| commit: (update) -> | |
| until update.isDone() | |
| # Process deferred operations, mutations and conditions | |
| @triggerEvent('precommit', update) | |
| @triggerEvent('commit', update) | |
| # Process queue | |
| if update.domains.length |
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
| it 'in mixed stylesheets', (done) -> | |
| engine = GSS(container) | |
| container.innerHTML = """ | |
| <div id="ship"></div> | |
| <style type="text/gss" id="gss1"> | |
| [b] == 10; // & | |
| ^ { | |
| "mast" { | |
| x: == [b]; // ^^ |
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
| * Rules | |
| * Selectors and rules | |
| * Variables and constraints | |
| * Dimensions and positions (right, bottom) | |
| * Intrinsic values | |
| * Scope and virtuals | |
| * Grids | |
| * Selectors in grids |
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
| [t] == 500; | |
| @if [t] >= 960 { | |
| #b { | |
| width: == 100; | |
| } | |
| } |
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
| WrapperCommand = GSS::Command.extend { | |
| signature: [ | |
| left: ['DynamicCommand'] | |
| right: ['Number'] | |
| ] | |
| }, { | |
| 'wrapper': (a) -> | |
| return ['wrapper', a] | |
| } |