Version Description
(5th July 2016) = * Requires PHP 5.4 - Please ensure you have it installed to work * Version 3 released! * Please login to your admin and hit 'Update Options' upon installing on all sites * Awesome FontIcon integration * Much Smoother Animations * Button Animations * And much, much more * Many bug fixes * Completely re-written from the ground up
Download this release
Release Info
Developer | ResponsiveMenu |
Plugin | Responsive Menu |
Version | 3.0.0 |
Comparing to | |
See all releases |
Version 3.0.0
- autoload.php +13 -0
- readme.txt +370 -0
- responsive-menu.php +42 -0
- src/app/Collections/OptionsCollection.php +79 -0
- src/app/Controllers/Admin/Base.php +16 -0
- src/app/Controllers/Admin/Main.php +97 -0
- src/app/Controllers/Base.php +16 -0
- src/app/Controllers/Front.php +44 -0
- src/app/Database/Database.php +11 -0
- src/app/Database/Migration.php +193 -0
- src/app/Database/WpDatabase.php +42 -0
- src/app/Factories/AdminSaveFactory.php +45 -0
- src/app/Factories/CssFactory.php +34 -0
- src/app/Factories/FrontDisplayFactory.php +41 -0
- src/app/Factories/JsFactory.php +23 -0
- src/app/Factories/OptionFactory.php +35 -0
- src/app/Filesystem/FileCreator.php +30 -0
- src/app/Filters/Filter.php +8 -0
- src/app/Filters/HtmlFilter.php +12 -0
- src/app/Filters/JsonFilter.php +12 -0
- src/app/Filters/TextFilter.php +12 -0
- src/app/Form/Checkbox.php +28 -0
- src/app/Form/Colour.php +19 -0
- src/app/Form/Export.php +13 -0
- src/app/Form/FontIconPageList.php +74 -0
- src/app/Form/FormComponent.php +8 -0
- src/app/Form/HeaderBarOrdering.php +49 -0
- src/app/Form/Image.php +25 -0
- src/app/Form/Import.php +14 -0
- src/app/Form/MenuOrdering.php +49 -0
- src/app/Form/Reset.php +13 -0
- src/app/Form/Select.php +24 -0
- src/app/Form/Text.php +20 -0
- src/app/Form/TextArea.php +17 -0
- src/app/Formatters/Minify.php +24 -0
- src/app/Formatters/Tabs.php +53 -0
- src/app/Formatters/Text.php +16 -0
- src/app/Mappers/JsMapper.php +186 -0
- src/app/Mappers/ScssBaseMapper.php +235 -0
- src/app/Mappers/ScssButtonMapper.php +62 -0
- src/app/Mappers/ScssMapper.php +19 -0
- src/app/Mappers/ScssMenuMapper.php +149 -0
- src/app/Mappers/scssphp/.travis.yml +7 -0
- src/app/Mappers/scssphp/LICENSE.md +660 -0
- src/app/Mappers/scssphp/Makefile +3 -0
- src/app/Mappers/scssphp/README.md +34 -0
- src/app/Mappers/scssphp/composer.json +28 -0
- src/app/Mappers/scssphp/phpunit.xml.dist +28 -0
- src/app/Mappers/scssphp/pscss +53 -0
- src/app/Mappers/scssphp/scss.inc.php +4576 -0
- src/app/Mappers/scssphp/tests/ApiTest.php +80 -0
- src/app/Mappers/scssphp/tests/ExceptionTest.php +86 -0
- src/app/Mappers/scssphp/tests/InputTest.php +83 -0
- src/app/Mappers/scssphp/tests/compare-scss.sh +25 -0
- src/app/Mappers/scssphp/tests/inputs/builtins.scss +171 -0
- src/app/Mappers/scssphp/tests/inputs/comments.scss +28 -0
- src/app/Mappers/scssphp/tests/inputs/compass_extract.scss +248 -0
- src/app/Mappers/scssphp/tests/inputs/content.scss +61 -0
- src/app/Mappers/scssphp/tests/inputs/content_with_function.scss +17 -0
- src/app/Mappers/scssphp/tests/inputs/default_args.scss +15 -0
- src/app/Mappers/scssphp/tests/inputs/directives.scss +108 -0
- src/app/Mappers/scssphp/tests/inputs/extends.scss +184 -0
- src/app/Mappers/scssphp/tests/inputs/filter_effects.scss +48 -0
- src/app/Mappers/scssphp/tests/inputs/functions.scss +81 -0
- src/app/Mappers/scssphp/tests/inputs/ie7.scss +12 -0
- src/app/Mappers/scssphp/tests/inputs/if.scss +76 -0
- src/app/Mappers/scssphp/tests/inputs/if_on_null.scss +8 -0
- src/app/Mappers/scssphp/tests/inputs/import.scss +23 -0
- src/app/Mappers/scssphp/tests/inputs/imports/_partial.scss +10 -0
- src/app/Mappers/scssphp/tests/inputs/imports/simple.scss +4 -0
- src/app/Mappers/scssphp/tests/inputs/interpolation.scss +86 -0
- src/app/Mappers/scssphp/tests/inputs/keyword_args.scss +24 -0
- src/app/Mappers/scssphp/tests/inputs/list.scss +15 -0
- src/app/Mappers/scssphp/tests/inputs/looping.scss +51 -0
- src/app/Mappers/scssphp/tests/inputs/media.scss +208 -0
- src/app/Mappers/scssphp/tests/inputs/mixins.scss +158 -0
- src/app/Mappers/scssphp/tests/inputs/nesting.scss +45 -0
- src/app/Mappers/scssphp/tests/inputs/null.scss +41 -0
- src/app/Mappers/scssphp/tests/inputs/operators.scss +143 -0
- src/app/Mappers/scssphp/tests/inputs/placeholder_selector.scss +18 -0
- src/app/Mappers/scssphp/tests/inputs/scss_css.scss +986 -0
- src/app/Mappers/scssphp/tests/inputs/selectors.scss +187 -0
- src/app/Mappers/scssphp/tests/inputs/values.scss +43 -0
- src/app/Mappers/scssphp/tests/inputs/variables.scss +56 -0
- src/app/Mappers/scssphp/tests/outputs/builtins.css +126 -0
- src/app/Mappers/scssphp/tests/outputs/comments.css +19 -0
- src/app/Mappers/scssphp/tests/outputs/compass_extract.css +28 -0
- src/app/Mappers/scssphp/tests/outputs/content.css +29 -0
- src/app/Mappers/scssphp/tests/outputs/content_with_function.css +2 -0
- src/app/Mappers/scssphp/tests/outputs/default_args.css +3 -0
- src/app/Mappers/scssphp/tests/outputs/directives.css +77 -0
- src/app/Mappers/scssphp/tests/outputs/extends.css +87 -0
- src/app/Mappers/scssphp/tests/outputs/filter_effects.css +20 -0
- src/app/Mappers/scssphp/tests/outputs/functions.css +22 -0
- src/app/Mappers/scssphp/tests/outputs/ie7.css +8 -0
- src/app/Mappers/scssphp/tests/outputs/if.css +21 -0
- src/app/Mappers/scssphp/tests/outputs/if_on_null.css +2 -0
- src/app/Mappers/scssphp/tests/outputs/import.css +27 -0
- src/app/Mappers/scssphp/tests/outputs/interpolation.css +54 -0
- src/app/Mappers/scssphp/tests/outputs/keyword_args.css +6 -0
- src/app/Mappers/scssphp/tests/outputs/list.css +7 -0
- src/app/Mappers/scssphp/tests/outputs/looping.css +45 -0
- src/app/Mappers/scssphp/tests/outputs/media.css +103 -0
- src/app/Mappers/scssphp/tests/outputs/mixins.css +83 -0
- src/app/Mappers/scssphp/tests/outputs/nesting.css +22 -0
- src/app/Mappers/scssphp/tests/outputs/null.css +21 -0
- src/app/Mappers/scssphp/tests/outputs/operators.css +105 -0
- src/app/Mappers/scssphp/tests/outputs/placeholder_selector.css +7 -0
- src/app/Mappers/scssphp/tests/outputs/scss_css.css +741 -0
- src/app/Mappers/scssphp/tests/outputs/selectors.css +335 -0
- src/app/Mappers/scssphp/tests/outputs/values.css +34 -0
- src/app/Mappers/scssphp/tests/outputs/variables.css +24 -0
- src/app/Models/ComplexOption.php +130 -0
- src/app/Models/Option.php +13 -0
- src/app/Models/SimpleOption.php +36 -0
- src/app/Repositories/Options/BaseOptionRepository.php +13 -0
- src/app/Repositories/Options/ComplexOptionRepository.php +25 -0
- src/app/Repositories/Options/ReadRepository.php +7 -0
- src/app/Repositories/Options/Repository.php +9 -0
- src/app/Repositories/Options/SimpleOptionReadRepository.php +18 -0
- src/app/Routing/Container.php +282 -0
- src/app/Routing/Routing.php +8 -0
- src/app/Routing/WpRouting.php +57 -0
- src/app/View/AdminView.php +40 -0
- src/app/View/FrontView.php +24 -0
- src/app/View/View.php +8 -0
- src/app/ViewModels/Button.php +19 -0
- src/app/ViewModels/Components/Admin/Boxes.php +102 -0
- src/app/ViewModels/Components/Admin/Tabs.php +23 -0
- src/app/ViewModels/Components/Button/Button.php +35 -0
- src/app/ViewModels/Components/Menu/AdditionalContent.php +20 -0
- src/app/ViewModels/Components/Menu/Menu.php +30 -0
- src/app/ViewModels/Components/Menu/Search.php +21 -0
- src/app/ViewModels/Components/Menu/Title.php +29 -0
- src/app/ViewModels/Components/ViewComponent.php +11 -0
- src/app/ViewModels/Menu.php +32 -0
- src/app/WPML/WPML.php +15 -0
- src/app/Walkers/WpWalker.php +118 -0
- src/config/admin_ordering.php +1127 -0
- src/config/default_options.php +151 -0
- src/config/option_helpers.php +19 -0
- src/config/route_dependencies.php +35 -0
- src/public/css/admin/main.css +695 -0
- src/public/js/admin/main.js +70 -0
- src/public/js/admin/postbox-edit.js +4 -0
- src/public/js/admin/sticky-sidebar.js +9 -0
- src/public/scss/hamburgers/_base.scss +69 -0
- src/public/scss/hamburgers/hamburgers.scss +58 -0
- src/public/scss/hamburgers/types/_boring.scss +30 -0
- src/views/admin/main.phtml +91 -0
- src/views/button.phtml +1 -0
- src/views/header_bar.phtml +3 -0
- src/views/menu.phtml +8 -0
autoload.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
spl_autoload_register( function( $class_name ) {
|
4 |
+
|
5 |
+
$strip_namespace = str_replace( 'ResponsiveMenu\\', '', $class_name );
|
6 |
+
$file_name = str_replace( '\\', '/', $strip_namespace );
|
7 |
+
|
8 |
+
$file = __DIR__ . '/src/app/' . $file_name . '.php';
|
9 |
+
|
10 |
+
if(file_exists($file))
|
11 |
+
include $file;
|
12 |
+
|
13 |
+
} );
|
readme.txt
ADDED
@@ -0,0 +1,370 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Responsive Menu ===
|
2 |
+
Contributors: ResponsiveMenu
|
3 |
+
Tags: responsive, menu, responsive menu, mobile menu, wordpress responsive menu, wp responsive menu, tablet menu, mobile, tablet, 3 lines, 3 line, three line, three lines
|
4 |
+
Requires at least: 3.5.0
|
5 |
+
Tested up to: 4.5.3
|
6 |
+
Stable tag: 3.0.0
|
7 |
+
License: GPLv2 or later
|
8 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
+
|
10 |
+
This is a Highly Customisable Responsive Menu Plugin for WordPress
|
11 |
+
|
12 |
+
== Description ==
|
13 |
+
|
14 |
+
This is a Highly Customisable Responsive Menu Plugin for WordPress, with over 120 customisable options giving you a combination of 14,000 options!
|
15 |
+
<br /><br />
|
16 |
+
**Requires PHP 5.4+**, please ensure you have this installed before upgrading.
|
17 |
+
<br /><br />
|
18 |
+
With this plugin, you can edit the following and more:
|
19 |
+
<ul>
|
20 |
+
<li>Menu Title</li>
|
21 |
+
<li>Menu Title Image</li>
|
22 |
+
<li>Button Title</li>
|
23 |
+
<li>Button Title Image</li>
|
24 |
+
<li>Menu To Responsify</li>
|
25 |
+
<li>Media Query Breakpoint Width</li>
|
26 |
+
<li>CSS Options For Hiding Specific Elements</li>
|
27 |
+
<li>Menu Depth To Display</li>
|
28 |
+
<li>Top Location</li>
|
29 |
+
<li>Right Percentage Location</li>
|
30 |
+
<li>Line & Text Colour</li>
|
31 |
+
<li>Menu Button Background Colour</li>
|
32 |
+
<li>Absolute and Fixed Positioning</li>
|
33 |
+
<li>Menu Font</li>
|
34 |
+
<li>Menu Title Colour</li>
|
35 |
+
<li>Menu Title Hover Colour</li>
|
36 |
+
<li>Menu Title Background Colour</li>
|
37 |
+
<li>Menu Text Colour</li>
|
38 |
+
<li>Menu Text Hover Colour</li>
|
39 |
+
<li>Menu Background Colour</li>
|
40 |
+
<li>Menu Link Background Hover Colour</li>
|
41 |
+
<li>Menu Text Size</li>
|
42 |
+
<li>Menu Button Text Size</li>
|
43 |
+
<li>Menu Links Text Size</li>
|
44 |
+
<li>Choose Overlay or Push Animations</li>
|
45 |
+
<li>Slide Animation Speed</li>
|
46 |
+
<li>Ability to auto expand/hide sub-menus</li>
|
47 |
+
<li>Inclusion/Exclusion of Search Box</li>
|
48 |
+
<li>Choice of Positioning of Search Box</li>
|
49 |
+
<li>Transition speed</li>
|
50 |
+
<li>Slide Animation Speed</li>
|
51 |
+
<li>Menu Link Heights</li>
|
52 |
+
<li>Text Alignment</li>
|
53 |
+
<li>Choice of side to slide in from (left, right, top, bottom)</li>
|
54 |
+
<li>Choice to use inline/external stylesheets and scripts</li>
|
55 |
+
<li>Option to include JavaScript in footer</li>
|
56 |
+
<li>Option to remove CSS !important tags</li>
|
57 |
+
<li>Choice to Minify created CSS and JS files (saves up to 50% file space)</li>
|
58 |
+
<li>Choice to auto-close menu items on click (for single page sites)</li>
|
59 |
+
<li>Choice to replace 3 lines with an x on click</li>
|
60 |
+
<li>Minimum width of menu</li>
|
61 |
+
<li>Maximum width of menu</li>
|
62 |
+
<li>Choice to Auto Expand Parent Links</li>
|
63 |
+
<li>Choice to Ignore Clicks on Ancestor Links</li>
|
64 |
+
<li>Choice to Close Menu Automatically on Page Clicks</li>
|
65 |
+
<li>Choice to Specify Title Menu Link</li>
|
66 |
+
<li>Choice to Specify Title Menu Link Location</li>
|
67 |
+
<li>Ability to add custom HTML snippet inside the menu</li>
|
68 |
+
<li>Choice of location for custom HTML snippet inside the menu</li>
|
69 |
+
<li>Choice of using shortode or not</li>
|
70 |
+
<li>Ability to change the 3 lines height</li>
|
71 |
+
<li>Ability to change the 3 lines width</li>
|
72 |
+
<li>Ability to Export Options</li>
|
73 |
+
<li>Ability to Import Options</li>
|
74 |
+
<li>Ability to set sub menu arrow shape/image Options</li>
|
75 |
+
<li>Ability to set custom click trigger</li>
|
76 |
+
<li>Ability to push menu button with animation</li>
|
77 |
+
<li>Ability to change Current Page background hover colour</li>
|
78 |
+
<li>Ability to change Current Page Link hover colour</li>
|
79 |
+
<li>Ability to provide a custom walker option</li>
|
80 |
+
<li>Ability to choose to use transient caching or not</li>
|
81 |
+
<li>Ability to choose if menu is shown on left or right of screen</li>
|
82 |
+
<li>Ability to set theme location menu</li>
|
83 |
+
<li>Ability to reset to default</li>
|
84 |
+
<li>Ability to set menu text location</li>
|
85 |
+
<li>Ability to set menu text line height</li>
|
86 |
+
<li>Plus more...</li>
|
87 |
+
</ul>
|
88 |
+
The plugin creates a nice three-lined mobile menu button (or custom image if you choose) that users can click on to bring a slide out menu (from the left, right, top or bottom - again your choice), which is easily navigated.
|
89 |
+
<br /><br />
|
90 |
+
It is fully responsive if you have the viewport meta tag on your site, using media queries with the widths defined by you. It can be used as a responsive menu, mobile menu, tablet menu or full dedicated menu for your main site.
|
91 |
+
<br /><br />
|
92 |
+
It requires no shortcodes (although you can use them) or fancy php code to be inserted by yourself making it very easy to install and you can design it to look exactly as you want to or leave it with its default values to have it looking amazing in just a matter of seconds.
|
93 |
+
<br /><br />
|
94 |
+
You have the choice to include the stylesheets and scripts inline to avoid adding any extra HTTP requests to your site or through external stylesheets created by the plug-in. Either way, the code added is extremely small (only a little jQuery and CSS) and there is even an option to minify the output if you wish saving a further 50% on file space.
|
95 |
+
<br /><br />
|
96 |
+
It also includes the following functionality:
|
97 |
+
<ul>
|
98 |
+
<li>WPML/Polylang Support</li>
|
99 |
+
</ul>
|
100 |
+
If you decide to go Pro then you will also get the following functionality:
|
101 |
+
<ul>
|
102 |
+
<li>FontIcon Support for individual menu items</li>
|
103 |
+
<li>Button Animation Effects</li>
|
104 |
+
<li>Colour Opacity option</li>
|
105 |
+
<li>Header Bar</li>
|
106 |
+
<li>Single Menu Option</li>
|
107 |
+
</ul>
|
108 |
+
For more reasons to go Pro, please visit <a target="_blank" href="https://responsive.menu/why-go-pro/">this page</a>.
|
109 |
+
If you would like to see any other options added to the plugin or would like to help with translating the plugin into various languages then please email me or place them in a support ticket.
|
110 |
+
<br />
|
111 |
+
|
112 |
+
== Installation ==
|
113 |
+
|
114 |
+
1. Upload `responsive-menu` to the `/wp-content/plugins/` directory
|
115 |
+
2. Activate the plugin through the `Plugins` menu in WordPress
|
116 |
+
3. Set your options from the Responsive Menu admin area
|
117 |
+
|
118 |
+
Alternatively:
|
119 |
+
|
120 |
+
1. Login to your WordPress admin area
|
121 |
+
2. Search for `Responsive Menu`
|
122 |
+
3. Click install `Responsive Menu`
|
123 |
+
4. Activate through the `Plugins` menu in WordPress or when asked during installation
|
124 |
+
5. Set your options from the Responsive Menu admin area
|
125 |
+
|
126 |
+
== Frequently Asked Questions ==
|
127 |
+
|
128 |
+
1. Why do I get the error `Parse error: syntax error, unexpected '[' in /home/..../wp-content/plugins/responsive-menu/src/app/Routing/WpRouting.php on line 19`?
|
129 |
+
|
130 |
+
This is due to your PHP version not being high enough, you need at least PHP 5.4 for the plugin to work.
|
131 |
+
|
132 |
+
2. I am getting a message similar to `Fatal error: Uncaught exception 'Exception' with message 'parse error: failed at $hamburger-layer-color: ;`, why?
|
133 |
+
|
134 |
+
All you need to do is login to your WordPress admin, go to my plugin page and hit 'Update Options' to fix this.
|
135 |
+
|
136 |
+
To view our whole FAQ, please go to https://responsive.menu/faq/
|
137 |
+
|
138 |
+
== Screenshots ==
|
139 |
+
|
140 |
+
1. Fully customisable Admin Screen
|
141 |
+
|
142 |
+
2. Example Front End Menu Button
|
143 |
+
|
144 |
+
3. Example Front End Expanded Menu
|
145 |
+
|
146 |
+
== Changelog ==
|
147 |
+
|
148 |
+
= 3.0.0 (5th July 2016) =
|
149 |
+
* **Requires PHP 5.4** - Please ensure you have it installed to work
|
150 |
+
* Version 3 released!
|
151 |
+
* Please login to your admin and hit 'Update Options' upon installing on all sites
|
152 |
+
* Awesome FontIcon integration
|
153 |
+
* Much Smoother Animations
|
154 |
+
* Button Animations
|
155 |
+
* And much, much more
|
156 |
+
* Many bug fixes
|
157 |
+
* Completely re-written from the ground up
|
158 |
+
|
159 |
+
= 2.8.9 (17th June 2016) =
|
160 |
+
* Last Version 2 release with beta notice
|
161 |
+
|
162 |
+
= 2.8.8 (12th May 2016) =
|
163 |
+
* Added class to body when menu is opened
|
164 |
+
|
165 |
+
= 2.8.7 =
|
166 |
+
* Added absolute paths to file inclusions
|
167 |
+
* Added ability to set menu title text location (top, bottom, left, right)
|
168 |
+
* Added ability to set menu title text line height (useful for above)
|
169 |
+
* Fixed width on custom menu images for consistency
|
170 |
+
|
171 |
+
= 2.8.6 (28th January 2016) =
|
172 |
+
* Added Menu Title Link to WPML
|
173 |
+
* Fixed issue with fixed menu widths and push animation
|
174 |
+
|
175 |
+
= 2.8.5 (11th Sept 2015) =
|
176 |
+
* Fixed menu not opening on first click bug
|
177 |
+
* Added empty check to additional html content
|
178 |
+
|
179 |
+
= 2.8.4 (19th Aug 2015) =
|
180 |
+
* Fixed middle mouse scroll button bug
|
181 |
+
|
182 |
+
= 2.8.3 (13th Aug 2015) =
|
183 |
+
* Fixed bug with accordion sub arrows not re-setting correctly
|
184 |
+
|
185 |
+
= 2.8.2 (13th Aug 2015) =
|
186 |
+
* Fixed bug with push animation from right side
|
187 |
+
|
188 |
+
= 2.8.1 (27th July 2015) =
|
189 |
+
* Import/Export issue with geometric shapes fixed
|
190 |
+
* Default export.xml file added
|
191 |
+
* Other bugfixes
|
192 |
+
|
193 |
+
= 2.8 (26th July 2015) =
|
194 |
+
* Launched Pro Version 1.0 with:
|
195 |
+
- Ability to use as the only menu on the site (responsive and desktop)
|
196 |
+
- Option to only show on mobile using wp_is_mobile()
|
197 |
+
- Various colour themes
|
198 |
+
- Header bar creator
|
199 |
+
- Menu Auto-Height option
|
200 |
+
- Background scrolling disabled option
|
201 |
+
* Added "Reset to default" option
|
202 |
+
* Removed Metatag check
|
203 |
+
* Improved transient caching
|
204 |
+
* Bugfixes
|
205 |
+
|
206 |
+
= 2.7 (14th June 2015) =
|
207 |
+
* Added Navigation Tabs for Admin Pages -thanks to mkdgs for this!
|
208 |
+
* Bugfixes
|
209 |
+
|
210 |
+
= 2.6 (26th May 2015) =
|
211 |
+
* Added Theme Location options - useful for Polylang - Thanks to mkdgs for this
|
212 |
+
* Fixed Issue with Auto-Expanding Links
|
213 |
+
* Fixed Issue with Data Folders Incorrect Location
|
214 |
+
|
215 |
+
= 2.5 (20th May 2015) =
|
216 |
+
* Fixed issue with duplicate sub menu arrows
|
217 |
+
* Added option to set if menu is shown on left or right
|
218 |
+
* Fixed issue with custom sub menu classes
|
219 |
+
* Button now compatible with Apple Voiceover
|
220 |
+
* Changed "X" close icon to the math symbol "x" - Thanks to patlog for the idea!
|
221 |
+
* Added many more shortcode options as below:
|
222 |
+
|
223 |
+
- "title"
|
224 |
+
- "title_link"
|
225 |
+
- "title_open"
|
226 |
+
- "title_img"
|
227 |
+
- "html"
|
228 |
+
- "html_loc"
|
229 |
+
- "search_loc"
|
230 |
+
- "btn_img"
|
231 |
+
- "btn_img_clicked"
|
232 |
+
- "btn_title"
|
233 |
+
|
234 |
+
= 2.4 (18th Feb 2015) =
|
235 |
+
|
236 |
+
* Added option to turn transient caching off as it causes issues with active link colours etc.
|
237 |
+
* Made Menu clear the transient caches and rebuild menu on Menu/Page/Post updates.
|
238 |
+
|
239 |
+
= 2.3 (16th Feb 2015) =
|
240 |
+
|
241 |
+
* Added ability to set custom click menu trigger
|
242 |
+
* Added ability to set custom walker function - Thanks to Mickael Desgranges for this
|
243 |
+
* Added option to push menu button with animation
|
244 |
+
* Added option to change Current Page background hover colour
|
245 |
+
* Added option to change Current Page Link hover colour
|
246 |
+
* Fixed issue with accordion menu not retracting
|
247 |
+
* Enabled 0 values for animation speed to in affect remove animation
|
248 |
+
* Added easy view of Shortcode options in admin
|
249 |
+
* Added ability to place shortcodes in extra html content - Thanks to Mickael Desgranges for this
|
250 |
+
* Leveraged WordPress persistent transient caching to significantly increase load speed
|
251 |
+
|
252 |
+
= 2.2 (29th Oct 2014) =
|
253 |
+
|
254 |
+
* Added Ability to Export Options
|
255 |
+
* Added Ability to Import Options
|
256 |
+
* Added option to change 3 lines width
|
257 |
+
* Added option to change 3 lines height
|
258 |
+
* Added option to change 3 lines margin
|
259 |
+
* Added option to change sub arrows using HTML shape or Image
|
260 |
+
* Added option to change the click menu image once clicked
|
261 |
+
* Sub Menu Animation added to improve smoothness
|
262 |
+
* Accordion sub menu animation option
|
263 |
+
* Added shortcode option to change menu (use "RM" argument) eg. [responsive-menu RM="footer-menu"]
|
264 |
+
* Minor bug fixes
|
265 |
+
|
266 |
+
= 2.1 (17th Aug 2014) =
|
267 |
+
|
268 |
+
* Basic shortcode support added - To use, tick the option in the admin and use the shortcode [responsive-menu]
|
269 |
+
* Multiple bug fixes
|
270 |
+
|
271 |
+
= 2.0 (13th Aug 2014) =
|
272 |
+
|
273 |
+
*** WE HAVE REACHED OVER 50 CUSTOMISABLE OPTIONS! ***
|
274 |
+
|
275 |
+
* Complete overhaul of the codebase
|
276 |
+
* Increased menu depth to 5
|
277 |
+
* Added Spanish Translation - Massive thanks to Andrew @ <a href="http://www.webhostinghub.com">WebHostingHub</a> for this!
|
278 |
+
* 'Double Click' menu bug fixed
|
279 |
+
* Various bug fixes
|
280 |
+
* Added Choice to Auto Expand Parent Links
|
281 |
+
* Added Choice to Ignore Clicks on Ancestor Links
|
282 |
+
* Added Choice to Close Menu Automatically on Page Clicks
|
283 |
+
* Added Top and Bottom Slide Options
|
284 |
+
* Added Option to set a Maximum Width for the menu
|
285 |
+
* Added Choice of Positioning of Search Box
|
286 |
+
* Added Choice to Specify Title Menu Link
|
287 |
+
* Added Choice to Specify Title Menu Link Location
|
288 |
+
* Added Ability to add custom HTML snippet inside the menu
|
289 |
+
* Added Choice of location for custom HTML snippet inside the menu
|
290 |
+
* Detect if WP Login bar is active and adjust accordingly
|
291 |
+
|
292 |
+
= 1.9 (5th Apr 2014) =
|
293 |
+
|
294 |
+
* Changed where custom CSS/JS files are stored. If you have issues when upgrading, please just click "Update Options" from admin and this should return back to normal.
|
295 |
+
* Added option to include scripts in footer
|
296 |
+
* Added ability to upload custom menu button image to replace the 3 lines
|
297 |
+
* Added ability to close menu on each link click (good for single page sites)
|
298 |
+
* Added ability to minify output (saving 50% on file size)
|
299 |
+
* Remove title section if title and image are empty
|
300 |
+
* Added ability to change 3 lines to an x when clicked
|
301 |
+
* Added ability to set the minimum width of the menu
|
302 |
+
* Added Croatian Translation - Massive thanks to <a href="https://www.facebook.com/pages/Neverone-design/490262371018076">Neverone Design</a> for this!
|
303 |
+
|
304 |
+
= 1.8 (26th Mar 2014) =
|
305 |
+
|
306 |
+
* Added option to include styles/scripts externally/internally
|
307 |
+
* Added WPML Support
|
308 |
+
* Added internationalisation functionality, awaiting translations
|
309 |
+
* Added ability to choose which side the menu slides in from
|
310 |
+
* Minor Code Improvements
|
311 |
+
|
312 |
+
= 1.7 (13th Mar 2014) =
|
313 |
+
|
314 |
+
* Ability to auto expand/hide sub-menus
|
315 |
+
* Inclusion/Exclusion of Search Box
|
316 |
+
* Transition speed
|
317 |
+
* Slide Animation Speed
|
318 |
+
* Menu Link Heights
|
319 |
+
* Text Alignment
|
320 |
+
* Removed potential jQuery conflicts
|
321 |
+
* Minor Code Improvements
|
322 |
+
|
323 |
+
= 1.6 (6th Mar 2014) =
|
324 |
+
|
325 |
+
* Added Animation Options Section
|
326 |
+
* Added Animation Speed Customisation Option
|
327 |
+
* Added Choice Of Slide Animation (Overlay or Push)
|
328 |
+
* Added Menu Title Background Colour Customisation Option
|
329 |
+
* Added Menu Title Font Size Customisation Option
|
330 |
+
* Added Click Menu Title Font Size Customisation Option
|
331 |
+
* Added Menu Links Font Size Customisation Option
|
332 |
+
* Removed Image Size Restriction
|
333 |
+
* Minor Code Improvements
|
334 |
+
|
335 |
+
= 1.5 (4th Mar 2014) =
|
336 |
+
|
337 |
+
* Added Menu Title Colour Customisation Option
|
338 |
+
* Added Menu Title Hover Colour Customisation Option
|
339 |
+
* Added Menu Text Colour Customisation Option
|
340 |
+
* Added Menu Text Hover Colour Customisation Option
|
341 |
+
* Added Menu Background Colour Customisation Option
|
342 |
+
* Added Menu Link Background Hover Colour Customisation Option
|
343 |
+
* Minor Code Improvements
|
344 |
+
|
345 |
+
= 1.4 (2nd Mar 2014) =
|
346 |
+
|
347 |
+
* Improved menu sliding animation.
|
348 |
+
* Fixed bug where the menu wouldn't retract on re-size.
|
349 |
+
* Removed the use of namespaces to support pre PHP 5.3 systems.
|
350 |
+
|
351 |
+
= 1.3 (1st Mar 2014) =
|
352 |
+
|
353 |
+
* Added ability to upload image for menu title.
|
354 |
+
* Added ability to switch between fixed and non-fixed positioning.
|
355 |
+
* Added ability to change menu font.
|
356 |
+
* Minor updates.
|
357 |
+
|
358 |
+
= 1.2 (28th Feb 2014) =
|
359 |
+
|
360 |
+
* Added support to include all site menus.
|
361 |
+
|
362 |
+
= 1.1 (25th Feb 2014) =
|
363 |
+
|
364 |
+
* Added transparent menu background option.
|
365 |
+
|
366 |
+
= 1.0 (22nd Feb 2014) =
|
367 |
+
|
368 |
+
* Initial Version Released.
|
369 |
+
|
370 |
+
== Upgrade Notice ==
|
responsive-menu.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
Plugin Name: Responsive Menu
|
5 |
+
Plugin URI: http://responsive.menu
|
6 |
+
Description: Highly Customisable Responsive Menu Plugin for WordPress
|
7 |
+
Version: 3.0.0
|
8 |
+
Author: Responsive Menu
|
9 |
+
Text Domain: responsive-menu
|
10 |
+
Author URI: http://responsive.menu
|
11 |
+
License: GPL2
|
12 |
+
Tags: responsive, menu, responsive menu
|
13 |
+
*/
|
14 |
+
|
15 |
+
/* Check correct PHP version first */
|
16 |
+
register_activation_hook(__FILE__, 'activate_responsive_menu');
|
17 |
+
function activate_responsive_menu() {
|
18 |
+
if(version_compare(PHP_VERSION, '5.4', '<')):
|
19 |
+
deactivate_plugins(plugin_basename(__FILE__ ));
|
20 |
+
wp_die(sprintf('Responsive Menu requires PHP 5.4 or higher. You are still on %s', PHP_VERSION));
|
21 |
+
endif;
|
22 |
+
}
|
23 |
+
|
24 |
+
/* Required includes for plugin to function */
|
25 |
+
include dirname(__FILE__) . '/autoload.php';
|
26 |
+
include dirname(__FILE__) . '/src/config/route_dependencies.php';
|
27 |
+
|
28 |
+
/* Internationalise the plugin */
|
29 |
+
add_action('plugins_loaded', function() {
|
30 |
+
load_plugin_textdomain('responsive-menu', false, basename(dirname(__FILE__)) . '/translations/');
|
31 |
+
});
|
32 |
+
|
33 |
+
/* Route the plugin */
|
34 |
+
$wp_router = new ResponsiveMenu\Routing\WpRouting($container);
|
35 |
+
$wp_router->route();
|
36 |
+
|
37 |
+
if(is_admin()):
|
38 |
+
include dirname(__FILE__) . '/src/config/default_options.php';
|
39 |
+
$migration = new ResponsiveMenu\Database\Migration($container['database'], $default_options);
|
40 |
+
$migration->setup();
|
41 |
+
$migration->synchronise();
|
42 |
+
endif;
|
src/app/Collections/OptionsCollection.php
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Collections;
|
4 |
+
use ResponsiveMenu\Models\Option as Option;
|
5 |
+
|
6 |
+
class OptionsCollection implements \ArrayAccess {
|
7 |
+
|
8 |
+
private $options;
|
9 |
+
|
10 |
+
public function add(Option $option) {
|
11 |
+
$this->options[$option->getName()] = $option;
|
12 |
+
}
|
13 |
+
|
14 |
+
public function get($name) {
|
15 |
+
return $this->options[$name];
|
16 |
+
}
|
17 |
+
|
18 |
+
public function all() {
|
19 |
+
return $this->options;
|
20 |
+
}
|
21 |
+
|
22 |
+
public function usesFontIcons() {
|
23 |
+
return false;
|
24 |
+
}
|
25 |
+
|
26 |
+
public function getActiveArrow() {
|
27 |
+
if($this->options['active_arrow_image'] && $this->options['active_arrow_image']->getValue())
|
28 |
+
return '<img src="' . $this->options['active_arrow_image'] .'" />';
|
29 |
+
else
|
30 |
+
return $this->options['active_arrow_shape'];
|
31 |
+
|
32 |
+
}
|
33 |
+
|
34 |
+
public function getInActiveArrow() {
|
35 |
+
if($this->options['inactive_arrow_image'] && $this->options['inactive_arrow_image']->getValue())
|
36 |
+
return '<img src="' . $this->options['inactive_arrow_image'] .'" />';
|
37 |
+
else
|
38 |
+
return $this->options['inactive_arrow_shape'];
|
39 |
+
|
40 |
+
}
|
41 |
+
|
42 |
+
public function getTitleImage() {
|
43 |
+
if($this->options['menu_title_image'] && $this->options['menu_title_image']->getValue())
|
44 |
+
return '<img src="' . $this->options['menu_title_image'] .'" />';
|
45 |
+
else
|
46 |
+
return null;
|
47 |
+
|
48 |
+
}
|
49 |
+
|
50 |
+
public function getButtonIcon() {
|
51 |
+
if($this->options['button_image'] && $this->options['button_image']->getValue())
|
52 |
+
return '<img src="' . $this->options['button_image'] .'" class="responsive-menu-button-icon responsive-menu-button-icon-active" />';
|
53 |
+
else
|
54 |
+
return '<span class="responsive-menu-inner"></span>';
|
55 |
+
}
|
56 |
+
|
57 |
+
public function getButtonIconActive() {
|
58 |
+
if($this->options['button_image'] && $this->options['button_image']->getValue())
|
59 |
+
return '<img src="' . $this->options['button_image_when_clicked'] .'" class=" responsive-menu-button-icon responsive-menu-button-icon-inactive" />';
|
60 |
+
}
|
61 |
+
|
62 |
+
public function offsetExists($offset) {
|
63 |
+
return array_key_exists($offset, $this->options);
|
64 |
+
}
|
65 |
+
|
66 |
+
public function offsetGet($offset) {
|
67 |
+
return $this->options[$offset];
|
68 |
+
}
|
69 |
+
|
70 |
+
public function offsetSet($offset, $value) {
|
71 |
+
if(isset($this->options[$offset]))
|
72 |
+
$this->options[$offset]->setValue($value);
|
73 |
+
}
|
74 |
+
|
75 |
+
public function offsetUnset($offset) {
|
76 |
+
unset($this->options[$offset]);
|
77 |
+
}
|
78 |
+
|
79 |
+
}
|
src/app/Controllers/Admin/Base.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Controllers\Admin;
|
4 |
+
use ResponsiveMenu\View\View as View;
|
5 |
+
use ResponsiveMenu\Repositories\Options\Repository as Repository;
|
6 |
+
|
7 |
+
class Base
|
8 |
+
{
|
9 |
+
|
10 |
+
public function __construct(Repository $repository, View $view)
|
11 |
+
{
|
12 |
+
$this->repository = $repository;
|
13 |
+
$this->view = $view;
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
src/app/Controllers/Admin/Main.php
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Controllers\Admin;
|
4 |
+
use ResponsiveMenu\Factories\OptionFactory as OptionFactory;
|
5 |
+
use ResponsiveMenu\Factories\AdminSaveFactory as SaveFactory;
|
6 |
+
use ResponsiveMenu\WPML\WPML as WPML;
|
7 |
+
|
8 |
+
class Main extends Base
|
9 |
+
{
|
10 |
+
|
11 |
+
public function update($default_options)
|
12 |
+
{
|
13 |
+
|
14 |
+
$options = array_merge($default_options, $_POST['menu']);
|
15 |
+
|
16 |
+
foreach($options as $key => $val):
|
17 |
+
$option_factory = new OptionFactory;
|
18 |
+
$option = $option_factory->build($key, $val);
|
19 |
+
$this->repository->update($option);
|
20 |
+
endforeach;
|
21 |
+
|
22 |
+
$options = $this->repository->all();
|
23 |
+
$save_factory = new SaveFactory();
|
24 |
+
$flash['errors'] = $save_factory->build($options);
|
25 |
+
$flash['success'] = __('Responsive Menu Options Updated Successfully', 'responsive-menu');
|
26 |
+
|
27 |
+
$wpml = new WPML;
|
28 |
+
$wpml->saveFromOptions($options);
|
29 |
+
|
30 |
+
$this->view->render('main', ['options' => $options, 'flash' => $flash]);
|
31 |
+
|
32 |
+
}
|
33 |
+
|
34 |
+
public function reset($default_options)
|
35 |
+
{
|
36 |
+
|
37 |
+
foreach($default_options as $key => $val):
|
38 |
+
$option_factory = new OptionFactory;
|
39 |
+
$option = $option_factory->build($key, $val);
|
40 |
+
$this->repository->update($option);
|
41 |
+
endforeach;
|
42 |
+
|
43 |
+
$options = $this->repository->all();
|
44 |
+
$save_factory = new SaveFactory();
|
45 |
+
$flash['errors'] = $save_factory->build($options);
|
46 |
+
$flash['success'] = __('Responsive Menu Options Reset Successfully', 'responsive-menu');
|
47 |
+
|
48 |
+
$wpml = new WPML;
|
49 |
+
$wpml->saveFromOptions($options);
|
50 |
+
|
51 |
+
$this->view->render('main', ['options' => $options, 'flash' => $flash]);
|
52 |
+
|
53 |
+
}
|
54 |
+
|
55 |
+
public function index() {
|
56 |
+
$this->view->render('main', ['options' => $this->repository->all()]);
|
57 |
+
}
|
58 |
+
|
59 |
+
public function import() {
|
60 |
+
|
61 |
+
if(!empty($_FILES['responsive_menu_import_file']['tmp_name'])):
|
62 |
+
$file = file_get_contents($_FILES['responsive_menu_import_file']['tmp_name']);
|
63 |
+
$decoded = json_decode($file);
|
64 |
+
foreach($decoded as $key => $val):
|
65 |
+
$option_factory = new OptionFactory;
|
66 |
+
$option = $option_factory->build($key, $val);
|
67 |
+
$this->repository->update($option);
|
68 |
+
endforeach;
|
69 |
+
|
70 |
+
$options = $this->repository->all();
|
71 |
+
$save_factory = new SaveFactory();
|
72 |
+
$flash['errors'] = $save_factory->build($options);
|
73 |
+
$flash['success'] = __('Responsive Menu Options Reset Successfully', 'responsive-menu');
|
74 |
+
else:
|
75 |
+
$flash['errors'][] = __('No file selected', 'responsive-menu');
|
76 |
+
$options = $this->repository->all();
|
77 |
+
endif;
|
78 |
+
|
79 |
+
$wpml = new WPML;
|
80 |
+
$wpml->saveFromOptions($options);
|
81 |
+
|
82 |
+
$this->view->render('main', ['options' => $options, 'flash' => $flash]);
|
83 |
+
}
|
84 |
+
|
85 |
+
public function export() {
|
86 |
+
nocache_headers();
|
87 |
+
header( 'Content-Type: application/json; charset=utf-8' );
|
88 |
+
header( 'Content-Disposition: attachment; filename=export.json' );
|
89 |
+
header( "Expires: 0" );
|
90 |
+
$final = [];
|
91 |
+
foreach($this->repository->all()->all() as $option)
|
92 |
+
$final[$option->getName()] = $option->getValue();
|
93 |
+
echo json_encode($final);
|
94 |
+
exit();
|
95 |
+
}
|
96 |
+
|
97 |
+
}
|
src/app/Controllers/Base.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Controllers;
|
4 |
+
use ResponsiveMenu\View\View as View;
|
5 |
+
use ResponsiveMenu\Repositories\Options\ReadRepository as Repository;
|
6 |
+
|
7 |
+
class Base
|
8 |
+
{
|
9 |
+
|
10 |
+
public function __construct(Repository $repository, View $view)
|
11 |
+
{
|
12 |
+
$this->repository = $repository;
|
13 |
+
$this->view = $view;
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
src/app/Controllers/Front.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Controllers;
|
4 |
+
use ResponsiveMenu\Controllers\Base as Base;
|
5 |
+
use ResponsiveMenu\ViewModels\Menu as MenuViewModel;
|
6 |
+
use ResponsiveMenu\ViewModels\Button as ButtonViewModel;
|
7 |
+
use ResponsiveMenu\Factories\FrontDisplayFactory as DisplayFactory;
|
8 |
+
use ResponsiveMenu\Shortcodes\ResponsiveMenuShortcode as Shortcode;
|
9 |
+
|
10 |
+
class Front extends Base
|
11 |
+
{
|
12 |
+
public function index()
|
13 |
+
{
|
14 |
+
# Get Latest Options
|
15 |
+
$options = $this->repository->all();
|
16 |
+
|
17 |
+
# This needs refactoring - Martin Fowler HELP!
|
18 |
+
$display_factory = new DisplayFactory();
|
19 |
+
$display_factory->build($options);
|
20 |
+
|
21 |
+
# Build Our Menu Display
|
22 |
+
$menu = new MenuViewModel($options);
|
23 |
+
$html = new ButtonViewModel($options);
|
24 |
+
|
25 |
+
# Only render if we don't have shortcodes turned on
|
26 |
+
if($options['shortcode'] == 'off'):
|
27 |
+
$this->view->render('button', ['options' => $options, 'button' => $html->getHtml()]);
|
28 |
+
$this->view->render('menu', ['options' => $options, 'menu' => $menu->getHtml()]);
|
29 |
+
else:
|
30 |
+
add_shortcode('responsive_menu', function($atts) use($options, $html, $menu) {
|
31 |
+
|
32 |
+
if($atts)
|
33 |
+
array_walk($atts, function($a, $b) use ($options) { $options[$b] = $a; });
|
34 |
+
|
35 |
+
$html = $this->view->make('button', ['options' => $options, 'button' => $html->getHtml()]);
|
36 |
+
|
37 |
+
return $html . $this->view->make('menu', ['options' => $options, 'menu' => $menu->getHtml()]);
|
38 |
+
|
39 |
+
});
|
40 |
+
endif;
|
41 |
+
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
src/app/Database/Database.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Database;
|
4 |
+
|
5 |
+
interface Database
|
6 |
+
{
|
7 |
+
public function update(array $to_update, array $where);
|
8 |
+
public function delete($name);
|
9 |
+
public function all();
|
10 |
+
public function insert(array $arguments);
|
11 |
+
}
|
src/app/Database/Migration.php
ADDED
@@ -0,0 +1,193 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Database;
|
4 |
+
use ResponsiveMenu\Options\Options as Options;
|
5 |
+
use ResponsiveMenu\Database\Database as Database;
|
6 |
+
|
7 |
+
class Migration{
|
8 |
+
|
9 |
+
protected $db;
|
10 |
+
|
11 |
+
protected static $version_var = 'RMVer';
|
12 |
+
protected static $old_options_var = 'RMOptions';
|
13 |
+
|
14 |
+
public function __construct(Database $db, $default_options)
|
15 |
+
{
|
16 |
+
$this->db = $db;
|
17 |
+
$this->defaults = $default_options;
|
18 |
+
}
|
19 |
+
|
20 |
+
protected function addNewOptions()
|
21 |
+
{
|
22 |
+
# If DB is empty we need to fill it up!
|
23 |
+
$options = $this->db->all();
|
24 |
+
if(empty($options)):
|
25 |
+
foreach($this->defaults as $name => $value)
|
26 |
+
$this->db->insert(array('name' => $name, 'value' => $value));
|
27 |
+
# Otherwise we only add new options
|
28 |
+
else:
|
29 |
+
foreach($options as $converted)
|
30 |
+
$current[$converted->name] = $converted->value;
|
31 |
+
$final = array_diff_key($this->defaults, $current);
|
32 |
+
if(is_array($final)):
|
33 |
+
foreach($final as $name => $value)
|
34 |
+
$this->db->insert(array('name' => $name, 'value' => $value));
|
35 |
+
endif;
|
36 |
+
endif;
|
37 |
+
}
|
38 |
+
|
39 |
+
protected function tidyUpOptions()
|
40 |
+
{
|
41 |
+
$current = array_map(function($a) { return $a->name; }, $this->db->all());
|
42 |
+
foreach(array_diff($current, array_keys($this->defaults)) as $to_delete)
|
43 |
+
$this->db->delete(array('name' => $to_delete));
|
44 |
+
}
|
45 |
+
|
46 |
+
public function setup()
|
47 |
+
{
|
48 |
+
# Create the database table if it doesn't exist
|
49 |
+
$sql = "CREATE TABLE IF NOT EXISTS " . $this->db->table . " (
|
50 |
+
name varchar(50) NOT NULL,
|
51 |
+
value varchar(5000) DEFAULT NULL,
|
52 |
+
created_at datetime NOT NULL,
|
53 |
+
updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
54 |
+
PRIMARY KEY (name)
|
55 |
+
) " . $this->db->db->get_charset_collate() . ";";
|
56 |
+
require_once(ABSPATH . 'wp-admin/includes/upgrade.php' );
|
57 |
+
dbDelta($sql);
|
58 |
+
}
|
59 |
+
|
60 |
+
public function synchronise()
|
61 |
+
{
|
62 |
+
# First Thing we need to do is migrate any old options
|
63 |
+
if(!$this->isVersion3($this->getOldVersion())):
|
64 |
+
$this->migrateVersion2Options();
|
65 |
+
endif;
|
66 |
+
|
67 |
+
# Now we can add any new options
|
68 |
+
$this->addNewOptions();
|
69 |
+
|
70 |
+
# Finally delete any that are no longer used
|
71 |
+
$this->tidyUpOptions();
|
72 |
+
|
73 |
+
# Perform any version specific updates
|
74 |
+
if($this->needsUpdate($this->getOldVersion(), $this->getCurrentVersion())):
|
75 |
+
$this->updateVersion();
|
76 |
+
endif;
|
77 |
+
}
|
78 |
+
|
79 |
+
protected function needsUpdate($current_version, $old_version)
|
80 |
+
{
|
81 |
+
return version_compare($current_version, $old_version, '<');
|
82 |
+
}
|
83 |
+
|
84 |
+
protected function getOldVersion()
|
85 |
+
{
|
86 |
+
return get_option(self::$version_var);
|
87 |
+
}
|
88 |
+
|
89 |
+
protected function updateVersion()
|
90 |
+
{
|
91 |
+
update_option(self::$version_var, $this->getCurrentVersion());
|
92 |
+
}
|
93 |
+
|
94 |
+
protected function isVersion3($version)
|
95 |
+
{
|
96 |
+
return substr($version, 0, 1) == 3;
|
97 |
+
}
|
98 |
+
|
99 |
+
protected function migrateVersion2Options()
|
100 |
+
{
|
101 |
+
$old_options = get_option(self::$old_options_var);
|
102 |
+
|
103 |
+
$new_options = [
|
104 |
+
'menu_to_use' => $old_options['RM'] ? $old_options['RM'] : '',
|
105 |
+
'breakpoint' => $old_options['RMBreak'] ? $old_options['RMBreak'] : '',
|
106 |
+
'menu_depth' => $old_options['RMDepth'] ? $old_options['RMDepth'] : '',
|
107 |
+
'button_top' => $old_options['RMTop'] ? $old_options['RMTop'] : '',
|
108 |
+
'button_distance_from_side' => $old_options['RMRight'] ? $old_options['RMRight'] : '',
|
109 |
+
'menu_to_hide' => $old_options['RMCss'] ? $old_options['RMCss'] : '',
|
110 |
+
'menu_title' => $old_options['RMTitle'] ? $old_options['RMTitle'] : '',
|
111 |
+
'button_line_colour' => $old_options['RMLineCol'] ? $old_options['RMLineCol'] : '',
|
112 |
+
'button_background_colour' => $old_options['RMClickBkg'] ? $old_options['RMClickBkg'] : '',
|
113 |
+
'button_title' => $old_options['RMClickTitle'] ? $old_options['RMClickTitle'] : '',
|
114 |
+
'button_transparent_background' => $old_options['RMBkgTran'] ? 'on' : 'off',
|
115 |
+
'menu_font' => $old_options['RMFont'] ? $old_options['RMFont'] : '',
|
116 |
+
'button_position_type' => $old_options['RMPos'] ? 'fixed' : '',
|
117 |
+
'menu_title_image' => $old_options['RMImage'] ? $old_options['RMImage'] : '',
|
118 |
+
'menu_width' => $old_options['RMWidth'] ? $old_options['RMWidth'] : '',
|
119 |
+
'menu_item_background_colour' => $old_options['RMBkg'] ? $old_options['RMBkg'] : '',
|
120 |
+
'menu_background_colour' => $old_options['RMBkg'] ? $old_options['RMBkg'] : '',
|
121 |
+
'menu_sub_arrow_background_colour' => $old_options['RMBkg'] ? $old_options['RMBkg'] : '',
|
122 |
+
'menu_item_background_hover_colour' => $old_options['RMBkgHov'] ? $old_options['RMBkgHov'] : '',
|
123 |
+
'menu_sub_arrow_background_hover_colour' => $old_options['RMBkgHov'] ? $old_options['RMBkgHov'] : '',
|
124 |
+
'menu_title_colour' => $old_options['RMTitleCol'] ? $old_options['RMTitleCol'] : '',
|
125 |
+
'menu_link_colour' => $old_options['RMTextCol'] ? $old_options['RMTextCol'] : '',
|
126 |
+
'menu_sub_arrow_shape_colour' => $old_options['RMTextCol'] ? $old_options['RMTextCol'] : '',
|
127 |
+
'menu_item_border_colour' => $old_options['RMBorCol'] ? $old_options['RMBorCol'] : '',
|
128 |
+
'menu_item_border_colour_hover' => $old_options['RMBorCol'] ? $old_options['RMBorCol'] : '',
|
129 |
+
'menu_sub_arrow_border_colour' => $old_options['RMBorCol'] ? $old_options['RMBorCol'] : '',
|
130 |
+
'menu_sub_arrow_border_hover_colour' => $old_options['RMBorCol'] ? $old_options['RMBorCol'] : '',
|
131 |
+
'menu_link_hover_colour' => $old_options['RMTextColHov'] ? $old_options['RMTextColHov'] : '',
|
132 |
+
'menu_sub_arrow_shape_hover_colour' => $old_options['RMTextColHov'] ? $old_options['RMTextColHov'] : '',
|
133 |
+
'menu_title_hover_colour' => $old_options['RMTitleColHov'] ? $old_options['RMTitleColHov'] : '',
|
134 |
+
'animation_type' => $old_options['RMAnim'] == 'overlay' ? 'slide' : 'push',
|
135 |
+
'page_wrapper' => $old_options['RMPushCSS'] ? $old_options['RMPushCSS'] : '',
|
136 |
+
'menu_title_background_colour' => $old_options['RMTitleBkg'] ? $old_options['RMTitleBkg'] : '',
|
137 |
+
'menu_title_background_hover_colour' => $old_options['RMTitleBkg'] ? $old_options['RMTitleBkg'] : '',
|
138 |
+
'menu_font_size' => $old_options['RMFontSize'] ? $old_options['RMFontSize'] : '',
|
139 |
+
'menu_title_font_size' => $old_options['RMTitleSize'] ? $old_options['RMTitleSize'] : '',
|
140 |
+
'button_font_size' => $old_options['RMBtnSize'] ? $old_options['RMBtnSize'] : '',
|
141 |
+
'menu_current_item_background_colour' => $old_options['RMCurBkg'] ? $old_options['RMCurBkg'] : '',
|
142 |
+
'menu_current_link_colour' => $old_options['RMCurCol'] ? $old_options['RMCurCol'] : '',
|
143 |
+
'animation_speed' => $old_options['RMAnimSpd'] ? $old_options['RMAnimSpd'] : '',
|
144 |
+
'transition_speed' => $old_options['RMTranSpd'] ? $old_options['RMTranSpd'] : '',
|
145 |
+
'menu_text_alignment' => $old_options['RMTxtAlign'] ? $old_options['RMTxtAlign'] : '',
|
146 |
+
'auto_expand_all_submenus' => $old_options['RMExpand'] ? 'on' : 'off',
|
147 |
+
'menu_links_height' => $old_options['RMLinkHeight'] ? $old_options['RMLinkHeight'] + 24 : '',
|
148 |
+
'submenu_arrow_height' => $old_options['RMLinkHeight'] ? $old_options['RMLinkHeight'] + 24 : '',
|
149 |
+
'submenu_arrow_width' => $old_options['RMLinkHeight'] ? $old_options['RMLinkHeight'] + 24 : '',
|
150 |
+
'external_files' => $old_options['RMExternal'] ? 'on' : 'off',
|
151 |
+
'menu_appear_from' => $old_options['RMSide'] ? $old_options['RMSide'] : '',
|
152 |
+
'scripts_in_footer' => $old_options['RMFooter'] ? 'on' : 'off',
|
153 |
+
'button_image' => $old_options['RMClickImg'] ? $old_options['RMClickImg'] : '',
|
154 |
+
'minify_scripts' => $old_options['RMMinify'] ? 'on' : 'off',
|
155 |
+
'menu_close_on_link_click' => $old_options['RMClickClose'] ? 'on' : 'off',
|
156 |
+
'menu_minimum_width' => $old_options['RMMinWidth'] ? $old_options['RMMinWidth'] : '',
|
157 |
+
'menu_maximum_width' => $old_options['RMMaxWidth'] ? $old_options['RMMaxWidth'] : '',
|
158 |
+
'auto_expand_current_submenus' => $old_options['RMExpandPar'] ? 'on' : 'off',
|
159 |
+
'menu_item_click_to_trigger_submenu' => $old_options['RMIgnParCli'] ? 'on' : 'off',
|
160 |
+
'menu_close_on_body_click' => $old_options['RMCliToClo'] ? 'on' : 'off',
|
161 |
+
'menu_title_link' => $old_options['RMTitleLink'] ? $old_options['RMTitleLink'] : '',
|
162 |
+
'menu_additional_content' => $old_options['RMHtml'] ? $old_options['RMHtml'] : '',
|
163 |
+
'shortcode' => $old_options['RMShortcode'] ? 'on' : 'off',
|
164 |
+
'button_line_height' => $old_options['RMLineHeight'] ? $old_options['RMLineHeight'] : '',
|
165 |
+
'button_line_width' => $old_options['RMLineWidth'] ? $old_options['RMLineWidth'] : '',
|
166 |
+
'button_line_margin' => $old_options['RMLineMargin'] ? $old_options['RMLineMargin'] : '',
|
167 |
+
'button_image_when_clicked' => $old_options['RMClickImgClicked'] ? $old_options['RMClickImgClicked'] : '',
|
168 |
+
'accordion_animation' => $old_options['RMAccordion'] ? 'on' : 'off',
|
169 |
+
'active_arrow_shape' => $old_options['RMArShpA'] ? json_decode($old_options['RMArShpA']) : '',
|
170 |
+
'inactive_arrow_shape' => $old_options['RMArShpI'] ? json_decode($old_options['RMArShpI']) : '',
|
171 |
+
'active_arrow_image' => $old_options['RMArImgA'] ? $old_options['RMArImgA'] : '',
|
172 |
+
'inactive_arrow_image' => $old_options['RMArImgI'] ? $old_options['RMArImgI'] : '',
|
173 |
+
'button_push_with_animation' => $old_options['RMPushBtn'] ? 'on' : 'off',
|
174 |
+
'menu_current_item_background_hover_colour' => $old_options['RMCurBkgHov'] ? $old_options['RMCurBkgHov'] : '',
|
175 |
+
'menu_current_link_hover_colour' => $old_options['RMCurColHov'] ? $old_options['RMCurColHov'] : '',
|
176 |
+
'custom_walker' => $old_options['RMWalker'] ? $old_options['RMWalker'] : '',
|
177 |
+
'button_left_or_right' => $old_options['RMLoc'] ? $old_options['RMLoc'] : '',
|
178 |
+
'theme_location_menu' => $old_options['RMThemeLocation'] ? $old_options['RMThemeLocation'] : '',
|
179 |
+
'button_title_position' => $old_options['RMClickTitlePos'] ? $old_options['RMClickTitlePos'] : '',
|
180 |
+
];
|
181 |
+
|
182 |
+
foreach(array_filter($new_options) as $key => $val)
|
183 |
+
$this->db->insert(array('name' => $key, 'value' => $val));
|
184 |
+
|
185 |
+
}
|
186 |
+
|
187 |
+
public function getCurrentVersion()
|
188 |
+
{
|
189 |
+
$plugin_data = get_plugin_data(dirname(dirname(dirname(dirname(__FILE__)))) . '/responsive-menu.php', false, false);
|
190 |
+
return $plugin_data['Version'];
|
191 |
+
}
|
192 |
+
|
193 |
+
}
|
src/app/Database/WpDatabase.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Database;
|
4 |
+
|
5 |
+
class WpDatabase implements Database {
|
6 |
+
|
7 |
+
protected static $table_name = 'responsive_menu';
|
8 |
+
|
9 |
+
public function __construct()
|
10 |
+
{
|
11 |
+
global $wpdb;
|
12 |
+
$this->db = $wpdb;
|
13 |
+
$this->table = $this->db->prefix . self::$table_name;
|
14 |
+
}
|
15 |
+
|
16 |
+
public function update(array $to_update, array $where)
|
17 |
+
{
|
18 |
+
$this->db->update($this->table, $to_update, $where);
|
19 |
+
}
|
20 |
+
|
21 |
+
public function delete($name)
|
22 |
+
{
|
23 |
+
$this->db->delete($this->table, $name);
|
24 |
+
}
|
25 |
+
|
26 |
+
public function all()
|
27 |
+
{
|
28 |
+
return $this->db->get_results("SELECT * FROM $this->table");
|
29 |
+
}
|
30 |
+
|
31 |
+
public function insert(array $arguments)
|
32 |
+
{
|
33 |
+
$arguments['created_at'] = current_time('mysql');
|
34 |
+
$this->db->insert($this->table, $arguments);
|
35 |
+
}
|
36 |
+
|
37 |
+
public function select($column, $value)
|
38 |
+
{
|
39 |
+
return $this->db->get_results("SELECT * FROM $this->table WHERE $column = '$value';");
|
40 |
+
}
|
41 |
+
|
42 |
+
}
|
src/app/Factories/AdminSaveFactory.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Factories;
|
4 |
+
use ResponsiveMenu\Filesystem\FileCreator as FileCreator;
|
5 |
+
use ResponsiveMenu\Factories\CssFactory as CssFactory;
|
6 |
+
use ResponsiveMenu\Factories\JsFactory as JsFactory;
|
7 |
+
use ResponsiveMenu\Collections\OptionsCollection as OptionsCollection;
|
8 |
+
|
9 |
+
class AdminSaveFactory {
|
10 |
+
|
11 |
+
public function build(OptionsCollection $options) {
|
12 |
+
|
13 |
+
$flash = [];
|
14 |
+
|
15 |
+
if($options['external_files'] == 'on'):
|
16 |
+
|
17 |
+
$css_factory = new CssFactory;
|
18 |
+
$js_factory = new JsFactory;
|
19 |
+
$file_creator = new FileCreator;
|
20 |
+
|
21 |
+
# Create Data Folders if They don't exist
|
22 |
+
$data_folder_dir = dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/responsive-menu-data';
|
23 |
+
$js_folder = $data_folder_dir . '/js';
|
24 |
+
$css_folder = $data_folder_dir . '/css';
|
25 |
+
if($options['external_files'] == 'on' && !is_dir($data_folder_dir)):
|
26 |
+
if(!mkdir($data_folder_dir)) $flash['errors'][] = __('Unable to make data directory', 'responsive-menu');
|
27 |
+
if(!mkdir($css_folder)) $flass['errors'][] = __('Unable to make CSS data directory', 'responsive-menu');
|
28 |
+
if(!mkdir($js_folder)) $flash['errors'][] = __('Unable to make JS data directory', 'responsive-menu');
|
29 |
+
endif;
|
30 |
+
|
31 |
+
$css = $css_factory->build($options);
|
32 |
+
$js = $js_factory->build($options);
|
33 |
+
|
34 |
+
if(!$file_creator->createCssFile($css_folder, 'responsive-menu-' . get_current_blog_id() . '.css', $css))
|
35 |
+
$flash['errors'][] = __('Unable to create CSS file', 'responsive-menu');
|
36 |
+
|
37 |
+
if(!$file_creator->createJsFile($js_folder, 'responsive-menu-' . get_current_blog_id() . '.js', $js))
|
38 |
+
$flash['errors'][] = __('Unable to create JS file', 'responsive-menu');
|
39 |
+
|
40 |
+
endif;
|
41 |
+
|
42 |
+
return empty($flash) ? null : $flash;
|
43 |
+
|
44 |
+
}
|
45 |
+
}
|
src/app/Factories/CssFactory.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Factories;
|
4 |
+
use ResponsiveMenu\Mappers\ScssBaseMapper as ScssBaseMapper;
|
5 |
+
use ResponsiveMenu\Mappers\ScssButtonMapper as ScssButtonMapper;
|
6 |
+
use ResponsiveMenu\Mappers\ScssMenuMapper as ScssMenuMapper;
|
7 |
+
use ResponsiveMenu\Formatters\Minify as Minify;
|
8 |
+
use ResponsiveMenu\Collections\OptionsCollection as OptionsCollection;
|
9 |
+
|
10 |
+
class CssFactory {
|
11 |
+
|
12 |
+
public function build(OptionsCollection $options) {
|
13 |
+
|
14 |
+
$css_base_mapper = new ScssBaseMapper($options);
|
15 |
+
$css_base = $css_base_mapper->map();
|
16 |
+
|
17 |
+
$css_button_mapper = new ScssButtonMapper($options);
|
18 |
+
$css_button = $css_button_mapper->map();
|
19 |
+
|
20 |
+
$css_menu_mapper = new ScssMenuMapper($options);
|
21 |
+
$css_menu = $css_menu_mapper->map();
|
22 |
+
|
23 |
+
$css = $css_base . $css_button . $css_menu;
|
24 |
+
|
25 |
+
if($options['minify_scripts'] == 'on'):
|
26 |
+
$minifier = new Minify;
|
27 |
+
$css = $minifier->minify($css);
|
28 |
+
endif;
|
29 |
+
|
30 |
+
return $css;
|
31 |
+
|
32 |
+
}
|
33 |
+
|
34 |
+
}
|
src/app/Factories/FrontDisplayFactory.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Factories;
|
4 |
+
use ResponsiveMenu\Factories\CssFactory as CssFactory;
|
5 |
+
use ResponsiveMenu\Factories\JsFactory as JsFactory;
|
6 |
+
use ResponsiveMenu\Collections\OptionsCollection as OptionsCollection;
|
7 |
+
|
8 |
+
class FrontDisplayFactory {
|
9 |
+
|
10 |
+
public function build(OptionsCollection $options) {
|
11 |
+
|
12 |
+
$css_factory = new CssFactory;
|
13 |
+
$js_factory = new JsFactory;
|
14 |
+
|
15 |
+
$css = $css_factory->build($options);
|
16 |
+
$js = $js_factory->build($options);
|
17 |
+
|
18 |
+
add_filter('body_class', function($classes) use($options) {
|
19 |
+
$classes[] = 'responsive-menu-' . $options['animation_type'] . '-' . $options['menu_appear_from'];
|
20 |
+
return $classes;
|
21 |
+
});
|
22 |
+
|
23 |
+
wp_enqueue_script('jquery');
|
24 |
+
|
25 |
+
if($options['external_files'] == 'on') :
|
26 |
+
$data_folder_dir = plugins_url(). '/responsive-menu-data';
|
27 |
+
$css_file = $data_folder_dir . '/css/responsive-menu-' . get_current_blog_id() . '.css';
|
28 |
+
$js_file = $data_folder_dir . '/js/responsive-menu-' . get_current_blog_id() . '.js';
|
29 |
+
wp_enqueue_style('responsive-menu', $css_file, null, false);
|
30 |
+
wp_enqueue_script('responsive-menu', $js_file, ['jquery'], false, $options['scripts_in_footer'] == 'on' ? true : false);
|
31 |
+
else :
|
32 |
+
add_action('wp_head', function() use ($css) {
|
33 |
+
echo '<style>' . $css . '</style>';
|
34 |
+
}, 100);
|
35 |
+
add_action($options['scripts_in_footer'] == 'on' ? 'wp_footer' : 'wp_head', function() use ($js) {
|
36 |
+
echo '<script>' . $js . '</script>';
|
37 |
+
}, 100);
|
38 |
+
endif;
|
39 |
+
|
40 |
+
}
|
41 |
+
}
|
src/app/Factories/JsFactory.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Factories;
|
4 |
+
use ResponsiveMenu\Mappers\JsMapper as JsMapper;
|
5 |
+
use ResponsiveMenu\Formatters\Minify as Minify;
|
6 |
+
use ResponsiveMenu\Collections\OptionsCollection as OptionsCollection;
|
7 |
+
|
8 |
+
class JsFactory {
|
9 |
+
|
10 |
+
public function build(OptionsCollection $options) {
|
11 |
+
|
12 |
+
$js_mapper = new JsMapper($options);
|
13 |
+
$js = $js_mapper->map();
|
14 |
+
|
15 |
+
if($options['minify_scripts'] == 'on'):
|
16 |
+
$minifier = new Minify;
|
17 |
+
$js = $minifier->minify($js);
|
18 |
+
endif;
|
19 |
+
|
20 |
+
return $js;
|
21 |
+
|
22 |
+
}
|
23 |
+
}
|
src/app/Factories/OptionFactory.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Factories;
|
4 |
+
use ResponsiveMenu\Models\ComplexOption as ComplexOption;
|
5 |
+
use ResponsiveMenu\Helpers\OptionHelper as Helper;
|
6 |
+
|
7 |
+
class OptionFactory
|
8 |
+
{
|
9 |
+
public function build($name, $value)
|
10 |
+
{
|
11 |
+
include dirname(dirname(dirname(__FILE__))) . '/config/option_helpers.php';
|
12 |
+
include dirname(dirname(dirname(__FILE__))) . '/config/default_options.php';
|
13 |
+
|
14 |
+
$filter = isset($option_helpers[$name]['filter'])
|
15 |
+
? new $option_helpers[$name]['filter']
|
16 |
+
: new \ResponsiveMenu\Filters\TextFilter;
|
17 |
+
|
18 |
+
$form_component = isset($option_helpers[$name]['form_component'])
|
19 |
+
? new $option_helpers[$name]['form_component']
|
20 |
+
: new \ResponsiveMenu\Form\Text;
|
21 |
+
|
22 |
+
$value = isset($value) || $value === '0' ? $value : $default_options[$name];
|
23 |
+
$value = stripslashes_deep($value);
|
24 |
+
$option = new ComplexOption($name, $value);
|
25 |
+
$option->setFilter($filter);
|
26 |
+
$option->setFormComponent($form_component);
|
27 |
+
$option->setData(isset($option_helpers[$name]['custom'])?$option_helpers[$name]['custom']:null);
|
28 |
+
$option->setIsPro(isset($option_helpers[$name]['pro'])?$option_helpers[$name]['pro']:null);
|
29 |
+
$option->setIsSemiPro(isset($option_helpers[$name]['semi_pro'])?$option_helpers[$name]['semi_pro']:null);
|
30 |
+
$option->setPosition(isset($option_helpers[$name]['position'])?$option_helpers[$name]['position']:null);
|
31 |
+
$option->setLabel(isset($option_helpers[$name]['label'])?$option_helpers[$name]['label']:null);
|
32 |
+
return $option;
|
33 |
+
}
|
34 |
+
|
35 |
+
}
|
src/app/Filesystem/FileCreator.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Filesystem;
|
4 |
+
|
5 |
+
class FileCreator
|
6 |
+
{
|
7 |
+
|
8 |
+
public function createCssFile($folder, $file_name, $css)
|
9 |
+
{
|
10 |
+
return $this->open_write_and_close($folder . '/' . $file_name, $css);
|
11 |
+
}
|
12 |
+
|
13 |
+
public function createJsFile($folder, $file_name, $js)
|
14 |
+
{
|
15 |
+
return $this->open_write_and_close($folder . '/' . $file_name, $js);
|
16 |
+
}
|
17 |
+
|
18 |
+
protected function open_write_and_close($file_name, $data)
|
19 |
+
{
|
20 |
+
if($file = fopen($file_name, 'w')):
|
21 |
+
fwrite($file, $data);
|
22 |
+
fclose($file);
|
23 |
+
else:
|
24 |
+
return false;
|
25 |
+
endif;
|
26 |
+
|
27 |
+
return true;
|
28 |
+
}
|
29 |
+
|
30 |
+
}
|
src/app/Filters/Filter.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Filters;
|
4 |
+
|
5 |
+
interface Filter
|
6 |
+
{
|
7 |
+
public function filter($data);
|
8 |
+
}
|
src/app/Filters/HtmlFilter.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Filters;
|
4 |
+
|
5 |
+
class HtmlFilter implements Filter
|
6 |
+
{
|
7 |
+
public function filter($data)
|
8 |
+
{
|
9 |
+
return $data;
|
10 |
+
}
|
11 |
+
|
12 |
+
}
|
src/app/Filters/JsonFilter.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Filters;
|
4 |
+
|
5 |
+
class JsonFilter implements Filter
|
6 |
+
{
|
7 |
+
public function filter($data)
|
8 |
+
{
|
9 |
+
return is_string($data) ? $data : json_encode($data);
|
10 |
+
}
|
11 |
+
|
12 |
+
}
|
src/app/Filters/TextFilter.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Filters;
|
4 |
+
|
5 |
+
class TextFilter implements Filter
|
6 |
+
{
|
7 |
+
public function filter($data)
|
8 |
+
{
|
9 |
+
return strip_tags($data);
|
10 |
+
}
|
11 |
+
|
12 |
+
}
|
src/app/Form/Checkbox.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Form;
|
4 |
+
use ResponsiveMenu\Models\Option as Option;
|
5 |
+
use ResponsiveMenu\Form\FormComponent as FormComponent;
|
6 |
+
|
7 |
+
class Checkbox implements FormComponent
|
8 |
+
{
|
9 |
+
|
10 |
+
public function render(Option $option)
|
11 |
+
{
|
12 |
+
$checked = $option->getValue() == 'on' ? 'checked="checked"' : '';
|
13 |
+
|
14 |
+
echo "<div class='onoffswitch'>
|
15 |
+
<input type='checkbox'
|
16 |
+
class='checkbox onoffswitch-checkbox'
|
17 |
+
id='{$option->getName()}'
|
18 |
+
$checked
|
19 |
+
name='menu[{$option->getName()}]'
|
20 |
+
value='on' />
|
21 |
+
<label class='onoffswitch-label' for='{$option->getName()}'>
|
22 |
+
<span class='onoffswitch-inner'></span>
|
23 |
+
<span class='onoffswitch-switch'></span>
|
24 |
+
</label>
|
25 |
+
</div>";
|
26 |
+
}
|
27 |
+
|
28 |
+
}
|
src/app/Form/Colour.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Form;
|
4 |
+
use ResponsiveMenu\Models\Option as Option;
|
5 |
+
use ResponsiveMenu\Form\FormComponent as FormComponent;
|
6 |
+
|
7 |
+
class Colour implements FormComponent
|
8 |
+
{
|
9 |
+
|
10 |
+
public function render(Option $option)
|
11 |
+
{
|
12 |
+
echo "<input type='text'
|
13 |
+
class='colour wp-color-picker'
|
14 |
+
id='{$option->getName()}'
|
15 |
+
name='menu[{$option->getName()}]'
|
16 |
+
value='{$option->getValue()}' />";
|
17 |
+
}
|
18 |
+
|
19 |
+
}
|
src/app/Form/Export.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Form;
|
4 |
+
|
5 |
+
class Export
|
6 |
+
{
|
7 |
+
|
8 |
+
public function render()
|
9 |
+
{
|
10 |
+
echo '<input type="submit" class="button submit" name="responsive_menu_export" value="' . __('Export Options', 'responsive-menu') . '" />';
|
11 |
+
}
|
12 |
+
|
13 |
+
}
|
src/app/Form/FontIconPageList.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Form;
|
4 |
+
use ResponsiveMenu\Models\Option as Option;
|
5 |
+
use ResponsiveMenu\Form\FormComponent as FormComponent;
|
6 |
+
|
7 |
+
class FontIconPageList implements FormComponent {
|
8 |
+
|
9 |
+
public function render(Option $option)
|
10 |
+
{
|
11 |
+
|
12 |
+
if($decoded = json_decode($option->getValue()))
|
13 |
+
$final = array_filter(array_combine($decoded->id, $decoded->icon));
|
14 |
+
else
|
15 |
+
$final = null;
|
16 |
+
|
17 |
+
echo "<div class='font-icon-container'><div class='font-icon-row'><div class='font-icon-cell-id'>" . __('Id', 'responsive-menu') . "</div><div class='font-icon-cell-icon'>" . __('Icon', 'responsive-menu') . "</div></div>";
|
18 |
+
|
19 |
+
if(is_array($final) && !empty($final)):
|
20 |
+
foreach( $final as $id => $icon):
|
21 |
+
echo "
|
22 |
+
<div class='font-icon-row'>
|
23 |
+
<div class='font-icon-cell-id'>
|
24 |
+
<input
|
25 |
+
type='text'
|
26 |
+
class='{$option->getName()}_id'
|
27 |
+
name='menu[{$option->getName()}][id][]'
|
28 |
+
value='{$id}' />
|
29 |
+
</div>
|
30 |
+
<div class='font-icon-cell-icon'>
|
31 |
+
<input
|
32 |
+
type='text'
|
33 |
+
class='{$option->getName()}_icon'
|
34 |
+
name='menu[{$option->getName()}][icon][]'
|
35 |
+
value='{$icon}' />
|
36 |
+
</div>
|
37 |
+
</div>";
|
38 |
+
endforeach;
|
39 |
+
else:
|
40 |
+
echo "
|
41 |
+
<div class='font-icon-row'>
|
42 |
+
<div class='font-icon-cell-id'>
|
43 |
+
<input
|
44 |
+
type='text'
|
45 |
+
class='{$option->getName()}_id'
|
46 |
+
name='menu[{$option->getName()}][id][]'
|
47 |
+
value='' />
|
48 |
+
</div>
|
49 |
+
<div class='font-icon-cell-icon'>
|
50 |
+
<input
|
51 |
+
type='text'
|
52 |
+
class='{$option->getName()}_icon'
|
53 |
+
name='menu[{$option->getName()}][icon][]'
|
54 |
+
value='' />
|
55 |
+
</div>
|
56 |
+
</div>";
|
57 |
+
endif;
|
58 |
+
|
59 |
+
echo "</div><div class='add-font-icon'>" . __('Add New Font Icon', 'responsive-menu') . "</div>";
|
60 |
+
|
61 |
+
echo "<script>
|
62 |
+
jQuery(document).ready(function($) {
|
63 |
+
$(document).on('click', '.add-font-icon', function(e) {
|
64 |
+
var lastRow = $('#{$option->getName()}_container .font-icon-row').last();
|
65 |
+
var nextRow = lastRow.clone();
|
66 |
+
nextRow.find(':text').val('')
|
67 |
+
lastRow.after(nextRow);
|
68 |
+
});
|
69 |
+
});
|
70 |
+
</script>";
|
71 |
+
|
72 |
+
}
|
73 |
+
|
74 |
+
}
|
src/app/Form/FormComponent.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Form;
|
4 |
+
use ResponsiveMenu\Models\Option as Option;
|
5 |
+
|
6 |
+
interface FormComponent {
|
7 |
+
public function render(Option $option);
|
8 |
+
}
|
src/app/Form/HeaderBarOrdering.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Form;
|
4 |
+
use ResponsiveMenu\Models\Option as Option;
|
5 |
+
use ResponsiveMenu\Form\FormComponent as FormComponent;
|
6 |
+
|
7 |
+
class HeaderBarOrdering implements FormComponent
|
8 |
+
{
|
9 |
+
|
10 |
+
public function render(Option $option)
|
11 |
+
{
|
12 |
+
$required = ['logo' => '', 'title' => '', 'search' => '', 'html content' => '', 'button' => ''];
|
13 |
+
$current_options = (array) json_decode($option->getValue());
|
14 |
+
$all_options = array_merge($current_options, $required);
|
15 |
+
|
16 |
+
echo '<ul id="header-bar-sortable">';
|
17 |
+
foreach($all_options as $name => $val):
|
18 |
+
$current_value = isset($current_options[$name]) ? $current_options[$name] : '';
|
19 |
+
$on_class = $current_value == 'on' ? 'order-option-switch-on' : '';
|
20 |
+
echo '<li class="draggable">'
|
21 |
+
. ucwords($name)
|
22 |
+
. '<input type="text" class="orderable-item" value="'.$current_value.'" name="menu['.$option->getName().']['.$name.']" />'
|
23 |
+
. '<div class="order-option-switch ' . $on_class . '"></div>'
|
24 |
+
. '</li>';
|
25 |
+
endforeach;
|
26 |
+
echo '</ul>';
|
27 |
+
|
28 |
+
echo '<script>
|
29 |
+
jQuery(document).ready(function($) {
|
30 |
+
$(document).on("click", ".order-option-switch", function() {
|
31 |
+
if($(this).siblings("input.orderable-item").val() != "on") {
|
32 |
+
console.log($(this));
|
33 |
+
$(this).siblings("input.orderable-item").val("on");
|
34 |
+
$(this).addClass("order-option-switch-on");
|
35 |
+
} else {
|
36 |
+
$(this).siblings("input.orderable-item").val("");
|
37 |
+
$(this).removeClass("order-option-switch-on");
|
38 |
+
}
|
39 |
+
});
|
40 |
+
$( "#header-bar-sortable" ).sortable({
|
41 |
+
revert: true
|
42 |
+
});
|
43 |
+
$( "#sortable, .draggable" ).disableSelection();
|
44 |
+
});
|
45 |
+
</script>';
|
46 |
+
|
47 |
+
}
|
48 |
+
|
49 |
+
}
|
src/app/Form/Image.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Form;
|
4 |
+
use ResponsiveMenu\Models\Option as Option;
|
5 |
+
use ResponsiveMenu\Form\FormComponent as FormComponent;
|
6 |
+
|
7 |
+
class Image implements FormComponent
|
8 |
+
{
|
9 |
+
|
10 |
+
public function render(Option $option)
|
11 |
+
{
|
12 |
+
echo "<input
|
13 |
+
type='text'
|
14 |
+
class='image'
|
15 |
+
id='{$option->getName()}'
|
16 |
+
name='menu[{$option->getName()}]'
|
17 |
+
value='{$option->getValue()}' />
|
18 |
+
<button
|
19 |
+
type='button'
|
20 |
+
class='button image_button'
|
21 |
+
for='{$option->getName()}'
|
22 |
+
/><i class='fa fa-upload'></i></button>";
|
23 |
+
}
|
24 |
+
|
25 |
+
}
|
src/app/Form/Import.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Form;
|
4 |
+
|
5 |
+
class Import
|
6 |
+
{
|
7 |
+
|
8 |
+
public function render()
|
9 |
+
{
|
10 |
+
echo '<input type="file" name="responsive_menu_import_file" />
|
11 |
+
<input type="submit" class="button submit" name="responsive_menu_import" value="' . __('Import Options', 'responsive-menu') . '" />';
|
12 |
+
}
|
13 |
+
|
14 |
+
}
|
src/app/Form/MenuOrdering.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Form;
|
4 |
+
use ResponsiveMenu\Models\Option as Option;
|
5 |
+
use ResponsiveMenu\Form\FormComponent as FormComponent;
|
6 |
+
|
7 |
+
class MenuOrdering implements FormComponent
|
8 |
+
{
|
9 |
+
|
10 |
+
public function render(Option $option)
|
11 |
+
{
|
12 |
+
$required = ['title' => '', 'menu' => '', 'search' => '', 'additional content' => ''];
|
13 |
+
$current_options = (array) json_decode($option->getValue());
|
14 |
+
$all_options = array_merge($current_options, $required);
|
15 |
+
|
16 |
+
echo '<ul id="menu-sortable">';
|
17 |
+
foreach($all_options as $name => $val):
|
18 |
+
$current_value = isset($current_options[$name]) ? $current_options[$name] : '';
|
19 |
+
$on_class = $current_value == 'on' ? 'menu-order-option-switch-on' : '';
|
20 |
+
|
21 |
+
echo '<li class="draggable">'
|
22 |
+
. ucwords($name)
|
23 |
+
. '<input type="text" class="orderable-item" value="'.$current_value.'" name="menu['.$option->getName().']['.$name.']" />'
|
24 |
+
. '<div class="menu-order-option-switch ' . $on_class . '"></div>'
|
25 |
+
. '</li>';
|
26 |
+
endforeach;
|
27 |
+
echo '</ul>';
|
28 |
+
|
29 |
+
echo '<script>
|
30 |
+
jQuery(document).ready(function($) {
|
31 |
+
$(document).on("click", ".menu-order-option-switch", function() {
|
32 |
+
if($(this).siblings("input.orderable-item").val() != "on") {
|
33 |
+
$(this).siblings("input.orderable-item").val("on");
|
34 |
+
$(this).addClass("menu-order-option-switch-on");
|
35 |
+
} else {
|
36 |
+
$(this).siblings("input.orderable-item").val("");
|
37 |
+
$(this).removeClass("menu-order-option-switch-on");
|
38 |
+
}
|
39 |
+
});
|
40 |
+
$( "#menu-sortable" ).sortable({
|
41 |
+
revert: true
|
42 |
+
});
|
43 |
+
$( "#sortable, .draggable" ).disableSelection();
|
44 |
+
});
|
45 |
+
</script>';
|
46 |
+
|
47 |
+
}
|
48 |
+
|
49 |
+
}
|
src/app/Form/Reset.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Form;
|
4 |
+
|
5 |
+
class Reset
|
6 |
+
{
|
7 |
+
|
8 |
+
public function render()
|
9 |
+
{
|
10 |
+
echo '<input type="submit" class="button submit" name="responsive_menu_reset" value="' . __('Reset Options', 'responsive-menu') . '" />';
|
11 |
+
}
|
12 |
+
|
13 |
+
}
|
src/app/Form/Select.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Form;
|
4 |
+
use ResponsiveMenu\Models\Option as Option;
|
5 |
+
use ResponsiveMenu\Form\FormComponent as FormComponent;
|
6 |
+
|
7 |
+
class Select
|
8 |
+
{
|
9 |
+
|
10 |
+
public function render(Option $option, array $select_data)
|
11 |
+
{
|
12 |
+
|
13 |
+
$html = "<div class='select-style'><select class='select' name='menu[{$option->getName()}]' id='{$option->getName()}'>";
|
14 |
+
foreach($select_data as $data) :
|
15 |
+
$selected = $option->getValue() == $data['value'] ? 'selected="selected"' : '';
|
16 |
+
$disabled = isset($data['disabled']) ? 'disabled="disabled"' : '';
|
17 |
+
$pro = isset($data['disabled']) ? ' [PRO]' : '';
|
18 |
+
$html .= "<option value='{$data['value']}' {$selected} {$disabled}>{$data['display']}{$pro}</option>";
|
19 |
+
endforeach;
|
20 |
+
$html .= "</select></div>";
|
21 |
+
echo $html;
|
22 |
+
}
|
23 |
+
|
24 |
+
}
|
src/app/Form/Text.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Form;
|
4 |
+
use ResponsiveMenu\Models\Option as Option;
|
5 |
+
use ResponsiveMenu\Form\FormComponent as FormComponent;
|
6 |
+
|
7 |
+
class Text implements FormComponent
|
8 |
+
{
|
9 |
+
|
10 |
+
public function render(Option $option)
|
11 |
+
{
|
12 |
+
|
13 |
+
echo "<input type='text'
|
14 |
+
class='text'
|
15 |
+
id='{$option->getName()}'
|
16 |
+
name='menu[{$option->getName()}]'
|
17 |
+
value='{$option->getValue()}' />";
|
18 |
+
}
|
19 |
+
|
20 |
+
}
|
src/app/Form/TextArea.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Form;
|
4 |
+
use ResponsiveMenu\Models\Option as Option;
|
5 |
+
use ResponsiveMenu\Form\FormComponent as FormComponent;
|
6 |
+
|
7 |
+
class TextArea implements FormComponent {
|
8 |
+
|
9 |
+
public function render(Option $option)
|
10 |
+
{
|
11 |
+
echo "<textarea
|
12 |
+
class='textarea'
|
13 |
+
id='{$option->getName()}'
|
14 |
+
name='menu[{$option->getName()}]'>{$option->getValue()}</textarea>";
|
15 |
+
}
|
16 |
+
|
17 |
+
}
|
src/app/Formatters/Minify.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Formatters;
|
4 |
+
|
5 |
+
class Minify {
|
6 |
+
|
7 |
+
public function minify($data) {
|
8 |
+
|
9 |
+
/* remove comments */
|
10 |
+
$minified = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $data);
|
11 |
+
|
12 |
+
/* remove tabs, spaces, newlines, etc. */
|
13 |
+
$minified = str_replace(array("\r\n","\r","\n","\t",' ',' ',' '), '', $minified);
|
14 |
+
|
15 |
+
/* remove other spaces before/after ; */
|
16 |
+
$minified = preg_replace(array('(( )+{)','({( )+)'), '{', $minified);
|
17 |
+
$minified = preg_replace(array('(( )+})','(}( )+)','(;( )*})'), '}', $minified);
|
18 |
+
$minified = preg_replace(array('(;( )+)','(( )+;)'), ';', $minified);
|
19 |
+
|
20 |
+
return $minified;
|
21 |
+
|
22 |
+
}
|
23 |
+
|
24 |
+
}
|
src/app/Formatters/Tabs.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Formatters;
|
4 |
+
use ResponsiveMenu\Collections\OptionsCollection as OptionsCollection;
|
5 |
+
|
6 |
+
class Tabs
|
7 |
+
{
|
8 |
+
public static function render(OptionsCollection $options)
|
9 |
+
{
|
10 |
+
$tabs = self::getTabs($options);
|
11 |
+
foreach($tabs as $key => $val):
|
12 |
+
$is_active = $val == reset($tabs) ? ' active_tab' : '';
|
13 |
+
echo '<a class="tab page-title-action' . $is_active . '" id="tab_' . $key . '">' . $val . '</a>';
|
14 |
+
endforeach;
|
15 |
+
}
|
16 |
+
|
17 |
+
public static function getTabs(OptionsCollection $options)
|
18 |
+
{
|
19 |
+
$final = array();
|
20 |
+
foreach($options->all() as $option):
|
21 |
+
if($option->getPosition()):
|
22 |
+
$item = explode('.',$option->getPosition());
|
23 |
+
$final[$item[0]] = ucwords(str_replace('_', ' ', $item[0]));
|
24 |
+
endif;
|
25 |
+
endforeach;
|
26 |
+
return array_unique(array_filter($final));
|
27 |
+
}
|
28 |
+
|
29 |
+
public static function getSubTabs($tab, OptionsCollection $options)
|
30 |
+
{
|
31 |
+
$final = array();
|
32 |
+
foreach($options->all() as $option):
|
33 |
+
if($option->getPosition()):
|
34 |
+
$item = explode('.',$option->getPosition());
|
35 |
+
$final[] = $item[0] == $tab ? $option->getPosition() : null;
|
36 |
+
endif;
|
37 |
+
endforeach;
|
38 |
+
return array_unique(array_filter($final));
|
39 |
+
}
|
40 |
+
|
41 |
+
public static function getTabOptions($tab_name, OptionsCollection $options)
|
42 |
+
{
|
43 |
+
$final = array();
|
44 |
+
foreach($options->all() as $option) :
|
45 |
+
if($option->getPosition()) :
|
46 |
+
if($tab_name == $option->getPosition())
|
47 |
+
$final[] = $option;
|
48 |
+
endif;
|
49 |
+
endforeach;
|
50 |
+
return $final;
|
51 |
+
}
|
52 |
+
|
53 |
+
}
|
src/app/Formatters/Text.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Formatters;
|
4 |
+
|
5 |
+
class Text
|
6 |
+
{
|
7 |
+
public static function underscoreToWord($text, $echo = true)
|
8 |
+
{
|
9 |
+
$words = ucwords(str_replace('_', ' ', $text));
|
10 |
+
if($echo)
|
11 |
+
echo $words;
|
12 |
+
else
|
13 |
+
return $words;
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
src/app/Mappers/JsMapper.php
ADDED
@@ -0,0 +1,186 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Mappers;
|
4 |
+
use ResponsiveMenu\Collections\OptionsCollection as OptionsCollection;
|
5 |
+
|
6 |
+
class JsMapper
|
7 |
+
{
|
8 |
+
public function __construct(OptionsCollection $options)
|
9 |
+
{
|
10 |
+
$this->options = $options;
|
11 |
+
}
|
12 |
+
|
13 |
+
public function map()
|
14 |
+
{
|
15 |
+
$animation_speed = $this->options['animation_speed'] ? $this->options['animation_speed']->getValue() * 1000 : 500;
|
16 |
+
|
17 |
+
$js = <<<JS
|
18 |
+
|
19 |
+
jQuery(document).ready(function($) {
|
20 |
+
|
21 |
+
var ResponsiveMenu = {
|
22 |
+
trigger: '{$this->options['button_click_trigger']}',
|
23 |
+
animationSpeed: {$animation_speed},
|
24 |
+
breakpoint: {$this->options['breakpoint']},
|
25 |
+
pushButton: '{$this->options['button_push_with_animation']}',
|
26 |
+
animationType: '{$this->options['animation_type']}',
|
27 |
+
animationSide: '{$this->options['menu_appear_from']}',
|
28 |
+
pageWrapper: '{$this->options['page_wrapper']}',
|
29 |
+
isOpen: false,
|
30 |
+
triggerTypes: 'click',
|
31 |
+
activeClass: 'is-active',
|
32 |
+
container: '#responsive-menu-container',
|
33 |
+
openClass: 'responsive-menu-open',
|
34 |
+
accordion: '{$this->options['accordion_animation']}',
|
35 |
+
activeArrow: '{$this->options->getActiveArrow()}',
|
36 |
+
inactiveArrow: '{$this->options->getInActiveArrow()}',
|
37 |
+
wrapper: '#responsive-menu-wrapper',
|
38 |
+
closeOnBodyClick: '{$this->options['menu_close_on_body_click']}',
|
39 |
+
closeOnLinkClick: '{$this->options['menu_close_on_link_click']}',
|
40 |
+
itemTriggerSubMenu: '{$this->options['menu_item_click_to_trigger_submenu']}',
|
41 |
+
linkElement: '.responsive-menu-item-link',
|
42 |
+
openMenu: function() {
|
43 |
+
$(this.trigger).addClass(this.activeClass);
|
44 |
+
$('html').addClass(this.openClass);
|
45 |
+
$('.responsive-menu-button-icon-active').hide();
|
46 |
+
$('.responsive-menu-button-icon-inactive').show();
|
47 |
+
this.setWrapperTranslate();
|
48 |
+
this.isOpen = true;
|
49 |
+
},
|
50 |
+
closeMenu: function() {
|
51 |
+
$(this.trigger).removeClass(this.activeClass);
|
52 |
+
$('html').removeClass(this.openClass);
|
53 |
+
$('.responsive-menu-button-icon-inactive').hide();
|
54 |
+
$('.responsive-menu-button-icon-active').show();
|
55 |
+
this.clearWrapperTranslate();
|
56 |
+
this.isOpen = false;
|
57 |
+
},
|
58 |
+
triggerMenu: function() {
|
59 |
+
this.isOpen ? this.closeMenu() : this.openMenu();
|
60 |
+
},
|
61 |
+
triggerSubArrow: function(subarrow) {
|
62 |
+
var sub_menu = $(subarrow).parent().next('.responsive-menu-submenu');
|
63 |
+
var self = this;
|
64 |
+
if(this.accordion == 'on') {
|
65 |
+
/* Get Top Most Parent and the siblings */
|
66 |
+
var top_siblings = sub_menu.parents('.responsive-menu-item-has-children').last().siblings('.responsive-menu-item-has-children');
|
67 |
+
var first_siblings = sub_menu.parents('.responsive-menu-item-has-children').first().siblings('.responsive-menu-item-has-children');
|
68 |
+
/* Close up just the top level parents to key the rest as it was */
|
69 |
+
top_siblings.children('.responsive-menu-submenu').slideUp(200, 'linear').removeClass('responsive-menu-submenu-open');
|
70 |
+
/* Set each parent arrow to inactive */
|
71 |
+
top_siblings.each(function() {
|
72 |
+
$(this).find('.responsive-menu-subarrow').first().html(self.inactiveArrow);
|
73 |
+
});
|
74 |
+
/* Now Repeat for the current item siblings */
|
75 |
+
first_siblings.children('.responsive-menu-submenu').slideUp(200, 'linear').removeClass('responsive-menu-submenu-open');
|
76 |
+
first_siblings.each(function() {
|
77 |
+
$(this).find('.responsive-menu-subarrow').first().html(self.inactiveArrow);
|
78 |
+
});
|
79 |
+
}
|
80 |
+
if(sub_menu.hasClass('responsive-menu-submenu-open')) {
|
81 |
+
sub_menu.slideUp(200, 'linear').removeClass('responsive-menu-submenu-open');
|
82 |
+
$(subarrow).html(this.inactiveArrow);
|
83 |
+
} else {
|
84 |
+
sub_menu.slideDown(200, 'linear').addClass('responsive-menu-submenu-open');
|
85 |
+
$(subarrow).html(this.activeArrow);
|
86 |
+
}
|
87 |
+
},
|
88 |
+
menuHeight: function() {
|
89 |
+
return $(this.container).height();
|
90 |
+
},
|
91 |
+
menuWidth: function() {
|
92 |
+
return $(this.container).width();
|
93 |
+
},
|
94 |
+
wrapperHeight: function() {
|
95 |
+
return $(this.wrapper).height();
|
96 |
+
},
|
97 |
+
setWrapperTranslate: function() {
|
98 |
+
switch(this.animationSide) {
|
99 |
+
case 'left':
|
100 |
+
translate = 'translateX(' + this.menuWidth() + 'px)'; break;
|
101 |
+
case 'right':
|
102 |
+
translate = 'translateX(-' + this.menuWidth() + 'px)'; break;
|
103 |
+
case 'top':
|
104 |
+
translate = 'translateY(' + this.wrapperHeight() + 'px)'; break;
|
105 |
+
case 'bottom':
|
106 |
+
translate = 'translateY(-' + this.menuHeight() + 'px)'; break;
|
107 |
+
}
|
108 |
+
if(this.animationType == 'push') {
|
109 |
+
$(this.pageWrapper).css({'transform':translate});
|
110 |
+
$('html,body').css('overflow-x', 'hidden');
|
111 |
+
}
|
112 |
+
if(this.pushButton == 'on') {
|
113 |
+
$('#responsive-menu-button').css({'transform':translate});
|
114 |
+
}
|
115 |
+
},
|
116 |
+
clearWrapperTranslate: function() {
|
117 |
+
self = this;
|
118 |
+
if(this.animationType == 'push') {
|
119 |
+
$(this.pageWrapper).css({'transform':''});
|
120 |
+
setTimeout(function() {
|
121 |
+
$('html,body').css('overflow-x', '');
|
122 |
+
}, self.animationSpeed * 1000);
|
123 |
+
}
|
124 |
+
if(this.pushButton == 'on') {
|
125 |
+
$('#responsive-menu-button').css({'transform':''});
|
126 |
+
}
|
127 |
+
},
|
128 |
+
init: function() {
|
129 |
+
var self = this;
|
130 |
+
$(this.trigger).on(this.triggerTypes, function(){
|
131 |
+
self.triggerMenu();
|
132 |
+
});
|
133 |
+
$('.responsive-menu-subarrow').on('click', function(e) {
|
134 |
+
e.preventDefault();
|
135 |
+
e.stopPropagation();
|
136 |
+
self.triggerSubArrow(this);
|
137 |
+
});
|
138 |
+
$(window).resize(function() {
|
139 |
+
if($(window).width() > self.breakpoint) {
|
140 |
+
if(self.isOpen){
|
141 |
+
self.closeMenu();
|
142 |
+
}
|
143 |
+
} else {
|
144 |
+
if($('.responsive-menu-open').length>0){
|
145 |
+
self.setWrapperTranslate();
|
146 |
+
}
|
147 |
+
}
|
148 |
+
});
|
149 |
+
if(this.closeOnLinkClick == 'on') {
|
150 |
+
$(this.linkElement).on('click touchstart', function(e) {
|
151 |
+
if(self.isOpen) {
|
152 |
+
if($(e.target).closest('.responsive-menu-subarrow').length) {
|
153 |
+
return;
|
154 |
+
}
|
155 |
+
self.closeMenu();
|
156 |
+
}
|
157 |
+
});
|
158 |
+
}
|
159 |
+
if(this.closeOnBodyClick == 'on') {
|
160 |
+
$(document).on('click', 'body', function(e) {
|
161 |
+
if(self.isOpen) {
|
162 |
+
if($(e.target).closest('#responsive-menu-container').length || $(e.target).closest('#responsive-menu-button').length) {
|
163 |
+
return;
|
164 |
+
}
|
165 |
+
}
|
166 |
+
self.closeMenu();
|
167 |
+
});
|
168 |
+
}
|
169 |
+
if(this.itemTriggerSubMenu == 'on') {
|
170 |
+
$('.responsive-menu-item-has-children > ' + this.linkElement).on('click', function(e) {
|
171 |
+
e.preventDefault();
|
172 |
+
self.triggerSubArrow($(this).children('.responsive-menu-subarrow').first());
|
173 |
+
});
|
174 |
+
}
|
175 |
+
}
|
176 |
+
};
|
177 |
+
ResponsiveMenu.init();
|
178 |
+
});
|
179 |
+
|
180 |
+
JS;
|
181 |
+
|
182 |
+
return $js;
|
183 |
+
|
184 |
+
}
|
185 |
+
|
186 |
+
}
|
src/app/Mappers/ScssBaseMapper.php
ADDED
@@ -0,0 +1,235 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Mappers;
|
4 |
+
|
5 |
+
class ScssBaseMapper extends ScssMapper
|
6 |
+
{
|
7 |
+
|
8 |
+
public function map()
|
9 |
+
{
|
10 |
+
|
11 |
+
$css = <<<CSS
|
12 |
+
|
13 |
+
#responsive-menu-button,
|
14 |
+
#responsive-menu-container,
|
15 |
+
#responsive-menu-header {
|
16 |
+
display: none;
|
17 |
+
}
|
18 |
+
|
19 |
+
@media screen and (max-width: {$this->options['breakpoint']}px) {
|
20 |
+
|
21 |
+
#responsive-menu-container,
|
22 |
+
#responsive-menu-header {
|
23 |
+
display: block;
|
24 |
+
}
|
25 |
+
|
26 |
+
#responsive-menu-container {
|
27 |
+
position: fixed;
|
28 |
+
top: 0;
|
29 |
+
bottom: 0;
|
30 |
+
z-index: 9998;
|
31 |
+
/* Fix for scroll bars appearing when not needed */
|
32 |
+
padding-bottom: 5px;
|
33 |
+
margin-bottom: -5px;
|
34 |
+
overflow-y: auto;
|
35 |
+
overflow-x: hidden;
|
36 |
+
.responsive-menu-search-box {
|
37 |
+
width: 100%;
|
38 |
+
padding: 0 2%;
|
39 |
+
border-radius: 2px;
|
40 |
+
border: 2px solid #dadada;
|
41 |
+
height: 50px;
|
42 |
+
background: white;
|
43 |
+
}
|
44 |
+
|
45 |
+
&.push-left,
|
46 |
+
&.slide-left {
|
47 |
+
transform: translateX(-100%);
|
48 |
+
-ms-transform: translateX(-100%);
|
49 |
+
-webkit-transform: translateX(-100%);
|
50 |
+
-moz-transform: translateX(-100%);
|
51 |
+
.responsive-menu-open & {
|
52 |
+
transform: translateX(0);
|
53 |
+
-ms-transform: translateX(0);
|
54 |
+
-webkit-transform: translateX(0);
|
55 |
+
-moz-transform: translateX(0);
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
&.push-top,
|
60 |
+
&.slide-top {
|
61 |
+
transform: translateY(-100%);
|
62 |
+
-ms-transform: translateY(-100%);
|
63 |
+
-webkit-transform: translateY(-100%);
|
64 |
+
-moz-transform: translateY(-100%);
|
65 |
+
.responsive-menu-open & {
|
66 |
+
transform: translateY(0);
|
67 |
+
-ms-transform: translateY(0);
|
68 |
+
-webkit-transform: translateY(0);
|
69 |
+
-moz-transform: translateY(0);
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
&.push-right,
|
74 |
+
&.slide-right {
|
75 |
+
transform: translateX(100%);
|
76 |
+
-ms-transform: translateX(100%);
|
77 |
+
-webkit-transform: translateX(100%);
|
78 |
+
-moz-transform: translateX(100%);
|
79 |
+
.responsive-menu-open & {
|
80 |
+
transform: translateX(0);
|
81 |
+
-ms-transform: translateX(0);
|
82 |
+
-webkit-transform: translateX(0);
|
83 |
+
-moz-transform: translateX(0);
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
&.push-bottom,
|
88 |
+
&.slide-bottom {
|
89 |
+
transform: translateY(100%);
|
90 |
+
-ms-transform: translateY(100%);
|
91 |
+
-webkit-transform: translateY(100%);
|
92 |
+
-moz-transform: translateY(100%);
|
93 |
+
.responsive-menu-open & {
|
94 |
+
transform: translateY(0);
|
95 |
+
-ms-transform: translateY(0);
|
96 |
+
-webkit-transform: translateY(0);
|
97 |
+
-moz-transform: translateY(0);
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
// Reset Styles for all our elements
|
102 |
+
&, &:before, &:after, & *, & *:before, & *:after {
|
103 |
+
box-sizing: border-box;
|
104 |
+
margin: 0;
|
105 |
+
padding: 0;
|
106 |
+
}
|
107 |
+
|
108 |
+
#responsive-menu-search-box,
|
109 |
+
#responsive-menu-additional-content,
|
110 |
+
#responsive-menu-title {
|
111 |
+
padding: 25px 5%;
|
112 |
+
}
|
113 |
+
|
114 |
+
#responsive-menu {
|
115 |
+
&, ul {
|
116 |
+
width: 100%;
|
117 |
+
}
|
118 |
+
& ul.responsive-menu-submenu {
|
119 |
+
display: none;
|
120 |
+
&.responsive-menu-submenu-open {
|
121 |
+
display: block;
|
122 |
+
}
|
123 |
+
}
|
124 |
+
@for \$i from 1 through 6 {
|
125 |
+
& ul.responsive-menu-submenu-depth-#{\$i}
|
126 |
+
a.responsive-menu-item-link {
|
127 |
+
padding-left: 5% + (5% * \$i);
|
128 |
+
}
|
129 |
+
}
|
130 |
+
|
131 |
+
}
|
132 |
+
|
133 |
+
li.responsive-menu-item {
|
134 |
+
width: 100%;
|
135 |
+
list-style: none;
|
136 |
+
a {
|
137 |
+
width: 100%;
|
138 |
+
display: block;
|
139 |
+
margin-top: -1px; // Fix double borders with menu link above
|
140 |
+
text-decoration: none;
|
141 |
+
padding: 0 5%;
|
142 |
+
position: relative;
|
143 |
+
.fa {
|
144 |
+
margin-right: 15px;
|
145 |
+
}
|
146 |
+
.responsive-menu-subarrow {
|
147 |
+
position: absolute;
|
148 |
+
right: 0;
|
149 |
+
top: 0;
|
150 |
+
bottom: 0;
|
151 |
+
text-align: center;
|
152 |
+
overflow: hidden;
|
153 |
+
.fa {
|
154 |
+
margin-right: 0;
|
155 |
+
}
|
156 |
+
}
|
157 |
+
}
|
158 |
+
}
|
159 |
+
}
|
160 |
+
|
161 |
+
.responsive-menu-button {
|
162 |
+
.responsive-menu-button-icon-inactive {
|
163 |
+
display: none;
|
164 |
+
}
|
165 |
+
}
|
166 |
+
|
167 |
+
#responsive-menu-button {
|
168 |
+
z-index: 9999;
|
169 |
+
display: none;
|
170 |
+
overflow: hidden;
|
171 |
+
img {
|
172 |
+
max-width: 100%;
|
173 |
+
}
|
174 |
+
}
|
175 |
+
|
176 |
+
.responsive-menu-label {
|
177 |
+
display: inline-block;
|
178 |
+
font-weight: 600;
|
179 |
+
margin: 0 5px;
|
180 |
+
vertical-align: middle;
|
181 |
+
}
|
182 |
+
|
183 |
+
.responsive-menu-accessible {
|
184 |
+
display: inline-block;
|
185 |
+
}
|
186 |
+
|
187 |
+
.responsive-menu-accessible .responsive-menu-box {
|
188 |
+
display: inline-block;
|
189 |
+
vertical-align: middle;
|
190 |
+
}
|
191 |
+
|
192 |
+
.responsive-menu-label.responsive-menu-label-top,
|
193 |
+
.responsive-menu-label.responsive-menu-label-bottom
|
194 |
+
{
|
195 |
+
display: block;
|
196 |
+
margin: 10px auto;
|
197 |
+
}
|
198 |
+
|
199 |
+
#responsive-menu-header {
|
200 |
+
width: 100%;
|
201 |
+
padding: 0 5%;
|
202 |
+
box-sizing: border-box;
|
203 |
+
top: 0;
|
204 |
+
right: 0;
|
205 |
+
left: 0;
|
206 |
+
display: none;
|
207 |
+
.responsive-menu-header-box {
|
208 |
+
display: inline-block;
|
209 |
+
&, & img {
|
210 |
+
vertical-align: middle;
|
211 |
+
max-width: 100%;
|
212 |
+
}
|
213 |
+
&:last-child {
|
214 |
+
float: right;
|
215 |
+
margin-right: 0;
|
216 |
+
}
|
217 |
+
}
|
218 |
+
#responsive-menu-button {
|
219 |
+
position: relative;
|
220 |
+
margin: 0;
|
221 |
+
left: auto;
|
222 |
+
right: auto;
|
223 |
+
bottom: auto;
|
224 |
+
}
|
225 |
+
.responsive-menu-header-box {
|
226 |
+
margin-right: 2%;
|
227 |
+
}
|
228 |
+
}
|
229 |
+
}
|
230 |
+
CSS;
|
231 |
+
|
232 |
+
return $this->compiler->compile($css);
|
233 |
+
}
|
234 |
+
|
235 |
+
}
|
src/app/Mappers/ScssButtonMapper.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Mappers;
|
4 |
+
|
5 |
+
class ScssButtonMapper extends ScssMapper
|
6 |
+
{
|
7 |
+
|
8 |
+
public function map()
|
9 |
+
{
|
10 |
+
$hamburger_css_dir = dirname(dirname(dirname(__FILE__))) . '/public/scss/hamburgers/hamburgers.scss';
|
11 |
+
$no_animation = $this->options['button_click_animation'] == 'off' ? '$hamburger-types: ();' : '';
|
12 |
+
|
13 |
+
$css = <<<CSS
|
14 |
+
|
15 |
+
@media screen and ( max-width: {$this->options['breakpoint']}px ) {
|
16 |
+
|
17 |
+
\$hamburger-layer-height: {$this->options['button_line_height']}px;
|
18 |
+
\$hamburger-layer-spacing: {$this->options['button_line_margin']}px;
|
19 |
+
\$hamburger-layer-color: {$this->options['button_line_colour']};
|
20 |
+
\$hamburger-layer-width: {$this->options['button_line_width']}px;
|
21 |
+
\$hamburger-hover-opacity: 1;
|
22 |
+
{$no_animation}
|
23 |
+
|
24 |
+
@import "{$hamburger_css_dir}";
|
25 |
+
|
26 |
+
.responsive-menu-button {
|
27 |
+
width: {$this->options['button_width']}px;
|
28 |
+
height: {$this->options['button_height']}px;
|
29 |
+
@if '{$this->options['button_transparent_background']}' == 'off' {
|
30 |
+
background-color: {$this->options['button_background_colour']};
|
31 |
+
&:hover {
|
32 |
+
background-color: {$this->options['button_background_colour_hover']};
|
33 |
+
}
|
34 |
+
}
|
35 |
+
position: {$this->options['button_position_type']};
|
36 |
+
top: {$this->options['button_top']}px;
|
37 |
+
{$this->options['button_left_or_right']}: {$this->options['button_distance_from_side']}%;
|
38 |
+
.responsive-menu-box {
|
39 |
+
color: {$this->options['button_line_colour']};
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
.responsive-menu-label {
|
44 |
+
color: {$this->options['button_text_colour']};
|
45 |
+
font-size: {$this->options['button_font_size']}px;
|
46 |
+
@if '{$this->options['button_font']}' != '' {
|
47 |
+
font-family: '{$this->options['button_font']}';
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
#responsive-menu-button {
|
52 |
+
display: inline-block;
|
53 |
+
transition: transform {$this->options['animation_speed']}s, background-color {$this->options['transition_speed']}s;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
CSS;
|
57 |
+
|
58 |
+
return $this->compiler->compile($css);
|
59 |
+
|
60 |
+
}
|
61 |
+
|
62 |
+
}
|
src/app/Mappers/ScssMapper.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Mappers;
|
4 |
+
use ResponsiveMenu\Collections\OptionsCollection as OptionsCollection;
|
5 |
+
|
6 |
+
class ScssMapper
|
7 |
+
{
|
8 |
+
|
9 |
+
public function __construct(OptionsCollection $options)
|
10 |
+
{
|
11 |
+
$this->options = $options;
|
12 |
+
#Ugly
|
13 |
+
if(!class_exists('\scssc'))
|
14 |
+
require_once "scssphp/scss.inc.php";
|
15 |
+
|
16 |
+
$this->compiler = new \scssc();
|
17 |
+
}
|
18 |
+
|
19 |
+
}
|
src/app/Mappers/ScssMenuMapper.php
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Mappers;
|
4 |
+
|
5 |
+
class ScssMenuMapper extends ScssMapper
|
6 |
+
{
|
7 |
+
|
8 |
+
public function map()
|
9 |
+
{
|
10 |
+
|
11 |
+
$css = <<<CSS
|
12 |
+
|
13 |
+
@media screen and ( max-width: {$this->options['breakpoint']}px ) {
|
14 |
+
|
15 |
+
@if '{$this->options['menu_close_on_body_click']}' == 'on' {
|
16 |
+
html.responsive-menu-open {
|
17 |
+
cursor: pointer;
|
18 |
+
#responsive-menu-container {
|
19 |
+
cursor: initial;
|
20 |
+
}
|
21 |
+
}
|
22 |
+
}
|
23 |
+
|
24 |
+
@if '{$this->options['page_wrapper']}' != '' {
|
25 |
+
& {$this->options['page_wrapper']} {
|
26 |
+
transition: transform {$this->options['animation_speed']}s;
|
27 |
+
}
|
28 |
+
html.responsive-menu-open,
|
29 |
+
.responsive-menu-open body {
|
30 |
+
width: 100%;
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
#responsive-menu-container {
|
35 |
+
width: {$this->options['menu_width']}%;
|
36 |
+
{$this->options['menu_appear_from']}: 0;
|
37 |
+
background: {$this->options['menu_background_colour']};
|
38 |
+
transition: transform {$this->options['animation_speed']}s;
|
39 |
+
text-align: {$this->options['menu_text_alignment']};
|
40 |
+
|
41 |
+
& #responsive-menu-wrapper {
|
42 |
+
background: {$this->options['menu_background_colour']};
|
43 |
+
}
|
44 |
+
|
45 |
+
#responsive-menu-additional-content {
|
46 |
+
color: {$this->options['menu_additional_content_colour']};
|
47 |
+
}
|
48 |
+
|
49 |
+
@if '{$this->options['menu_maximum_width']}' != '' {
|
50 |
+
max-width: {$this->options['menu_maximum_width']}px;
|
51 |
+
}
|
52 |
+
@if '{$this->options['menu_minimum_width']}' != '' {
|
53 |
+
min-width: {$this->options['menu_minimum_width']}px;
|
54 |
+
}
|
55 |
+
|
56 |
+
@if '{$this->options['menu_font']}' != '' {
|
57 |
+
font-family: '{$this->options['menu_font']}';
|
58 |
+
}
|
59 |
+
|
60 |
+
& a, & #responsive-menu-title, & .responsive-menu-subarrow {
|
61 |
+
transition: all {$this->options['transition_speed']}s;
|
62 |
+
}
|
63 |
+
|
64 |
+
#responsive-menu-title {
|
65 |
+
background-color: {$this->options['menu_title_background_colour']};
|
66 |
+
color: {$this->options['menu_title_colour']};
|
67 |
+
font-size: {$this->options['menu_title_font_size']}px;
|
68 |
+
a {
|
69 |
+
color: {$this->options['menu_title_colour']};
|
70 |
+
text-decoration: none;
|
71 |
+
&:hover {
|
72 |
+
color: {$this->options['menu_title_hover_colour']};
|
73 |
+
}
|
74 |
+
}
|
75 |
+
&:hover {
|
76 |
+
background-color: {$this->options['menu_title_background_hover_colour']};
|
77 |
+
color: {$this->options['menu_title_hover_colour']};
|
78 |
+
a {
|
79 |
+
color: {$this->options['menu_title_hover_colour']};
|
80 |
+
}
|
81 |
+
}
|
82 |
+
#responsive-menu-title-image {
|
83 |
+
display: inline-block;
|
84 |
+
vertical-align: middle;
|
85 |
+
margin-right: 15px;
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
#responsive-menu {
|
90 |
+
|
91 |
+
li.responsive-menu-item {
|
92 |
+
.responsive-menu-item-link {
|
93 |
+
font-size: {$this->options['menu_font_size']}px;
|
94 |
+
}
|
95 |
+
a {
|
96 |
+
line-height: {$this->options['menu_links_height']}px;
|
97 |
+
border: 1px solid {$this->options['menu_item_border_colour']};
|
98 |
+
color: {$this->options['menu_link_colour']};
|
99 |
+
background-color: {$this->options['menu_item_background_colour']};
|
100 |
+
&:hover {
|
101 |
+
color: {$this->options['menu_link_hover_colour']};
|
102 |
+
background-color: {$this->options['menu_item_background_hover_colour']};
|
103 |
+
border-color: {$this->options['menu_item_border_colour_hover']};
|
104 |
+
.responsive-menu-subarrow {
|
105 |
+
color: {$this->options['menu_sub_arrow_shape_hover_colour']};
|
106 |
+
border-color: {$this->options['menu_sub_arrow_border_hover_colour']};
|
107 |
+
background-color: {$this->options['menu_sub_arrow_background_hover_colour']};
|
108 |
+
}
|
109 |
+
}
|
110 |
+
|
111 |
+
.responsive-menu-subarrow {
|
112 |
+
height: {$this->options['submenu_arrow_height']}px;
|
113 |
+
line-height: {$this->options['submenu_arrow_height']}px;
|
114 |
+
width: {$this->options['submenu_arrow_width']}px;
|
115 |
+
color: {$this->options['menu_sub_arrow_shape_colour']};
|
116 |
+
border: 1px solid {$this->options['menu_sub_arrow_border_colour']};
|
117 |
+
background-color: {$this->options['menu_sub_arrow_background_colour']};
|
118 |
+
|
119 |
+
&:hover {
|
120 |
+
color: {$this->options['menu_sub_arrow_shape_hover_colour']};
|
121 |
+
border-color: {$this->options['menu_sub_arrow_border_hover_colour']};
|
122 |
+
background-color: {$this->options['menu_sub_arrow_background_hover_colour']};
|
123 |
+
}
|
124 |
+
}
|
125 |
+
}
|
126 |
+
&.responsive-menu-current-item > .responsive-menu-item-link {
|
127 |
+
background-color: {$this->options['menu_current_item_background_colour']};
|
128 |
+
color: {$this->options['menu_current_link_colour']};
|
129 |
+
&:hover {
|
130 |
+
background-color: {$this->options['menu_current_item_background_hover_colour']};
|
131 |
+
color: {$this->options['menu_current_link_hover_colour']};
|
132 |
+
}
|
133 |
+
}
|
134 |
+
}
|
135 |
+
}
|
136 |
+
}
|
137 |
+
@if '{$this->options['menu_to_hide']}' != '' {
|
138 |
+
& {$this->options['menu_to_hide']} {
|
139 |
+
display: none;
|
140 |
+
}
|
141 |
+
}
|
142 |
+
}
|
143 |
+
|
144 |
+
CSS;
|
145 |
+
|
146 |
+
return $this->compiler->compile($css);
|
147 |
+
}
|
148 |
+
|
149 |
+
}
|
src/app/Mappers/scssphp/.travis.yml
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
language: php
|
2 |
+
script: phpunit tests
|
3 |
+
php:
|
4 |
+
- 5.3
|
5 |
+
- 5.4
|
6 |
+
- 5.5
|
7 |
+
- hhvm
|
src/app/Mappers/scssphp/LICENSE.md
ADDED
@@ -0,0 +1,660 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
For ease of distribution, scssphp is available under a dual license.
|
2 |
+
You are free to pick which one suits your needs.
|
3 |
+
|
4 |
+
* * *
|
5 |
+
|
6 |
+
|
7 |
+
MIT LICENSE
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
+
|
12 |
+
Copyright (c) 2012 Leaf Corcoran, http://leafo.net/scssphp
|
13 |
+
|
14 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
15 |
+
a copy of this software and associated documentation files (the
|
16 |
+
"Software"), to deal in the Software without restriction, including
|
17 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
18 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
19 |
+
permit persons to whom the Software is furnished to do so, subject to
|
20 |
+
the following conditions:
|
21 |
+
|
22 |
+
The above copyright notice and this permission notice shall be
|
23 |
+
included in all copies or substantial portions of the Software.
|
24 |
+
|
25 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
26 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
27 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
28 |
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
29 |
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
30 |
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
31 |
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
32 |
+
|
33 |
+
* * *
|
34 |
+
|
35 |
+
|
36 |
+
GPL VERSION 3
|
37 |
+
|
38 |
+
|
39 |
+
|
40 |
+
|
41 |
+
GNU GENERAL PUBLIC LICENSE
|
42 |
+
Version 3, 29 June 2007
|
43 |
+
|
44 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
45 |
+
Everyone is permitted to copy and distribute verbatim copies
|
46 |
+
of this license document, but changing it is not allowed.
|
47 |
+
|
48 |
+
Preamble
|
49 |
+
|
50 |
+
The GNU General Public License is a free, copyleft license for
|
51 |
+
software and other kinds of works.
|
52 |
+
|
53 |
+
The licenses for most software and other practical works are designed
|
54 |
+
to take away your freedom to share and change the works. By contrast,
|
55 |
+
the GNU General Public License is intended to guarantee your freedom to
|
56 |
+
share and change all versions of a program--to make sure it remains free
|
57 |
+
software for all its users. We, the Free Software Foundation, use the
|
58 |
+
GNU General Public License for most of our software; it applies also to
|
59 |
+
any other work released this way by its authors. You can apply it to
|
60 |
+
your programs, too.
|
61 |
+
|
62 |
+
When we speak of free software, we are referring to freedom, not
|
63 |
+
price. Our General Public Licenses are designed to make sure that you
|
64 |
+
have the freedom to distribute copies of free software (and charge for
|
65 |
+
them if you wish), that you receive source code or can get it if you
|
66 |
+
want it, that you can change the software or use pieces of it in new
|
67 |
+
free programs, and that you know you can do these things.
|
68 |
+
|
69 |
+
To protect your rights, we need to prevent others from denying you
|
70 |
+
these rights or asking you to surrender the rights. Therefore, you have
|
71 |
+
certain responsibilities if you distribute copies of the software, or if
|
72 |
+
you modify it: responsibilities to respect the freedom of others.
|
73 |
+
|
74 |
+
For example, if you distribute copies of such a program, whether
|
75 |
+
gratis or for a fee, you must pass on to the recipients the same
|
76 |
+
freedoms that you received. You must make sure that they, too, receive
|
77 |
+
or can get the source code. And you must show them these terms so they
|
78 |
+
know their rights.
|
79 |
+
|
80 |
+
Developers that use the GNU GPL protect your rights with two steps:
|
81 |
+
(1) assert copyright on the software, and (2) offer you this License
|
82 |
+
giving you legal permission to copy, distribute and/or modify it.
|
83 |
+
|
84 |
+
For the developers' and authors' protection, the GPL clearly explains
|
85 |
+
that there is no warranty for this free software. For both users' and
|
86 |
+
authors' sake, the GPL requires that modified versions be marked as
|
87 |
+
changed, so that their problems will not be attributed erroneously to
|
88 |
+
authors of previous versions.
|
89 |
+
|
90 |
+
Some devices are designed to deny users access to install or run
|
91 |
+
modified versions of the software inside them, although the manufacturer
|
92 |
+
can do so. This is fundamentally incompatible with the aim of
|
93 |
+
protecting users' freedom to change the software. The systematic
|
94 |
+
pattern of such abuse occurs in the area of products for individuals to
|
95 |
+
use, which is precisely where it is most unacceptable. Therefore, we
|
96 |
+
have designed this version of the GPL to prohibit the practice for those
|
97 |
+
products. If such problems arise substantially in other domains, we
|
98 |
+
stand ready to extend this provision to those domains in future versions
|
99 |
+
of the GPL, as needed to protect the freedom of users.
|
100 |
+
|
101 |
+
Finally, every program is threatened constantly by software patents.
|
102 |
+
States should not allow patents to restrict development and use of
|
103 |
+
software on general-purpose computers, but in those that do, we wish to
|
104 |
+
avoid the special danger that patents applied to a free program could
|
105 |
+
make it effectively proprietary. To prevent this, the GPL assures that
|
106 |
+
patents cannot be used to render the program non-free.
|
107 |
+
|
108 |
+
The precise terms and conditions for copying, distribution and
|
109 |
+
modification follow.
|
110 |
+
|
111 |
+
TERMS AND CONDITIONS
|
112 |
+
|
113 |
+
0. Definitions.
|
114 |
+
|
115 |
+
"This License" refers to version 3 of the GNU General Public License.
|
116 |
+
|
117 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
118 |
+
works, such as semiconductor masks.
|
119 |
+
|
120 |
+
"The Program" refers to any copyrightable work licensed under this
|
121 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
122 |
+
"recipients" may be individuals or organizations.
|
123 |
+
|
124 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
125 |
+
in a fashion requiring copyright permission, other than the making of an
|
126 |
+
exact copy. The resulting work is called a "modified version" of the
|
127 |
+
earlier work or a work "based on" the earlier work.
|
128 |
+
|
129 |
+
A "covered work" means either the unmodified Program or a work based
|
130 |
+
on the Program.
|
131 |
+
|
132 |
+
To "propagate" a work means to do anything with it that, without
|
133 |
+
permission, would make you directly or secondarily liable for
|
134 |
+
infringement under applicable copyright law, except executing it on a
|
135 |
+
computer or modifying a private copy. Propagation includes copying,
|
136 |
+
distribution (with or without modification), making available to the
|
137 |
+
public, and in some countries other activities as well.
|
138 |
+
|
139 |
+
To "convey" a work means any kind of propagation that enables other
|
140 |
+
parties to make or receive copies. Mere interaction with a user through
|
141 |
+
a computer network, with no transfer of a copy, is not conveying.
|
142 |
+
|
143 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
144 |
+
to the extent that it includes a convenient and prominently visible
|
145 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
146 |
+
tells the user that there is no warranty for the work (except to the
|
147 |
+
extent that warranties are provided), that licensees may convey the
|
148 |
+
work under this License, and how to view a copy of this License. If
|
149 |
+
the interface presents a list of user commands or options, such as a
|
150 |
+
menu, a prominent item in the list meets this criterion.
|
151 |
+
|
152 |
+
1. Source Code.
|
153 |
+
|
154 |
+
The "source code" for a work means the preferred form of the work
|
155 |
+
for making modifications to it. "Object code" means any non-source
|
156 |
+
form of a work.
|
157 |
+
|
158 |
+
A "Standard Interface" means an interface that either is an official
|
159 |
+
standard defined by a recognized standards body, or, in the case of
|
160 |
+
interfaces specified for a particular programming language, one that
|
161 |
+
is widely used among developers working in that language.
|
162 |
+
|
163 |
+
The "System Libraries" of an executable work include anything, other
|
164 |
+
than the work as a whole, that (a) is included in the normal form of
|
165 |
+
packaging a Major Component, but which is not part of that Major
|
166 |
+
Component, and (b) serves only to enable use of the work with that
|
167 |
+
Major Component, or to implement a Standard Interface for which an
|
168 |
+
implementation is available to the public in source code form. A
|
169 |
+
"Major Component", in this context, means a major essential component
|
170 |
+
(kernel, window system, and so on) of the specific operating system
|
171 |
+
(if any) on which the executable work runs, or a compiler used to
|
172 |
+
produce the work, or an object code interpreter used to run it.
|
173 |
+
|
174 |
+
The "Corresponding Source" for a work in object code form means all
|
175 |
+
the source code needed to generate, install, and (for an executable
|
176 |
+
work) run the object code and to modify the work, including scripts to
|
177 |
+
control those activities. However, it does not include the work's
|
178 |
+
System Libraries, or general-purpose tools or generally available free
|
179 |
+
programs which are used unmodified in performing those activities but
|
180 |
+
which are not part of the work. For example, Corresponding Source
|
181 |
+
includes interface definition files associated with source files for
|
182 |
+
the work, and the source code for shared libraries and dynamically
|
183 |
+
linked subprograms that the work is specifically designed to require,
|
184 |
+
such as by intimate data communication or control flow between those
|
185 |
+
subprograms and other parts of the work.
|
186 |
+
|
187 |
+
The Corresponding Source need not include anything that users
|
188 |
+
can regenerate automatically from other parts of the Corresponding
|
189 |
+
Source.
|
190 |
+
|
191 |
+
The Corresponding Source for a work in source code form is that
|
192 |
+
same work.
|
193 |
+
|
194 |
+
2. Basic Permissions.
|
195 |
+
|
196 |
+
All rights granted under this License are granted for the term of
|
197 |
+
copyright on the Program, and are irrevocable provided the stated
|
198 |
+
conditions are met. This License explicitly affirms your unlimited
|
199 |
+
permission to run the unmodified Program. The output from running a
|
200 |
+
covered work is covered by this License only if the output, given its
|
201 |
+
content, constitutes a covered work. This License acknowledges your
|
202 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
203 |
+
|
204 |
+
You may make, run and propagate covered works that you do not
|
205 |
+
convey, without conditions so long as your license otherwise remains
|
206 |
+
in force. You may convey covered works to others for the sole purpose
|
207 |
+
of having them make modifications exclusively for you, or provide you
|
208 |
+
with facilities for running those works, provided that you comply with
|
209 |
+
the terms of this License in conveying all material for which you do
|
210 |
+
not control copyright. Those thus making or running the covered works
|
211 |
+
for you must do so exclusively on your behalf, under your direction
|
212 |
+
and control, on terms that prohibit them from making any copies of
|
213 |
+
your copyrighted material outside their relationship with you.
|
214 |
+
|
215 |
+
Conveying under any other circumstances is permitted solely under
|
216 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
217 |
+
makes it unnecessary.
|
218 |
+
|
219 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
220 |
+
|
221 |
+
No covered work shall be deemed part of an effective technological
|
222 |
+
measure under any applicable law fulfilling obligations under article
|
223 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
224 |
+
similar laws prohibiting or restricting circumvention of such
|
225 |
+
measures.
|
226 |
+
|
227 |
+
When you convey a covered work, you waive any legal power to forbid
|
228 |
+
circumvention of technological measures to the extent such circumvention
|
229 |
+
is effected by exercising rights under this License with respect to
|
230 |
+
the covered work, and you disclaim any intention to limit operation or
|
231 |
+
modification of the work as a means of enforcing, against the work's
|
232 |
+
users, your or third parties' legal rights to forbid circumvention of
|
233 |
+
technological measures.
|
234 |
+
|
235 |
+
4. Conveying Verbatim Copies.
|
236 |
+
|
237 |
+
You may convey verbatim copies of the Program's source code as you
|
238 |
+
receive it, in any medium, provided that you conspicuously and
|
239 |
+
appropriately publish on each copy an appropriate copyright notice;
|
240 |
+
keep intact all notices stating that this License and any
|
241 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
242 |
+
keep intact all notices of the absence of any warranty; and give all
|
243 |
+
recipients a copy of this License along with the Program.
|
244 |
+
|
245 |
+
You may charge any price or no price for each copy that you convey,
|
246 |
+
and you may offer support or warranty protection for a fee.
|
247 |
+
|
248 |
+
5. Conveying Modified Source Versions.
|
249 |
+
|
250 |
+
You may convey a work based on the Program, or the modifications to
|
251 |
+
produce it from the Program, in the form of source code under the
|
252 |
+
terms of section 4, provided that you also meet all of these conditions:
|
253 |
+
|
254 |
+
a) The work must carry prominent notices stating that you modified
|
255 |
+
it, and giving a relevant date.
|
256 |
+
|
257 |
+
b) The work must carry prominent notices stating that it is
|
258 |
+
released under this License and any conditions added under section
|
259 |
+
7. This requirement modifies the requirement in section 4 to
|
260 |
+
"keep intact all notices".
|
261 |
+
|
262 |
+
c) You must license the entire work, as a whole, under this
|
263 |
+
License to anyone who comes into possession of a copy. This
|
264 |
+
License will therefore apply, along with any applicable section 7
|
265 |
+
additional terms, to the whole of the work, and all its parts,
|
266 |
+
regardless of how they are packaged. This License gives no
|
267 |
+
permission to license the work in any other way, but it does not
|
268 |
+
invalidate such permission if you have separately received it.
|
269 |
+
|
270 |
+
d) If the work has interactive user interfaces, each must display
|
271 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
272 |
+
interfaces that do not display Appropriate Legal Notices, your
|
273 |
+
work need not make them do so.
|
274 |
+
|
275 |
+
A compilation of a covered work with other separate and independent
|
276 |
+
works, which are not by their nature extensions of the covered work,
|
277 |
+
and which are not combined with it such as to form a larger program,
|
278 |
+
in or on a volume of a storage or distribution medium, is called an
|
279 |
+
"aggregate" if the compilation and its resulting copyright are not
|
280 |
+
used to limit the access or legal rights of the compilation's users
|
281 |
+
beyond what the individual works permit. Inclusion of a covered work
|
282 |
+
in an aggregate does not cause this License to apply to the other
|
283 |
+
parts of the aggregate.
|
284 |
+
|
285 |
+
6. Conveying Non-Source Forms.
|
286 |
+
|
287 |
+
You may convey a covered work in object code form under the terms
|
288 |
+
of sections 4 and 5, provided that you also convey the
|
289 |
+
machine-readable Corresponding Source under the terms of this License,
|
290 |
+
in one of these ways:
|
291 |
+
|
292 |
+
a) Convey the object code in, or embodied in, a physical product
|
293 |
+
(including a physical distribution medium), accompanied by the
|
294 |
+
Corresponding Source fixed on a durable physical medium
|
295 |
+
customarily used for software interchange.
|
296 |
+
|
297 |
+
b) Convey the object code in, or embodied in, a physical product
|
298 |
+
(including a physical distribution medium), accompanied by a
|
299 |
+
written offer, valid for at least three years and valid for as
|
300 |
+
long as you offer spare parts or customer support for that product
|
301 |
+
model, to give anyone who possesses the object code either (1) a
|
302 |
+
copy of the Corresponding Source for all the software in the
|
303 |
+
product that is covered by this License, on a durable physical
|
304 |
+
medium customarily used for software interchange, for a price no
|
305 |
+
more than your reasonable cost of physically performing this
|
306 |
+
conveying of source, or (2) access to copy the
|
307 |
+
Corresponding Source from a network server at no charge.
|
308 |
+
|
309 |
+
c) Convey individual copies of the object code with a copy of the
|
310 |
+
written offer to provide the Corresponding Source. This
|
311 |
+
alternative is allowed only occasionally and noncommercially, and
|
312 |
+
only if you received the object code with such an offer, in accord
|
313 |
+
with subsection 6b.
|
314 |
+
|
315 |
+
d) Convey the object code by offering access from a designated
|
316 |
+
place (gratis or for a charge), and offer equivalent access to the
|
317 |
+
Corresponding Source in the same way through the same place at no
|
318 |
+
further charge. You need not require recipients to copy the
|
319 |
+
Corresponding Source along with the object code. If the place to
|
320 |
+
copy the object code is a network server, the Corresponding Source
|
321 |
+
may be on a different server (operated by you or a third party)
|
322 |
+
that supports equivalent copying facilities, provided you maintain
|
323 |
+
clear directions next to the object code saying where to find the
|
324 |
+
Corresponding Source. Regardless of what server hosts the
|
325 |
+
Corresponding Source, you remain obligated to ensure that it is
|
326 |
+
available for as long as needed to satisfy these requirements.
|
327 |
+
|
328 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
329 |
+
you inform other peers where the object code and Corresponding
|
330 |
+
Source of the work are being offered to the general public at no
|
331 |
+
charge under subsection 6d.
|
332 |
+
|
333 |
+
A separable portion of the object code, whose source code is excluded
|
334 |
+
from the Corresponding Source as a System Library, need not be
|
335 |
+
included in conveying the object code work.
|
336 |
+
|
337 |
+
A "User Product" is either (1) a "consumer product", which means any
|
338 |
+
tangible personal property which is normally used for personal, family,
|
339 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
340 |
+
into a dwelling. In determining whether a product is a consumer product,
|
341 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
342 |
+
product received by a particular user, "normally used" refers to a
|
343 |
+
typical or common use of that class of product, regardless of the status
|
344 |
+
of the particular user or of the way in which the particular user
|
345 |
+
actually uses, or expects or is expected to use, the product. A product
|
346 |
+
is a consumer product regardless of whether the product has substantial
|
347 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
348 |
+
the only significant mode of use of the product.
|
349 |
+
|
350 |
+
"Installation Information" for a User Product means any methods,
|
351 |
+
procedures, authorization keys, or other information required to install
|
352 |
+
and execute modified versions of a covered work in that User Product from
|
353 |
+
a modified version of its Corresponding Source. The information must
|
354 |
+
suffice to ensure that the continued functioning of the modified object
|
355 |
+
code is in no case prevented or interfered with solely because
|
356 |
+
modification has been made.
|
357 |
+
|
358 |
+
If you convey an object code work under this section in, or with, or
|
359 |
+
specifically for use in, a User Product, and the conveying occurs as
|
360 |
+
part of a transaction in which the right of possession and use of the
|
361 |
+
User Product is transferred to the recipient in perpetuity or for a
|
362 |
+
fixed term (regardless of how the transaction is characterized), the
|
363 |
+
Corresponding Source conveyed under this section must be accompanied
|
364 |
+
by the Installation Information. But this requirement does not apply
|
365 |
+
if neither you nor any third party retains the ability to install
|
366 |
+
modified object code on the User Product (for example, the work has
|
367 |
+
been installed in ROM).
|
368 |
+
|
369 |
+
The requirement to provide Installation Information does not include a
|
370 |
+
requirement to continue to provide support service, warranty, or updates
|
371 |
+
for a work that has been modified or installed by the recipient, or for
|
372 |
+
the User Product in which it has been modified or installed. Access to a
|
373 |
+
network may be denied when the modification itself materially and
|
374 |
+
adversely affects the operation of the network or violates the rules and
|
375 |
+
protocols for communication across the network.
|
376 |
+
|
377 |
+
Corresponding Source conveyed, and Installation Information provided,
|
378 |
+
in accord with this section must be in a format that is publicly
|
379 |
+
documented (and with an implementation available to the public in
|
380 |
+
source code form), and must require no special password or key for
|
381 |
+
unpacking, reading or copying.
|
382 |
+
|
383 |
+
7. Additional Terms.
|
384 |
+
|
385 |
+
"Additional permissions" are terms that supplement the terms of this
|
386 |
+
License by making exceptions from one or more of its conditions.
|
387 |
+
Additional permissions that are applicable to the entire Program shall
|
388 |
+
be treated as though they were included in this License, to the extent
|
389 |
+
that they are valid under applicable law. If additional permissions
|
390 |
+
apply only to part of the Program, that part may be used separately
|
391 |
+
under those permissions, but the entire Program remains governed by
|
392 |
+
this License without regard to the additional permissions.
|
393 |
+
|
394 |
+
When you convey a copy of a covered work, you may at your option
|
395 |
+
remove any additional permissions from that copy, or from any part of
|
396 |
+
it. (Additional permissions may be written to require their own
|
397 |
+
removal in certain cases when you modify the work.) You may place
|
398 |
+
additional permissions on material, added by you to a covered work,
|
399 |
+
for which you have or can give appropriate copyright permission.
|
400 |
+
|
401 |
+
Notwithstanding any other provision of this License, for material you
|
402 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
403 |
+
that material) supplement the terms of this License with terms:
|
404 |
+
|
405 |
+
a) Disclaiming warranty or limiting liability differently from the
|
406 |
+
terms of sections 15 and 16 of this License; or
|
407 |
+
|
408 |
+
b) Requiring preservation of specified reasonable legal notices or
|
409 |
+
author attributions in that material or in the Appropriate Legal
|
410 |
+
Notices displayed by works containing it; or
|
411 |
+
|
412 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
413 |
+
requiring that modified versions of such material be marked in
|
414 |
+
reasonable ways as different from the original version; or
|
415 |
+
|
416 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
417 |
+
authors of the material; or
|
418 |
+
|
419 |
+
e) Declining to grant rights under trademark law for use of some
|
420 |
+
trade names, trademarks, or service marks; or
|
421 |
+
|
422 |
+
f) Requiring indemnification of licensors and authors of that
|
423 |
+
material by anyone who conveys the material (or modified versions of
|
424 |
+
it) with contractual assumptions of liability to the recipient, for
|
425 |
+
any liability that these contractual assumptions directly impose on
|
426 |
+
those licensors and authors.
|
427 |
+
|
428 |
+
All other non-permissive additional terms are considered "further
|
429 |
+
restrictions" within the meaning of section 10. If the Program as you
|
430 |
+
received it, or any part of it, contains a notice stating that it is
|
431 |
+
governed by this License along with a term that is a further
|
432 |
+
restriction, you may remove that term. If a license document contains
|
433 |
+
a further restriction but permits relicensing or conveying under this
|
434 |
+
License, you may add to a covered work material governed by the terms
|
435 |
+
of that license document, provided that the further restriction does
|
436 |
+
not survive such relicensing or conveying.
|
437 |
+
|
438 |
+
If you add terms to a covered work in accord with this section, you
|
439 |
+
must place, in the relevant source files, a statement of the
|
440 |
+
additional terms that apply to those files, or a notice indicating
|
441 |
+
where to find the applicable terms.
|
442 |
+
|
443 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
444 |
+
form of a separately written license, or stated as exceptions;
|
445 |
+
the above requirements apply either way.
|
446 |
+
|
447 |
+
8. Termination.
|
448 |
+
|
449 |
+
You may not propagate or modify a covered work except as expressly
|
450 |
+
provided under this License. Any attempt otherwise to propagate or
|
451 |
+
modify it is void, and will automatically terminate your rights under
|
452 |
+
this License (including any patent licenses granted under the third
|
453 |
+
paragraph of section 11).
|
454 |
+
|
455 |
+
However, if you cease all violation of this License, then your
|
456 |
+
license from a particular copyright holder is reinstated (a)
|
457 |
+
provisionally, unless and until the copyright holder explicitly and
|
458 |
+
finally terminates your license, and (b) permanently, if the copyright
|
459 |
+
holder fails to notify you of the violation by some reasonable means
|
460 |
+
prior to 60 days after the cessation.
|
461 |
+
|
462 |
+
Moreover, your license from a particular copyright holder is
|
463 |
+
reinstated permanently if the copyright holder notifies you of the
|
464 |
+
violation by some reasonable means, this is the first time you have
|
465 |
+
received notice of violation of this License (for any work) from that
|
466 |
+
copyright holder, and you cure the violation prior to 30 days after
|
467 |
+
your receipt of the notice.
|
468 |
+
|
469 |
+
Termination of your rights under this section does not terminate the
|
470 |
+
licenses of parties who have received copies or rights from you under
|
471 |
+
this License. If your rights have been terminated and not permanently
|
472 |
+
reinstated, you do not qualify to receive new licenses for the same
|
473 |
+
material under section 10.
|
474 |
+
|
475 |
+
9. Acceptance Not Required for Having Copies.
|
476 |
+
|
477 |
+
You are not required to accept this License in order to receive or
|
478 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
479 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
480 |
+
to receive a copy likewise does not require acceptance. However,
|
481 |
+
nothing other than this License grants you permission to propagate or
|
482 |
+
modify any covered work. These actions infringe copyright if you do
|
483 |
+
not accept this License. Therefore, by modifying or propagating a
|
484 |
+
covered work, you indicate your acceptance of this License to do so.
|
485 |
+
|
486 |
+
10. Automatic Licensing of Downstream Recipients.
|
487 |
+
|
488 |
+
Each time you convey a covered work, the recipient automatically
|
489 |
+
receives a license from the original licensors, to run, modify and
|
490 |
+
propagate that work, subject to this License. You are not responsible
|
491 |
+
for enforcing compliance by third parties with this License.
|
492 |
+
|
493 |
+
An "entity transaction" is a transaction transferring control of an
|
494 |
+
organization, or substantially all assets of one, or subdividing an
|
495 |
+
organization, or merging organizations. If propagation of a covered
|
496 |
+
work results from an entity transaction, each party to that
|
497 |
+
transaction who receives a copy of the work also receives whatever
|
498 |
+
licenses to the work the party's predecessor in interest had or could
|
499 |
+
give under the previous paragraph, plus a right to possession of the
|
500 |
+
Corresponding Source of the work from the predecessor in interest, if
|
501 |
+
the predecessor has it or can get it with reasonable efforts.
|
502 |
+
|
503 |
+
You may not impose any further restrictions on the exercise of the
|
504 |
+
rights granted or affirmed under this License. For example, you may
|
505 |
+
not impose a license fee, royalty, or other charge for exercise of
|
506 |
+
rights granted under this License, and you may not initiate litigation
|
507 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
508 |
+
any patent claim is infringed by making, using, selling, offering for
|
509 |
+
sale, or importing the Program or any portion of it.
|
510 |
+
|
511 |
+
11. Patents.
|
512 |
+
|
513 |
+
A "contributor" is a copyright holder who authorizes use under this
|
514 |
+
License of the Program or a work on which the Program is based. The
|
515 |
+
work thus licensed is called the contributor's "contributor version".
|
516 |
+
|
517 |
+
A contributor's "essential patent claims" are all patent claims
|
518 |
+
owned or controlled by the contributor, whether already acquired or
|
519 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
520 |
+
by this License, of making, using, or selling its contributor version,
|
521 |
+
but do not include claims that would be infringed only as a
|
522 |
+
consequence of further modification of the contributor version. For
|
523 |
+
purposes of this definition, "control" includes the right to grant
|
524 |
+
patent sublicenses in a manner consistent with the requirements of
|
525 |
+
this License.
|
526 |
+
|
527 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
528 |
+
patent license under the contributor's essential patent claims, to
|
529 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
530 |
+
propagate the contents of its contributor version.
|
531 |
+
|
532 |
+
In the following three paragraphs, a "patent license" is any express
|
533 |
+
agreement or commitment, however denominated, not to enforce a patent
|
534 |
+
(such as an express permission to practice a patent or covenant not to
|
535 |
+
sue for patent infringement). To "grant" such a patent license to a
|
536 |
+
party means to make such an agreement or commitment not to enforce a
|
537 |
+
patent against the party.
|
538 |
+
|
539 |
+
If you convey a covered work, knowingly relying on a patent license,
|
540 |
+
and the Corresponding Source of the work is not available for anyone
|
541 |
+
to copy, free of charge and under the terms of this License, through a
|
542 |
+
publicly available network server or other readily accessible means,
|
543 |
+
then you must either (1) cause the Corresponding Source to be so
|
544 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
545 |
+
patent license for this particular work, or (3) arrange, in a manner
|
546 |
+
consistent with the requirements of this License, to extend the patent
|
547 |
+
license to downstream recipients. "Knowingly relying" means you have
|
548 |
+
actual knowledge that, but for the patent license, your conveying the
|
549 |
+
covered work in a country, or your recipient's use of the covered work
|
550 |
+
in a country, would infringe one or more identifiable patents in that
|
551 |
+
country that you have reason to believe are valid.
|
552 |
+
|
553 |
+
If, pursuant to or in connection with a single transaction or
|
554 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
555 |
+
covered work, and grant a patent license to some of the parties
|
556 |
+
receiving the covered work authorizing them to use, propagate, modify
|
557 |
+
or convey a specific copy of the covered work, then the patent license
|
558 |
+
you grant is automatically extended to all recipients of the covered
|
559 |
+
work and works based on it.
|
560 |
+
|
561 |
+
A patent license is "discriminatory" if it does not include within
|
562 |
+
the scope of its coverage, prohibits the exercise of, or is
|
563 |
+
conditioned on the non-exercise of one or more of the rights that are
|
564 |
+
specifically granted under this License. You may not convey a covered
|
565 |
+
work if you are a party to an arrangement with a third party that is
|
566 |
+
in the business of distributing software, under which you make payment
|
567 |
+
to the third party based on the extent of your activity of conveying
|
568 |
+
the work, and under which the third party grants, to any of the
|
569 |
+
parties who would receive the covered work from you, a discriminatory
|
570 |
+
patent license (a) in connection with copies of the covered work
|
571 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
572 |
+
for and in connection with specific products or compilations that
|
573 |
+
contain the covered work, unless you entered into that arrangement,
|
574 |
+
or that patent license was granted, prior to 28 March 2007.
|
575 |
+
|
576 |
+
Nothing in this License shall be construed as excluding or limiting
|
577 |
+
any implied license or other defenses to infringement that may
|
578 |
+
otherwise be available to you under applicable patent law.
|
579 |
+
|
580 |
+
12. No Surrender of Others' Freedom.
|
581 |
+
|
582 |
+
If conditions are imposed on you (whether by court order, agreement or
|
583 |
+
otherwise) that contradict the conditions of this License, they do not
|
584 |
+
excuse you from the conditions of this License. If you cannot convey a
|
585 |
+
covered work so as to satisfy simultaneously your obligations under this
|
586 |
+
License and any other pertinent obligations, then as a consequence you may
|
587 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
588 |
+
to collect a royalty for further conveying from those to whom you convey
|
589 |
+
the Program, the only way you could satisfy both those terms and this
|
590 |
+
License would be to refrain entirely from conveying the Program.
|
591 |
+
|
592 |
+
13. Use with the GNU Affero General Public License.
|
593 |
+
|
594 |
+
Notwithstanding any other provision of this License, you have
|
595 |
+
permission to link or combine any covered work with a work licensed
|
596 |
+
under version 3 of the GNU Affero General Public License into a single
|
597 |
+
combined work, and to convey the resulting work. The terms of this
|
598 |
+
License will continue to apply to the part which is the covered work,
|
599 |
+
but the special requirements of the GNU Affero General Public License,
|
600 |
+
section 13, concerning interaction through a network will apply to the
|
601 |
+
combination as such.
|
602 |
+
|
603 |
+
14. Revised Versions of this License.
|
604 |
+
|
605 |
+
The Free Software Foundation may publish revised and/or new versions of
|
606 |
+
the GNU General Public License from time to time. Such new versions will
|
607 |
+
be similar in spirit to the present version, but may differ in detail to
|
608 |
+
address new problems or concerns.
|
609 |
+
|
610 |
+
Each version is given a distinguishing version number. If the
|
611 |
+
Program specifies that a certain numbered version of the GNU General
|
612 |
+
Public License "or any later version" applies to it, you have the
|
613 |
+
option of following the terms and conditions either of that numbered
|
614 |
+
version or of any later version published by the Free Software
|
615 |
+
Foundation. If the Program does not specify a version number of the
|
616 |
+
GNU General Public License, you may choose any version ever published
|
617 |
+
by the Free Software Foundation.
|
618 |
+
|
619 |
+
If the Program specifies that a proxy can decide which future
|
620 |
+
versions of the GNU General Public License can be used, that proxy's
|
621 |
+
public statement of acceptance of a version permanently authorizes you
|
622 |
+
to choose that version for the Program.
|
623 |
+
|
624 |
+
Later license versions may give you additional or different
|
625 |
+
permissions. However, no additional obligations are imposed on any
|
626 |
+
author or copyright holder as a result of your choosing to follow a
|
627 |
+
later version.
|
628 |
+
|
629 |
+
15. Disclaimer of Warranty.
|
630 |
+
|
631 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
632 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
633 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
634 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
635 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
636 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
637 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
638 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
639 |
+
|
640 |
+
16. Limitation of Liability.
|
641 |
+
|
642 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
643 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
644 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
645 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
646 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
647 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
648 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
649 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
650 |
+
SUCH DAMAGES.
|
651 |
+
|
652 |
+
17. Interpretation of Sections 15 and 16.
|
653 |
+
|
654 |
+
If the disclaimer of warranty and limitation of liability provided
|
655 |
+
above cannot be given local legal effect according to their terms,
|
656 |
+
reviewing courts shall apply local law that most closely approximates
|
657 |
+
an absolute waiver of all civil liability in connection with the
|
658 |
+
Program, unless a warranty or assumption of liability accompanies a
|
659 |
+
copy of the Program in return for a fee.
|
660 |
+
|
src/app/Mappers/scssphp/Makefile
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
|
2 |
+
test:
|
3 |
+
phpunit --colors tests
|
src/app/Mappers/scssphp/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# scssphp v0.0.12
|
2 |
+
### <http://leafo.net/scssphp>
|
3 |
+
|
4 |
+
[![Build Status](https://secure.travis-ci.org/leafo/scssphp.png)](http://travis-ci.org/leafo/scssphp)
|
5 |
+
|
6 |
+
`scssphp` is a compiler for SCSS written in PHP.
|
7 |
+
|
8 |
+
It implements SCSS 3.2.12. It does not implement the SASS syntax, only the SCSS
|
9 |
+
syntax.
|
10 |
+
|
11 |
+
Checkout the homepage, <http://leafo.net/scssphp>, for directions on how to use.
|
12 |
+
|
13 |
+
## Running Tests
|
14 |
+
|
15 |
+
`scssphp` uses [PHPUnit](https://github.com/sebastianbergmann/phpunit) for testing.
|
16 |
+
|
17 |
+
Run the following command from the root directory to run every test:
|
18 |
+
|
19 |
+
phpunit tests
|
20 |
+
|
21 |
+
There are two kinds of tests in the `tests/` directory:
|
22 |
+
|
23 |
+
* `ApiTest.php` contains various unit tests that test the PHP interface.
|
24 |
+
* `ExceptionTest.php` contains unit tests that test for exceptions thrown by the parser and compiler.
|
25 |
+
* `InputTest.php` compiles every `.scss` file in the `tests/inputs` directory
|
26 |
+
then compares to the respective `.css` file in the `tests/outputs` directory.
|
27 |
+
|
28 |
+
When changing any of the tests in `tests/inputs`, the tests will most likely
|
29 |
+
fail because the output has changed. Once you verify that the output is correct
|
30 |
+
you can run the following command to rebuild all the tests:
|
31 |
+
|
32 |
+
BUILD=true phpunit tests
|
33 |
+
|
34 |
+
This will compile all the tests, and save results into `tests/outputs`.
|
src/app/Mappers/scssphp/composer.json
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "leafo/scssphp",
|
3 |
+
"type": "library",
|
4 |
+
"description": "scssphp is a compiler for SCSS written in PHP.",
|
5 |
+
"homepage": "http://leafo.net/scssphp/",
|
6 |
+
"license": [
|
7 |
+
"MIT",
|
8 |
+
"GPL-3.0"
|
9 |
+
],
|
10 |
+
"authors": [
|
11 |
+
{
|
12 |
+
"name": "Leaf Corcoran",
|
13 |
+
"email": "leafot@gmail.com",
|
14 |
+
"homepage": "http://leafo.net"
|
15 |
+
}
|
16 |
+
],
|
17 |
+
"autoload": {
|
18 |
+
"classmap": ["scss.inc.php"]
|
19 |
+
},
|
20 |
+
"require": {
|
21 |
+
"php": ">=5.2.0"
|
22 |
+
},
|
23 |
+
"require-dev": {
|
24 |
+
"php": ">=5.3.0",
|
25 |
+
"phpunit/phpunit": "3.7.*"
|
26 |
+
},
|
27 |
+
"bin": ["pscss"]
|
28 |
+
}
|
src/app/Mappers/scssphp/phpunit.xml.dist
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
|
3 |
+
<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
|
4 |
+
<phpunit
|
5 |
+
backupGlobals = "false"
|
6 |
+
backupStaticAttributes = "false"
|
7 |
+
strict = "false"
|
8 |
+
colors = "true"
|
9 |
+
convertErrorsToExceptions = "true"
|
10 |
+
convertNoticesToExceptions = "true"
|
11 |
+
convertWarningsToExceptions = "true"
|
12 |
+
processIsolation = "false"
|
13 |
+
stopOnFailure = "false"
|
14 |
+
syntaxCheck = "false">
|
15 |
+
|
16 |
+
<testsuites>
|
17 |
+
<testsuite name="Project Test Suite">
|
18 |
+
<directory>tests</directory>
|
19 |
+
</testsuite>
|
20 |
+
</testsuites>
|
21 |
+
|
22 |
+
<filter>
|
23 |
+
<whitelist>
|
24 |
+
<directory>.</directory>
|
25 |
+
</whitelist>
|
26 |
+
</filter>
|
27 |
+
|
28 |
+
</phpunit>
|
src/app/Mappers/scssphp/pscss
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env php
|
2 |
+
<?php
|
3 |
+
error_reporting(E_ALL);
|
4 |
+
|
5 |
+
require "scss.inc.php";
|
6 |
+
|
7 |
+
$opts = getopt('hvTf:', array('help', 'version'));
|
8 |
+
|
9 |
+
function has() {
|
10 |
+
global $opts;
|
11 |
+
foreach (func_get_args() as $arg) {
|
12 |
+
if (isset($opts[$arg])) return true;
|
13 |
+
}
|
14 |
+
return false;
|
15 |
+
}
|
16 |
+
|
17 |
+
if (has("h", "help")) {
|
18 |
+
$exe = array_shift($argv);
|
19 |
+
|
20 |
+
$HELP = <<<EOT
|
21 |
+
Usage: $exe [options] < input-file
|
22 |
+
|
23 |
+
Options include:
|
24 |
+
|
25 |
+
-h, --help Show this message
|
26 |
+
-v, --version Print the version
|
27 |
+
-f=format Set the output format
|
28 |
+
-T Dump formatted parse tree
|
29 |
+
|
30 |
+
EOT;
|
31 |
+
exit($HELP);
|
32 |
+
}
|
33 |
+
|
34 |
+
if (has("v", "version")) {
|
35 |
+
exit(scssc::$VERSION . "\n");
|
36 |
+
}
|
37 |
+
|
38 |
+
$data = "";
|
39 |
+
while (!feof(STDIN)) {
|
40 |
+
$data .= fread(STDIN, 8192);
|
41 |
+
}
|
42 |
+
|
43 |
+
if (has("T")) {
|
44 |
+
$parser = new scss_parser("STDIN");
|
45 |
+
print_r($parser->parse($data));
|
46 |
+
exit();
|
47 |
+
}
|
48 |
+
|
49 |
+
$scss = new scssc();
|
50 |
+
if (has("f")) {
|
51 |
+
$scss->setFormatter($opts["f"]);
|
52 |
+
}
|
53 |
+
echo $scss->compile($data, "STDIN");
|
src/app/Mappers/scssphp/scss.inc.php
ADDED
@@ -0,0 +1,4576 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* SCSS compiler written in PHP
|
4 |
+
*
|
5 |
+
* @copyright 2012-2013 Leaf Corcoran
|
6 |
+
*
|
7 |
+
* @license http://opensource.org/licenses/gpl-license GPL-3.0
|
8 |
+
* @license http://opensource.org/licenses/MIT MIT
|
9 |
+
*
|
10 |
+
* @link http://leafo.net/scssphp
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* The scss compiler and parser.
|
15 |
+
*
|
16 |
+
* Converting SCSS to CSS is a three stage process. The incoming file is parsed
|
17 |
+
* by `scss_parser` into a syntax tree, then it is compiled into another tree
|
18 |
+
* representing the CSS structure by `scssc`. The CSS tree is fed into a
|
19 |
+
* formatter, like `scss_formatter` which then outputs CSS as a string.
|
20 |
+
*
|
21 |
+
* During the first compile, all values are *reduced*, which means that their
|
22 |
+
* types are brought to the lowest form before being dump as strings. This
|
23 |
+
* handles math equations, variable dereferences, and the like.
|
24 |
+
*
|
25 |
+
* The `parse` function of `scssc` is the entry point.
|
26 |
+
*
|
27 |
+
* In summary:
|
28 |
+
*
|
29 |
+
* The `scssc` class creates an instance of the parser, feeds it SCSS code,
|
30 |
+
* then transforms the resulting tree to a CSS tree. This class also holds the
|
31 |
+
* evaluation context, such as all available mixins and variables at any given
|
32 |
+
* time.
|
33 |
+
*
|
34 |
+
* The `scss_parser` class is only concerned with parsing its input.
|
35 |
+
*
|
36 |
+
* The `scss_formatter` takes a CSS tree, and dumps it to a formatted string,
|
37 |
+
* handling things like indentation.
|
38 |
+
*/
|
39 |
+
|
40 |
+
/**
|
41 |
+
* SCSS compiler
|
42 |
+
*
|
43 |
+
* @author Leaf Corcoran <leafot@gmail.com>
|
44 |
+
*/
|
45 |
+
class scssc {
|
46 |
+
static public $VERSION = 'v0.0.12';
|
47 |
+
|
48 |
+
static protected $operatorNames = array(
|
49 |
+
'+' => "add",
|
50 |
+
'-' => "sub",
|
51 |
+
'*' => "mul",
|
52 |
+
'/' => "div",
|
53 |
+
'%' => "mod",
|
54 |
+
|
55 |
+
'==' => "eq",
|
56 |
+
'!=' => "neq",
|
57 |
+
'<' => "lt",
|
58 |
+
'>' => "gt",
|
59 |
+
|
60 |
+
'<=' => "lte",
|
61 |
+
'>=' => "gte",
|
62 |
+
);
|
63 |
+
|
64 |
+
static protected $namespaces = array(
|
65 |
+
"special" => "%",
|
66 |
+
"mixin" => "@",
|
67 |
+
"function" => "^",
|
68 |
+
);
|
69 |
+
|
70 |
+
static protected $unitTable = array(
|
71 |
+
"in" => array(
|
72 |
+
"in" => 1,
|
73 |
+
"pt" => 72,
|
74 |
+
"pc" => 6,
|
75 |
+
"cm" => 2.54,
|
76 |
+
"mm" => 25.4,
|
77 |
+
"px" => 96,
|
78 |
+
)
|
79 |
+
);
|
80 |
+
|
81 |
+
static public $true = array("keyword", "true");
|
82 |
+
static public $false = array("keyword", "false");
|
83 |
+
static public $null = array("null");
|
84 |
+
|
85 |
+
static public $defaultValue = array("keyword", "");
|
86 |
+
static public $selfSelector = array("self");
|
87 |
+
|
88 |
+
protected $importPaths = array("");
|
89 |
+
protected $importCache = array();
|
90 |
+
|
91 |
+
protected $userFunctions = array();
|
92 |
+
protected $registeredVars = array();
|
93 |
+
|
94 |
+
protected $numberPrecision = 5;
|
95 |
+
|
96 |
+
protected $formatter = "scss_formatter_nested";
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Compile scss
|
100 |
+
*
|
101 |
+
* @param string $code
|
102 |
+
* @param string $name
|
103 |
+
*
|
104 |
+
* @return string
|
105 |
+
*/
|
106 |
+
public function compile($code, $name = null)
|
107 |
+
{
|
108 |
+
try {
|
109 |
+
$this->indentLevel = -1;
|
110 |
+
$this->commentsSeen = array();
|
111 |
+
$this->extends = array();
|
112 |
+
$this->extendsMap = array();
|
113 |
+
$this->parsedFiles = array();
|
114 |
+
$this->env = null;
|
115 |
+
$this->scope = null;
|
116 |
+
|
117 |
+
$locale = setlocale(LC_NUMERIC, 0);
|
118 |
+
setlocale(LC_NUMERIC, "C");
|
119 |
+
|
120 |
+
$this->parser = new scss_parser($name);
|
121 |
+
|
122 |
+
$tree = $this->parser->parse($code);
|
123 |
+
|
124 |
+
$this->formatter = new $this->formatter();
|
125 |
+
|
126 |
+
$this->pushEnv($tree);
|
127 |
+
$this->injectVariables($this->registeredVars);
|
128 |
+
$this->compileRoot($tree);
|
129 |
+
$this->popEnv();
|
130 |
+
|
131 |
+
$out = $this->formatter->format($this->scope);
|
132 |
+
|
133 |
+
setlocale(LC_NUMERIC, $locale);
|
134 |
+
|
135 |
+
return $out;
|
136 |
+
} catch(Exception $e) {}
|
137 |
+
}
|
138 |
+
|
139 |
+
protected function isSelfExtend($target, $origin) {
|
140 |
+
foreach ($origin as $sel) {
|
141 |
+
if (in_array($target, $sel)) {
|
142 |
+
return true;
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
return false;
|
147 |
+
}
|
148 |
+
|
149 |
+
protected function pushExtends($target, $origin) {
|
150 |
+
if ($this->isSelfExtend($target, $origin)) {
|
151 |
+
return;
|
152 |
+
}
|
153 |
+
|
154 |
+
$i = count($this->extends);
|
155 |
+
$this->extends[] = array($target, $origin);
|
156 |
+
|
157 |
+
foreach ($target as $part) {
|
158 |
+
if (isset($this->extendsMap[$part])) {
|
159 |
+
$this->extendsMap[$part][] = $i;
|
160 |
+
} else {
|
161 |
+
$this->extendsMap[$part] = array($i);
|
162 |
+
}
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
protected function makeOutputBlock($type, $selectors = null) {
|
167 |
+
$out = new stdClass;
|
168 |
+
$out->type = $type;
|
169 |
+
$out->lines = array();
|
170 |
+
$out->children = array();
|
171 |
+
$out->parent = $this->scope;
|
172 |
+
$out->selectors = $selectors;
|
173 |
+
$out->depth = $this->env->depth;
|
174 |
+
|
175 |
+
return $out;
|
176 |
+
}
|
177 |
+
|
178 |
+
protected function matchExtendsSingle($single, &$outOrigin) {
|
179 |
+
$counts = array();
|
180 |
+
foreach ($single as $part) {
|
181 |
+
if (!is_string($part)) return false; // hmm
|
182 |
+
|
183 |
+
if (isset($this->extendsMap[$part])) {
|
184 |
+
foreach ($this->extendsMap[$part] as $idx) {
|
185 |
+
$counts[$idx] =
|
186 |
+
isset($counts[$idx]) ? $counts[$idx] + 1 : 1;
|
187 |
+
}
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
$outOrigin = array();
|
192 |
+
$found = false;
|
193 |
+
|
194 |
+
foreach ($counts as $idx => $count) {
|
195 |
+
list($target, $origin) = $this->extends[$idx];
|
196 |
+
|
197 |
+
// check count
|
198 |
+
if ($count != count($target)) continue;
|
199 |
+
|
200 |
+
// check if target is subset of single
|
201 |
+
if (array_diff(array_intersect($single, $target), $target)) continue;
|
202 |
+
|
203 |
+
$rem = array_diff($single, $target);
|
204 |
+
|
205 |
+
foreach ($origin as $j => $new) {
|
206 |
+
// prevent infinite loop when target extends itself
|
207 |
+
foreach ($new as $new_selector) {
|
208 |
+
if (!array_diff($single, $new_selector)) {
|
209 |
+
continue 2;
|
210 |
+
}
|
211 |
+
}
|
212 |
+
|
213 |
+
$origin[$j][count($origin[$j]) - 1] = $this->combineSelectorSingle(end($new), $rem);
|
214 |
+
}
|
215 |
+
|
216 |
+
$outOrigin = array_merge($outOrigin, $origin);
|
217 |
+
|
218 |
+
$found = true;
|
219 |
+
}
|
220 |
+
|
221 |
+
return $found;
|
222 |
+
}
|
223 |
+
|
224 |
+
protected function combineSelectorSingle($base, $other) {
|
225 |
+
$tag = null;
|
226 |
+
$out = array();
|
227 |
+
|
228 |
+
foreach (array($base, $other) as $single) {
|
229 |
+
foreach ($single as $part) {
|
230 |
+
if (preg_match('/^[^\[.#:]/', $part)) {
|
231 |
+
$tag = $part;
|
232 |
+
} else {
|
233 |
+
$out[] = $part;
|
234 |
+
}
|
235 |
+
}
|
236 |
+
}
|
237 |
+
|
238 |
+
if ($tag) {
|
239 |
+
array_unshift($out, $tag);
|
240 |
+
}
|
241 |
+
|
242 |
+
return $out;
|
243 |
+
}
|
244 |
+
|
245 |
+
protected function matchExtends($selector, &$out, $from = 0, $initial=true) {
|
246 |
+
foreach ($selector as $i => $part) {
|
247 |
+
if ($i < $from) continue;
|
248 |
+
|
249 |
+
if ($this->matchExtendsSingle($part, $origin)) {
|
250 |
+
$before = array_slice($selector, 0, $i);
|
251 |
+
$after = array_slice($selector, $i + 1);
|
252 |
+
|
253 |
+
foreach ($origin as $new) {
|
254 |
+
$k = 0;
|
255 |
+
|
256 |
+
// remove shared parts
|
257 |
+
if ($initial) {
|
258 |
+
foreach ($before as $k => $val) {
|
259 |
+
if (!isset($new[$k]) || $val != $new[$k]) {
|
260 |
+
break;
|
261 |
+
}
|
262 |
+
}
|
263 |
+
}
|
264 |
+
|
265 |
+
$result = array_merge(
|
266 |
+
$before,
|
267 |
+
$k > 0 ? array_slice($new, $k) : $new,
|
268 |
+
$after);
|
269 |
+
|
270 |
+
|
271 |
+
if ($result == $selector) continue;
|
272 |
+
$out[] = $result;
|
273 |
+
|
274 |
+
// recursively check for more matches
|
275 |
+
$this->matchExtends($result, $out, $i, false);
|
276 |
+
|
277 |
+
// selector sequence merging
|
278 |
+
if (!empty($before) && count($new) > 1) {
|
279 |
+
$result2 = array_merge(
|
280 |
+
array_slice($new, 0, -1),
|
281 |
+
$k > 0 ? array_slice($before, $k) : $before,
|
282 |
+
array_slice($new, -1),
|
283 |
+
$after);
|
284 |
+
|
285 |
+
$out[] = $result2;
|
286 |
+
}
|
287 |
+
}
|
288 |
+
}
|
289 |
+
}
|
290 |
+
}
|
291 |
+
|
292 |
+
protected function flattenSelectors($block, $parentKey = null) {
|
293 |
+
if ($block->selectors) {
|
294 |
+
$selectors = array();
|
295 |
+
foreach ($block->selectors as $s) {
|
296 |
+
$selectors[] = $s;
|
297 |
+
if (!is_array($s)) continue;
|
298 |
+
// check extends
|
299 |
+
if (!empty($this->extendsMap)) {
|
300 |
+
$this->matchExtends($s, $selectors);
|
301 |
+
}
|
302 |
+
}
|
303 |
+
|
304 |
+
$block->selectors = array();
|
305 |
+
$placeholderSelector = false;
|
306 |
+
foreach ($selectors as $selector) {
|
307 |
+
if ($this->hasSelectorPlaceholder($selector)) {
|
308 |
+
$placeholderSelector = true;
|
309 |
+
continue;
|
310 |
+
}
|
311 |
+
$block->selectors[] = $this->compileSelector($selector);
|
312 |
+
}
|
313 |
+
|
314 |
+
if ($placeholderSelector && 0 == count($block->selectors) && null !== $parentKey) {
|
315 |
+
unset($block->parent->children[$parentKey]);
|
316 |
+
return;
|
317 |
+
}
|
318 |
+
}
|
319 |
+
|
320 |
+
foreach ($block->children as $key => $child) {
|
321 |
+
$this->flattenSelectors($child, $key);
|
322 |
+
}
|
323 |
+
}
|
324 |
+
|
325 |
+
protected function compileRoot($rootBlock)
|
326 |
+
{
|
327 |
+
$this->scope = $this->makeOutputBlock('root');
|
328 |
+
|
329 |
+
$this->compileChildren($rootBlock->children, $this->scope);
|
330 |
+
$this->flattenSelectors($this->scope);
|
331 |
+
}
|
332 |
+
|
333 |
+
protected function compileMedia($media) {
|
334 |
+
$this->pushEnv($media);
|
335 |
+
|
336 |
+
$mediaQuery = $this->compileMediaQuery($this->multiplyMedia($this->env));
|
337 |
+
|
338 |
+
if (!empty($mediaQuery)) {
|
339 |
+
|
340 |
+
$this->scope = $this->makeOutputBlock("media", array($mediaQuery));
|
341 |
+
|
342 |
+
$parentScope = $this->mediaParent($this->scope);
|
343 |
+
|
344 |
+
$parentScope->children[] = $this->scope;
|
345 |
+
|
346 |
+
// top level properties in a media cause it to be wrapped
|
347 |
+
$needsWrap = false;
|
348 |
+
foreach ($media->children as $child) {
|
349 |
+
$type = $child[0];
|
350 |
+
if ($type !== 'block' && $type !== 'media' && $type !== 'directive') {
|
351 |
+
$needsWrap = true;
|
352 |
+
break;
|
353 |
+
}
|
354 |
+
}
|
355 |
+
|
356 |
+
if ($needsWrap) {
|
357 |
+
$wrapped = (object)array(
|
358 |
+
"selectors" => array(),
|
359 |
+
"children" => $media->children
|
360 |
+
);
|
361 |
+
$media->children = array(array("block", $wrapped));
|
362 |
+
}
|
363 |
+
|
364 |
+
$this->compileChildren($media->children, $this->scope);
|
365 |
+
|
366 |
+
$this->scope = $this->scope->parent;
|
367 |
+
}
|
368 |
+
|
369 |
+
$this->popEnv();
|
370 |
+
}
|
371 |
+
|
372 |
+
protected function mediaParent($scope) {
|
373 |
+
while (!empty($scope->parent)) {
|
374 |
+
if (!empty($scope->type) && $scope->type != "media") {
|
375 |
+
break;
|
376 |
+
}
|
377 |
+
$scope = $scope->parent;
|
378 |
+
}
|
379 |
+
|
380 |
+
return $scope;
|
381 |
+
}
|
382 |
+
|
383 |
+
// TODO refactor compileNestedBlock and compileMedia into same thing
|
384 |
+
protected function compileNestedBlock($block, $selectors) {
|
385 |
+
$this->pushEnv($block);
|
386 |
+
|
387 |
+
$this->scope = $this->makeOutputBlock($block->type, $selectors);
|
388 |
+
$this->scope->parent->children[] = $this->scope;
|
389 |
+
$this->compileChildren($block->children, $this->scope);
|
390 |
+
|
391 |
+
$this->scope = $this->scope->parent;
|
392 |
+
$this->popEnv();
|
393 |
+
}
|
394 |
+
|
395 |
+
/**
|
396 |
+
* Recursively compiles a block.
|
397 |
+
*
|
398 |
+
* A block is analogous to a CSS block in most cases. A single SCSS document
|
399 |
+
* is encapsulated in a block when parsed, but it does not have parent tags
|
400 |
+
* so all of its children appear on the root level when compiled.
|
401 |
+
*
|
402 |
+
* Blocks are made up of selectors and children.
|
403 |
+
*
|
404 |
+
* The children of a block are just all the blocks that are defined within.
|
405 |
+
*
|
406 |
+
* Compiling the block involves pushing a fresh environment on the stack,
|
407 |
+
* and iterating through the props, compiling each one.
|
408 |
+
*
|
409 |
+
* @see scss::compileChild()
|
410 |
+
*
|
411 |
+
* @param \StdClass $block
|
412 |
+
*/
|
413 |
+
protected function compileBlock($block) {
|
414 |
+
$env = $this->pushEnv($block);
|
415 |
+
|
416 |
+
$env->selectors =
|
417 |
+
array_map(array($this, "evalSelector"), $block->selectors);
|
418 |
+
|
419 |
+
$out = $this->makeOutputBlock(null, $this->multiplySelectors($env));
|
420 |
+
$this->scope->children[] = $out;
|
421 |
+
$this->compileChildren($block->children, $out);
|
422 |
+
|
423 |
+
$this->popEnv();
|
424 |
+
}
|
425 |
+
|
426 |
+
// joins together .classes and #ids
|
427 |
+
protected function flattenSelectorSingle($single) {
|
428 |
+
$joined = array();
|
429 |
+
foreach ($single as $part) {
|
430 |
+
if (empty($joined) ||
|
431 |
+
!is_string($part) ||
|
432 |
+
preg_match('/[\[.:#%]/', $part))
|
433 |
+
{
|
434 |
+
$joined[] = $part;
|
435 |
+
continue;
|
436 |
+
}
|
437 |
+
|
438 |
+
if (is_array(end($joined))) {
|
439 |
+
$joined[] = $part;
|
440 |
+
} else {
|
441 |
+
$joined[count($joined) - 1] .= $part;
|
442 |
+
}
|
443 |
+
}
|
444 |
+
|
445 |
+
return $joined;
|
446 |
+
}
|
447 |
+
|
448 |
+
// replaces all the interpolates
|
449 |
+
protected function evalSelector($selector) {
|
450 |
+
return array_map(array($this, "evalSelectorPart"), $selector);
|
451 |
+
}
|
452 |
+
|
453 |
+
protected function evalSelectorPart($piece) {
|
454 |
+
foreach ($piece as &$p) {
|
455 |
+
if (!is_array($p)) continue;
|
456 |
+
|
457 |
+
switch ($p[0]) {
|
458 |
+
case "interpolate":
|
459 |
+
$p = $this->compileValue($p);
|
460 |
+
break;
|
461 |
+
case "string":
|
462 |
+
$p = $this->compileValue($p);
|
463 |
+
break;
|
464 |
+
}
|
465 |
+
}
|
466 |
+
|
467 |
+
return $this->flattenSelectorSingle($piece);
|
468 |
+
}
|
469 |
+
|
470 |
+
// compiles to string
|
471 |
+
// self(&) should have been replaced by now
|
472 |
+
protected function compileSelector($selector) {
|
473 |
+
if (!is_array($selector)) return $selector; // media and the like
|
474 |
+
|
475 |
+
return implode(" ", array_map(
|
476 |
+
array($this, "compileSelectorPart"), $selector));
|
477 |
+
}
|
478 |
+
|
479 |
+
protected function compileSelectorPart($piece) {
|
480 |
+
foreach ($piece as &$p) {
|
481 |
+
if (!is_array($p)) continue;
|
482 |
+
|
483 |
+
switch ($p[0]) {
|
484 |
+
case "self":
|
485 |
+
$p = "&";
|
486 |
+
break;
|
487 |
+
default:
|
488 |
+
$p = $this->compileValue($p);
|
489 |
+
break;
|
490 |
+
}
|
491 |
+
}
|
492 |
+
|
493 |
+
return implode($piece);
|
494 |
+
}
|
495 |
+
|
496 |
+
protected function hasSelectorPlaceholder($selector)
|
497 |
+
{
|
498 |
+
if (!is_array($selector)) return false;
|
499 |
+
|
500 |
+
foreach ($selector as $parts) {
|
501 |
+
foreach ($parts as $part) {
|
502 |
+
if ('%' == $part[0]) {
|
503 |
+
return true;
|
504 |
+
}
|
505 |
+
}
|
506 |
+
}
|
507 |
+
|
508 |
+
return false;
|
509 |
+
}
|
510 |
+
|
511 |
+
protected function compileChildren($stms, $out) {
|
512 |
+
foreach ($stms as $stm) {
|
513 |
+
$ret = $this->compileChild($stm, $out);
|
514 |
+
if (isset($ret)) return $ret;
|
515 |
+
}
|
516 |
+
}
|
517 |
+
|
518 |
+
protected function compileMediaQuery($queryList) {
|
519 |
+
$out = "@media";
|
520 |
+
$first = true;
|
521 |
+
foreach ($queryList as $query){
|
522 |
+
$type = null;
|
523 |
+
$parts = array();
|
524 |
+
foreach ($query as $q) {
|
525 |
+
switch ($q[0]) {
|
526 |
+
case "mediaType":
|
527 |
+
if ($type) {
|
528 |
+
$type = $this->mergeMediaTypes($type, array_map(array($this, "compileValue"), array_slice($q, 1)));
|
529 |
+
if (empty($type)) { // merge failed
|
530 |
+
return null;
|
531 |
+
}
|
532 |
+
} else {
|
533 |
+
$type = array_map(array($this, "compileValue"), array_slice($q, 1));
|
534 |
+
}
|
535 |
+
break;
|
536 |
+
case "mediaExp":
|
537 |
+
if (isset($q[2])) {
|
538 |
+
$parts[] = "(". $this->compileValue($q[1]) . $this->formatter->assignSeparator . $this->compileValue($q[2]) . ")";
|
539 |
+
} else {
|
540 |
+
$parts[] = "(" . $this->compileValue($q[1]) . ")";
|
541 |
+
}
|
542 |
+
break;
|
543 |
+
}
|
544 |
+
}
|
545 |
+
if ($type) {
|
546 |
+
array_unshift($parts, implode(' ', array_filter($type)));
|
547 |
+
}
|
548 |
+
if (!empty($parts)) {
|
549 |
+
if ($first) {
|
550 |
+
$first = false;
|
551 |
+
$out .= " ";
|
552 |
+
} else {
|
553 |
+
$out .= $this->formatter->tagSeparator;
|
554 |
+
}
|
555 |
+
$out .= implode(" and ", $parts);
|
556 |
+
}
|
557 |
+
}
|
558 |
+
return $out;
|
559 |
+
}
|
560 |
+
|
561 |
+
protected function mergeMediaTypes($type1, $type2) {
|
562 |
+
if (empty($type1)) {
|
563 |
+
return $type2;
|
564 |
+
}
|
565 |
+
if (empty($type2)) {
|
566 |
+
return $type1;
|
567 |
+
}
|
568 |
+
$m1 = '';
|
569 |
+
$t1 = '';
|
570 |
+
if (count($type1) > 1) {
|
571 |
+
$m1= strtolower($type1[0]);
|
572 |
+
$t1= strtolower($type1[1]);
|
573 |
+
} else {
|
574 |
+
$t1 = strtolower($type1[0]);
|
575 |
+
}
|
576 |
+
$m2 = '';
|
577 |
+
$t2 = '';
|
578 |
+
if (count($type2) > 1) {
|
579 |
+
$m2 = strtolower($type2[0]);
|
580 |
+
$t2 = strtolower($type2[1]);
|
581 |
+
} else {
|
582 |
+
$t2 = strtolower($type2[0]);
|
583 |
+
}
|
584 |
+
if (($m1 == 'not') ^ ($m2 == 'not')) {
|
585 |
+
if ($t1 == $t2) {
|
586 |
+
return null;
|
587 |
+
}
|
588 |
+
return array(
|
589 |
+
$m1 == 'not' ? $m2 : $m1,
|
590 |
+
$m1 == 'not' ? $t2 : $t1
|
591 |
+
);
|
592 |
+
} elseif ($m1 == 'not' && $m2 == 'not') {
|
593 |
+
# CSS has no way of representing "neither screen nor print"
|
594 |
+
if ($t1 != $t2) {
|
595 |
+
return null;
|
596 |
+
}
|
597 |
+
return array('not', $t1);
|
598 |
+
} elseif ($t1 != $t2) {
|
599 |
+
return null;
|
600 |
+
} else { // t1 == t2, neither m1 nor m2 are "not"
|
601 |
+
return array(empty($m1)? $m2 : $m1, $t1);
|
602 |
+
}
|
603 |
+
}
|
604 |
+
|
605 |
+
// returns true if the value was something that could be imported
|
606 |
+
protected function compileImport($rawPath, $out) {
|
607 |
+
if ($rawPath[0] == "string") {
|
608 |
+
$path = $this->compileStringContent($rawPath);
|
609 |
+
if ($path = $this->findImport($path)) {
|
610 |
+
$this->importFile($path, $out);
|
611 |
+
return true;
|
612 |
+
}
|
613 |
+
return false;
|
614 |
+
}
|
615 |
+
if ($rawPath[0] == "list") {
|
616 |
+
// handle a list of strings
|
617 |
+
if (count($rawPath[2]) == 0) return false;
|
618 |
+
foreach ($rawPath[2] as $path) {
|
619 |
+
if ($path[0] != "string") return false;
|
620 |
+
}
|
621 |
+
|
622 |
+
foreach ($rawPath[2] as $path) {
|
623 |
+
$this->compileImport($path, $out);
|
624 |
+
}
|
625 |
+
|
626 |
+
return true;
|
627 |
+
}
|
628 |
+
|
629 |
+
return false;
|
630 |
+
}
|
631 |
+
|
632 |
+
// return a value to halt execution
|
633 |
+
protected function compileChild($child, $out) {
|
634 |
+
$this->sourcePos = isset($child[-1]) ? $child[-1] : -1;
|
635 |
+
$this->sourceParser = isset($child[-2]) ? $child[-2] : $this->parser;
|
636 |
+
|
637 |
+
switch ($child[0]) {
|
638 |
+
case "import":
|
639 |
+
list(,$rawPath) = $child;
|
640 |
+
$rawPath = $this->reduce($rawPath);
|
641 |
+
if (!$this->compileImport($rawPath, $out)) {
|
642 |
+
$out->lines[] = "@import " . $this->compileValue($rawPath) . ";";
|
643 |
+
}
|
644 |
+
break;
|
645 |
+
case "directive":
|
646 |
+
list(, $directive) = $child;
|
647 |
+
$s = "@" . $directive->name;
|
648 |
+
if (!empty($directive->value)) {
|
649 |
+
$s .= " " . $this->compileValue($directive->value);
|
650 |
+
}
|
651 |
+
$this->compileNestedBlock($directive, array($s));
|
652 |
+
break;
|
653 |
+
case "media":
|
654 |
+
$this->compileMedia($child[1]);
|
655 |
+
break;
|
656 |
+
case "block":
|
657 |
+
$this->compileBlock($child[1]);
|
658 |
+
break;
|
659 |
+
case "charset":
|
660 |
+
$out->lines[] = "@charset ".$this->compileValue($child[1]).";";
|
661 |
+
break;
|
662 |
+
case "assign":
|
663 |
+
list(,$name, $value) = $child;
|
664 |
+
if ($name[0] == "var") {
|
665 |
+
$isDefault = !empty($child[3]);
|
666 |
+
|
667 |
+
if ($isDefault) {
|
668 |
+
$existingValue = $this->get($name[1], true);
|
669 |
+
$shouldSet = $existingValue === true || $existingValue == self::$null;
|
670 |
+
}
|
671 |
+
|
672 |
+
if (!$isDefault || $shouldSet) {
|
673 |
+
$this->set($name[1], $this->reduce($value));
|
674 |
+
}
|
675 |
+
break;
|
676 |
+
}
|
677 |
+
|
678 |
+
// if the value reduces to null from something else then
|
679 |
+
// the property should be discarded
|
680 |
+
if ($value[0] != "null") {
|
681 |
+
$value = $this->reduce($value);
|
682 |
+
if ($value[0] == "null") {
|
683 |
+
break;
|
684 |
+
}
|
685 |
+
}
|
686 |
+
|
687 |
+
$compiledValue = $this->compileValue($value);
|
688 |
+
$out->lines[] = $this->formatter->property(
|
689 |
+
$this->compileValue($name),
|
690 |
+
$compiledValue);
|
691 |
+
break;
|
692 |
+
case "comment":
|
693 |
+
$out->lines[] = $child[1];
|
694 |
+
break;
|
695 |
+
case "mixin":
|
696 |
+
case "function":
|
697 |
+
list(,$block) = $child;
|
698 |
+
$this->set(self::$namespaces[$block->type] . $block->name, $block);
|
699 |
+
break;
|
700 |
+
case "extend":
|
701 |
+
list(, $selectors) = $child;
|
702 |
+
foreach ($selectors as $sel) {
|
703 |
+
// only use the first one
|
704 |
+
$sel = current($this->evalSelector($sel));
|
705 |
+
$this->pushExtends($sel, $out->selectors);
|
706 |
+
}
|
707 |
+
break;
|
708 |
+
case "if":
|
709 |
+
list(, $if) = $child;
|
710 |
+
if ($this->isTruthy($this->reduce($if->cond, true))) {
|
711 |
+
return $this->compileChildren($if->children, $out);
|
712 |
+
} else {
|
713 |
+
foreach ($if->cases as $case) {
|
714 |
+
if ($case->type == "else" ||
|
715 |
+
$case->type == "elseif" && $this->isTruthy($this->reduce($case->cond)))
|
716 |
+
{
|
717 |
+
return $this->compileChildren($case->children, $out);
|
718 |
+
}
|
719 |
+
}
|
720 |
+
}
|
721 |
+
break;
|
722 |
+
case "return":
|
723 |
+
return $this->reduce($child[1], true);
|
724 |
+
case "each":
|
725 |
+
list(,$each) = $child;
|
726 |
+
$list = $this->coerceList($this->reduce($each->list));
|
727 |
+
foreach ($list[2] as $item) {
|
728 |
+
$this->pushEnv();
|
729 |
+
$this->set($each->var, $item);
|
730 |
+
// TODO: allow return from here
|
731 |
+
$this->compileChildren($each->children, $out);
|
732 |
+
$this->popEnv();
|
733 |
+
}
|
734 |
+
break;
|
735 |
+
case "while":
|
736 |
+
list(,$while) = $child;
|
737 |
+
while ($this->isTruthy($this->reduce($while->cond, true))) {
|
738 |
+
$ret = $this->compileChildren($while->children, $out);
|
739 |
+
if ($ret) return $ret;
|
740 |
+
}
|
741 |
+
break;
|
742 |
+
case "for":
|
743 |
+
list(,$for) = $child;
|
744 |
+
$start = $this->reduce($for->start, true);
|
745 |
+
$start = $start[1];
|
746 |
+
$end = $this->reduce($for->end, true);
|
747 |
+
$end = $end[1];
|
748 |
+
$d = $start < $end ? 1 : -1;
|
749 |
+
|
750 |
+
while (true) {
|
751 |
+
if ((!$for->until && $start - $d == $end) ||
|
752 |
+
($for->until && $start == $end))
|
753 |
+
{
|
754 |
+
break;
|
755 |
+
}
|
756 |
+
|
757 |
+
$this->set($for->var, array("number", $start, ""));
|
758 |
+
$start += $d;
|
759 |
+
|
760 |
+
$ret = $this->compileChildren($for->children, $out);
|
761 |
+
if ($ret) return $ret;
|
762 |
+
}
|
763 |
+
|
764 |
+
break;
|
765 |
+
case "nestedprop":
|
766 |
+
list(,$prop) = $child;
|
767 |
+
$prefixed = array();
|
768 |
+
$prefix = $this->compileValue($prop->prefix) . "-";
|
769 |
+
foreach ($prop->children as $child) {
|
770 |
+
if ($child[0] == "assign") {
|
771 |
+
array_unshift($child[1][2], $prefix);
|
772 |
+
}
|
773 |
+
if ($child[0] == "nestedprop") {
|
774 |
+
array_unshift($child[1]->prefix[2], $prefix);
|
775 |
+
}
|
776 |
+
$prefixed[] = $child;
|
777 |
+
}
|
778 |
+
$this->compileChildren($prefixed, $out);
|
779 |
+
break;
|
780 |
+
case "include": // including a mixin
|
781 |
+
list(,$name, $argValues, $content) = $child;
|
782 |
+
$mixin = $this->get(self::$namespaces["mixin"] . $name, false);
|
783 |
+
if (!$mixin) {
|
784 |
+
$this->throwError("Undefined mixin $name");
|
785 |
+
}
|
786 |
+
|
787 |
+
$callingScope = $this->env;
|
788 |
+
|
789 |
+
// push scope, apply args
|
790 |
+
$this->pushEnv();
|
791 |
+
if ($this->env->depth > 0) {
|
792 |
+
$this->env->depth--;
|
793 |
+
}
|
794 |
+
|
795 |
+
if (isset($content)) {
|
796 |
+
$content->scope = $callingScope;
|
797 |
+
$this->setRaw(self::$namespaces["special"] . "content", $content);
|
798 |
+
}
|
799 |
+
|
800 |
+
if (isset($mixin->args)) {
|
801 |
+
$this->applyArguments($mixin->args, $argValues);
|
802 |
+
}
|
803 |
+
|
804 |
+
foreach ($mixin->children as $child) {
|
805 |
+
$this->compileChild($child, $out);
|
806 |
+
}
|
807 |
+
|
808 |
+
$this->popEnv();
|
809 |
+
|
810 |
+
break;
|
811 |
+
case "mixin_content":
|
812 |
+
$content = $this->get(self::$namespaces["special"] . "content");
|
813 |
+
if (!isset($content)) {
|
814 |
+
$this->throwError("Expected @content inside of mixin");
|
815 |
+
}
|
816 |
+
|
817 |
+
$strongTypes = array('include', 'block', 'for', 'while');
|
818 |
+
foreach ($content->children as $child) {
|
819 |
+
$this->storeEnv = (in_array($child[0], $strongTypes))
|
820 |
+
? null
|
821 |
+
: $content->scope;
|
822 |
+
|
823 |
+
$this->compileChild($child, $out);
|
824 |
+
}
|
825 |
+
|
826 |
+
unset($this->storeEnv);
|
827 |
+
break;
|
828 |
+
case "debug":
|
829 |
+
list(,$value, $pos) = $child;
|
830 |
+
$line = $this->parser->getLineNo($pos);
|
831 |
+
$value = $this->compileValue($this->reduce($value, true));
|
832 |
+
fwrite(STDERR, "Line $line DEBUG: $value\n");
|
833 |
+
break;
|
834 |
+
default:
|
835 |
+
$this->throwError("unknown child type: $child[0]");
|
836 |
+
}
|
837 |
+
}
|
838 |
+
|
839 |
+
protected function expToString($exp) {
|
840 |
+
list(, $op, $left, $right, $inParens, $whiteLeft, $whiteRight) = $exp;
|
841 |
+
$content = array($this->reduce($left));
|
842 |
+
if ($whiteLeft) $content[] = " ";
|
843 |
+
$content[] = $op;
|
844 |
+
if ($whiteRight) $content[] = " ";
|
845 |
+
$content[] = $this->reduce($right);
|
846 |
+
return array("string", "", $content);
|
847 |
+
}
|
848 |
+
|
849 |
+
protected function isTruthy($value) {
|
850 |
+
return $value != self::$false && $value != self::$null;
|
851 |
+
}
|
852 |
+
|
853 |
+
// should $value cause its operand to eval
|
854 |
+
protected function shouldEval($value) {
|
855 |
+
switch ($value[0]) {
|
856 |
+
case "exp":
|
857 |
+
if ($value[1] == "/") {
|
858 |
+
return $this->shouldEval($value[2], $value[3]);
|
859 |
+
}
|
860 |
+
case "var":
|
861 |
+
case "fncall":
|
862 |
+
return true;
|
863 |
+
}
|
864 |
+
return false;
|
865 |
+
}
|
866 |
+
|
867 |
+
protected function reduce($value, $inExp = false) {
|
868 |
+
list($type) = $value;
|
869 |
+
switch ($type) {
|
870 |
+
case "exp":
|
871 |
+
list(, $op, $left, $right, $inParens) = $value;
|
872 |
+
$opName = isset(self::$operatorNames[$op]) ? self::$operatorNames[$op] : $op;
|
873 |
+
|
874 |
+
$inExp = $inExp || $this->shouldEval($left) || $this->shouldEval($right);
|
875 |
+
|
876 |
+
$left = $this->reduce($left, true);
|
877 |
+
$right = $this->reduce($right, true);
|
878 |
+
|
879 |
+
// only do division in special cases
|
880 |
+
if ($opName == "div" && !$inParens && !$inExp) {
|
881 |
+
if ($left[0] != "color" && $right[0] != "color") {
|
882 |
+
return $this->expToString($value);
|
883 |
+
}
|
884 |
+
}
|
885 |
+
|
886 |
+
$left = $this->coerceForExpression($left);
|
887 |
+
$right = $this->coerceForExpression($right);
|
888 |
+
|
889 |
+
$ltype = $left[0];
|
890 |
+
$rtype = $right[0];
|
891 |
+
|
892 |
+
// this tries:
|
893 |
+
// 1. op_[op name]_[left type]_[right type]
|
894 |
+
// 2. op_[left type]_[right type] (passing the op as first arg
|
895 |
+
// 3. op_[op name]
|
896 |
+
$fn = "op_${opName}_${ltype}_${rtype}";
|
897 |
+
if (is_callable(array($this, $fn)) ||
|
898 |
+
(($fn = "op_${ltype}_${rtype}") &&
|
899 |
+
is_callable(array($this, $fn)) &&
|
900 |
+
$passOp = true) ||
|
901 |
+
(($fn = "op_${opName}") &&
|
902 |
+
is_callable(array($this, $fn)) &&
|
903 |
+
$genOp = true))
|
904 |
+
{
|
905 |
+
$unitChange = false;
|
906 |
+
if (!isset($genOp) &&
|
907 |
+
$left[0] == "number" && $right[0] == "number")
|
908 |
+
{
|
909 |
+
if ($opName == "mod" && $right[2] != "") {
|
910 |
+
$this->throwError("Cannot modulo by a number with units: $right[1]$right[2].");
|
911 |
+
}
|
912 |
+
|
913 |
+
$unitChange = true;
|
914 |
+
$emptyUnit = $left[2] == "" || $right[2] == "";
|
915 |
+
$targetUnit = "" != $left[2] ? $left[2] : $right[2];
|
916 |
+
|
917 |
+
if ($opName != "mul") {
|
918 |
+
$left[2] = "" != $left[2] ? $left[2] : $targetUnit;
|
919 |
+
$right[2] = "" != $right[2] ? $right[2] : $targetUnit;
|
920 |
+
}
|
921 |
+
|
922 |
+
if ($opName != "mod") {
|
923 |
+
$left = $this->normalizeNumber($left);
|
924 |
+
$right = $this->normalizeNumber($right);
|
925 |
+
}
|
926 |
+
|
927 |
+
if ($opName == "div" && !$emptyUnit && $left[2] == $right[2]) {
|
928 |
+
$targetUnit = "";
|
929 |
+
}
|
930 |
+
|
931 |
+
if ($opName == "mul") {
|
932 |
+
$left[2] = "" != $left[2] ? $left[2] : $right[2];
|
933 |
+
$right[2] = "" != $right[2] ? $right[2] : $left[2];
|
934 |
+
} elseif ($opName == "div" && $left[2] == $right[2]) {
|
935 |
+
$left[2] = "";
|
936 |
+
$right[2] = "";
|
937 |
+
}
|
938 |
+
}
|
939 |
+
|
940 |
+
$shouldEval = $inParens || $inExp;
|
941 |
+
if (isset($passOp)) {
|
942 |
+
$out = $this->$fn($op, $left, $right, $shouldEval);
|
943 |
+
} else {
|
944 |
+
$out = $this->$fn($left, $right, $shouldEval);
|
945 |
+
}
|
946 |
+
|
947 |
+
if (isset($out)) {
|
948 |
+
if ($unitChange && $out[0] == "number") {
|
949 |
+
$out = $this->coerceUnit($out, $targetUnit);
|
950 |
+
}
|
951 |
+
return $out;
|
952 |
+
}
|
953 |
+
}
|
954 |
+
|
955 |
+
return $this->expToString($value);
|
956 |
+
case "unary":
|
957 |
+
list(, $op, $exp, $inParens) = $value;
|
958 |
+
$inExp = $inExp || $this->shouldEval($exp);
|
959 |
+
|
960 |
+
$exp = $this->reduce($exp);
|
961 |
+
if ($exp[0] == "number") {
|
962 |
+
switch ($op) {
|
963 |
+
case "+":
|
964 |
+
return $exp;
|
965 |
+
case "-":
|
966 |
+
$exp[1] *= -1;
|
967 |
+
return $exp;
|
968 |
+
}
|
969 |
+
}
|
970 |
+
|
971 |
+
if ($op == "not") {
|
972 |
+
if ($inExp || $inParens) {
|
973 |
+
if ($exp == self::$false) {
|
974 |
+
return self::$true;
|
975 |
+
} else {
|
976 |
+
return self::$false;
|
977 |
+
}
|
978 |
+
} else {
|
979 |
+
$op = $op . " ";
|
980 |
+
}
|
981 |
+
}
|
982 |
+
|
983 |
+
return array("string", "", array($op, $exp));
|
984 |
+
case "var":
|
985 |
+
list(, $name) = $value;
|
986 |
+
return $this->reduce($this->get($name));
|
987 |
+
case "list":
|
988 |
+
foreach ($value[2] as &$item) {
|
989 |
+
$item = $this->reduce($item);
|
990 |
+
}
|
991 |
+
return $value;
|
992 |
+
case "string":
|
993 |
+
foreach ($value[2] as &$item) {
|
994 |
+
if (is_array($item)) {
|
995 |
+
$item = $this->reduce($item);
|
996 |
+
}
|
997 |
+
}
|
998 |
+
return $value;
|
999 |
+
case "interpolate":
|
1000 |
+
$value[1] = $this->reduce($value[1]);
|
1001 |
+
return $value;
|
1002 |
+
case "fncall":
|
1003 |
+
list(,$name, $argValues) = $value;
|
1004 |
+
|
1005 |
+
// user defined function?
|
1006 |
+
$func = $this->get(self::$namespaces["function"] . $name, false);
|
1007 |
+
if ($func) {
|
1008 |
+
$this->pushEnv();
|
1009 |
+
|
1010 |
+
// set the args
|
1011 |
+
if (isset($func->args)) {
|
1012 |
+
$this->applyArguments($func->args, $argValues);
|
1013 |
+
}
|
1014 |
+
|
1015 |
+
// throw away lines and children
|
1016 |
+
$tmp = (object)array(
|
1017 |
+
"lines" => array(),
|
1018 |
+
"children" => array()
|
1019 |
+
);
|
1020 |
+
$ret = $this->compileChildren($func->children, $tmp);
|
1021 |
+
$this->popEnv();
|
1022 |
+
|
1023 |
+
return !isset($ret) ? self::$defaultValue : $ret;
|
1024 |
+
}
|
1025 |
+
|
1026 |
+
// built in function
|
1027 |
+
if ($this->callBuiltin($name, $argValues, $returnValue)) {
|
1028 |
+
return $returnValue;
|
1029 |
+
}
|
1030 |
+
|
1031 |
+
// need to flatten the arguments into a list
|
1032 |
+
$listArgs = array();
|
1033 |
+
foreach ((array)$argValues as $arg) {
|
1034 |
+
if (empty($arg[0])) {
|
1035 |
+
$listArgs[] = $this->reduce($arg[1]);
|
1036 |
+
}
|
1037 |
+
}
|
1038 |
+
return array("function", $name, array("list", ",", $listArgs));
|
1039 |
+
default:
|
1040 |
+
return $value;
|
1041 |
+
}
|
1042 |
+
}
|
1043 |
+
|
1044 |
+
public function normalizeValue($value) {
|
1045 |
+
$value = $this->coerceForExpression($this->reduce($value));
|
1046 |
+
list($type) = $value;
|
1047 |
+
|
1048 |
+
switch ($type) {
|
1049 |
+
case "list":
|
1050 |
+
$value = $this->extractInterpolation($value);
|
1051 |
+
if ($value[0] != "list") {
|
1052 |
+
return array("keyword", $this->compileValue($value));
|
1053 |
+
}
|
1054 |
+
foreach ($value[2] as $key => $item) {
|
1055 |
+
$value[2][$key] = $this->normalizeValue($item);
|
1056 |
+
}
|
1057 |
+
return $value;
|
1058 |
+
case "number":
|
1059 |
+
return $this->normalizeNumber($value);
|
1060 |
+
default:
|
1061 |
+
return $value;
|
1062 |
+
}
|
1063 |
+
}
|
1064 |
+
|
1065 |
+
// just does physical lengths for now
|
1066 |
+
protected function normalizeNumber($number) {
|
1067 |
+
list(, $value, $unit) = $number;
|
1068 |
+
if (isset(self::$unitTable["in"][$unit])) {
|
1069 |
+
$conv = self::$unitTable["in"][$unit];
|
1070 |
+
return array("number", $value / $conv, "in");
|
1071 |
+
}
|
1072 |
+
return $number;
|
1073 |
+
}
|
1074 |
+
|
1075 |
+
// $number should be normalized
|
1076 |
+
protected function coerceUnit($number, $unit) {
|
1077 |
+
list(, $value, $baseUnit) = $number;
|
1078 |
+
if (isset(self::$unitTable[$baseUnit][$unit])) {
|
1079 |
+
$value = $value * self::$unitTable[$baseUnit][$unit];
|
1080 |
+
}
|
1081 |
+
|
1082 |
+
return array("number", $value, $unit);
|
1083 |
+
}
|
1084 |
+
|
1085 |
+
protected function op_add_number_number($left, $right) {
|
1086 |
+
return array("number", $left[1] + $right[1], $left[2]);
|
1087 |
+
}
|
1088 |
+
|
1089 |
+
protected function op_mul_number_number($left, $right) {
|
1090 |
+
return array("number", $left[1] * $right[1], $left[2]);
|
1091 |
+
}
|
1092 |
+
|
1093 |
+
protected function op_sub_number_number($left, $right) {
|
1094 |
+
return array("number", $left[1] - $right[1], $left[2]);
|
1095 |
+
}
|
1096 |
+
|
1097 |
+
protected function op_div_number_number($left, $right) {
|
1098 |
+
return array("number", $left[1] / $right[1], $left[2]);
|
1099 |
+
}
|
1100 |
+
|
1101 |
+
protected function op_mod_number_number($left, $right) {
|
1102 |
+
return array("number", $left[1] % $right[1], $left[2]);
|
1103 |
+
}
|
1104 |
+
|
1105 |
+
// adding strings
|
1106 |
+
protected function op_add($left, $right) {
|
1107 |
+
if ($strLeft = $this->coerceString($left)) {
|
1108 |
+
if ($right[0] == "string") {
|
1109 |
+
$right[1] = "";
|
1110 |
+
}
|
1111 |
+
$strLeft[2][] = $right;
|
1112 |
+
return $strLeft;
|
1113 |
+
}
|
1114 |
+
|
1115 |
+
if ($strRight = $this->coerceString($right)) {
|
1116 |
+
if ($left[0] == "string") {
|
1117 |
+
$left[1] = "";
|
1118 |
+
}
|
1119 |
+
array_unshift($strRight[2], $left);
|
1120 |
+
return $strRight;
|
1121 |
+
}
|
1122 |
+
}
|
1123 |
+
|
1124 |
+
protected function op_and($left, $right, $shouldEval) {
|
1125 |
+
if (!$shouldEval) return;
|
1126 |
+
if ($left != self::$false) return $right;
|
1127 |
+
return $left;
|
1128 |
+
}
|
1129 |
+
|
1130 |
+
protected function op_or($left, $right, $shouldEval) {
|
1131 |
+
if (!$shouldEval) return;
|
1132 |
+
if ($left != self::$false) return $left;
|
1133 |
+
return $right;
|
1134 |
+
}
|
1135 |
+
|
1136 |
+
protected function op_color_color($op, $left, $right) {
|
1137 |
+
$out = array('color');
|
1138 |
+
foreach (range(1, 3) as $i) {
|
1139 |
+
$lval = isset($left[$i]) ? $left[$i] : 0;
|
1140 |
+
$rval = isset($right[$i]) ? $right[$i] : 0;
|
1141 |
+
switch ($op) {
|
1142 |
+
case '+':
|
1143 |
+
$out[] = $lval + $rval;
|
1144 |
+
break;
|
1145 |
+
case '-':
|
1146 |
+
$out[] = $lval - $rval;
|
1147 |
+
break;
|
1148 |
+
case '*':
|
1149 |
+
$out[] = $lval * $rval;
|
1150 |
+
break;
|
1151 |
+
case '%':
|
1152 |
+
$out[] = $lval % $rval;
|
1153 |
+
break;
|
1154 |
+
case '/':
|
1155 |
+
if ($rval == 0) {
|
1156 |
+
$this->throwError("color: Can't divide by zero");
|
1157 |
+
}
|
1158 |
+
$out[] = $lval / $rval;
|
1159 |
+
break;
|
1160 |
+
case "==":
|
1161 |
+
return $this->op_eq($left, $right);
|
1162 |
+
case "!=":
|
1163 |
+
return $this->op_neq($left, $right);
|
1164 |
+
default:
|
1165 |
+
$this->throwError("color: unknown op $op");
|
1166 |
+
}
|
1167 |
+
}
|
1168 |
+
|
1169 |
+
if (isset($left[4])) $out[4] = $left[4];
|
1170 |
+
elseif (isset($right[4])) $out[4] = $right[4];
|
1171 |
+
|
1172 |
+
return $this->fixColor($out);
|
1173 |
+
}
|
1174 |
+
|
1175 |
+
protected function op_color_number($op, $left, $right) {
|
1176 |
+
$value = $right[1];
|
1177 |
+
return $this->op_color_color($op, $left,
|
1178 |
+
array("color", $value, $value, $value));
|
1179 |
+
}
|
1180 |
+
|
1181 |
+
protected function op_number_color($op, $left, $right) {
|
1182 |
+
$value = $left[1];
|
1183 |
+
return $this->op_color_color($op,
|
1184 |
+
array("color", $value, $value, $value), $right);
|
1185 |
+
}
|
1186 |
+
|
1187 |
+
protected function op_eq($left, $right) {
|
1188 |
+
if (($lStr = $this->coerceString($left)) && ($rStr = $this->coerceString($right))) {
|
1189 |
+
$lStr[1] = "";
|
1190 |
+
$rStr[1] = "";
|
1191 |
+
return $this->toBool($this->compileValue($lStr) == $this->compileValue($rStr));
|
1192 |
+
}
|
1193 |
+
|
1194 |
+
return $this->toBool($left == $right);
|
1195 |
+
}
|
1196 |
+
|
1197 |
+
protected function op_neq($left, $right) {
|
1198 |
+
return $this->toBool($left != $right);
|
1199 |
+
}
|
1200 |
+
|
1201 |
+
protected function op_gte_number_number($left, $right) {
|
1202 |
+
return $this->toBool($left[1] >= $right[1]);
|
1203 |
+
}
|
1204 |
+
|
1205 |
+
protected function op_gt_number_number($left, $right) {
|
1206 |
+
return $this->toBool($left[1] > $right[1]);
|
1207 |
+
}
|
1208 |
+
|
1209 |
+
protected function op_lte_number_number($left, $right) {
|
1210 |
+
return $this->toBool($left[1] <= $right[1]);
|
1211 |
+
}
|
1212 |
+
|
1213 |
+
protected function op_lt_number_number($left, $right) {
|
1214 |
+
return $this->toBool($left[1] < $right[1]);
|
1215 |
+
}
|
1216 |
+
|
1217 |
+
public function toBool($thing) {
|
1218 |
+
return $thing ? self::$true : self::$false;
|
1219 |
+
}
|
1220 |
+
|
1221 |
+
/**
|
1222 |
+
* Compiles a primitive value into a CSS property value.
|
1223 |
+
*
|
1224 |
+
* Values in scssphp are typed by being wrapped in arrays, their format is
|
1225 |
+
* typically:
|
1226 |
+
*
|
1227 |
+
* array(type, contents [, additional_contents]*)
|
1228 |
+
*
|
1229 |
+
* The input is expected to be reduced. This function will not work on
|
1230 |
+
* things like expressions and variables.
|
1231 |
+
*
|
1232 |
+
* @param array $value
|
1233 |
+
*/
|
1234 |
+
protected function compileValue($value) {
|
1235 |
+
$value = $this->reduce($value);
|
1236 |
+
|
1237 |
+
list($type) = $value;
|
1238 |
+
switch ($type) {
|
1239 |
+
case "keyword":
|
1240 |
+
return $value[1];
|
1241 |
+
case "color":
|
1242 |
+
// [1] - red component (either number for a %)
|
1243 |
+
// [2] - green component
|
1244 |
+
// [3] - blue component
|
1245 |
+
// [4] - optional alpha component
|
1246 |
+
list(, $r, $g, $b) = $value;
|
1247 |
+
|
1248 |
+
$r = round($r);
|
1249 |
+
$g = round($g);
|
1250 |
+
$b = round($b);
|
1251 |
+
|
1252 |
+
if (count($value) == 5 && $value[4] != 1) { // rgba
|
1253 |
+
return 'rgba('.$r.', '.$g.', '.$b.', '.$value[4].')';
|
1254 |
+
}
|
1255 |
+
|
1256 |
+
$h = sprintf("#%02x%02x%02x", $r, $g, $b);
|
1257 |
+
|
1258 |
+
// Converting hex color to short notation (e.g. #003399 to #039)
|
1259 |
+
if ($h[1] === $h[2] && $h[3] === $h[4] && $h[5] === $h[6]) {
|
1260 |
+
$h = '#' . $h[1] . $h[3] . $h[5];
|
1261 |
+
}
|
1262 |
+
|
1263 |
+
return $h;
|
1264 |
+
case "number":
|
1265 |
+
return round($value[1], $this->numberPrecision) . $value[2];
|
1266 |
+
case "string":
|
1267 |
+
return $value[1] . $this->compileStringContent($value) . $value[1];
|
1268 |
+
case "function":
|
1269 |
+
$args = !empty($value[2]) ? $this->compileValue($value[2]) : "";
|
1270 |
+
return "$value[1]($args)";
|
1271 |
+
case "list":
|
1272 |
+
$value = $this->extractInterpolation($value);
|
1273 |
+
if ($value[0] != "list") return $this->compileValue($value);
|
1274 |
+
|
1275 |
+
list(, $delim, $items) = $value;
|
1276 |
+
|
1277 |
+
$filtered = array();
|
1278 |
+
foreach ($items as $item) {
|
1279 |
+
if ($item[0] == "null") continue;
|
1280 |
+
$filtered[] = $this->compileValue($item);
|
1281 |
+
}
|
1282 |
+
|
1283 |
+
return implode("$delim ", $filtered);
|
1284 |
+
case "interpolated": # node created by extractInterpolation
|
1285 |
+
list(, $interpolate, $left, $right) = $value;
|
1286 |
+
list(,, $whiteLeft, $whiteRight) = $interpolate;
|
1287 |
+
|
1288 |
+
$left = count($left[2]) > 0 ?
|
1289 |
+
$this->compileValue($left).$whiteLeft : "";
|
1290 |
+
|
1291 |
+
$right = count($right[2]) > 0 ?
|
1292 |
+
$whiteRight.$this->compileValue($right) : "";
|
1293 |
+
|
1294 |
+
return $left.$this->compileValue($interpolate).$right;
|
1295 |
+
|
1296 |
+
case "interpolate": # raw parse node
|
1297 |
+
list(, $exp) = $value;
|
1298 |
+
|
1299 |
+
// strip quotes if it's a string
|
1300 |
+
$reduced = $this->reduce($exp);
|
1301 |
+
switch ($reduced[0]) {
|
1302 |
+
case "string":
|
1303 |
+
$reduced = array("keyword",
|
1304 |
+
$this->compileStringContent($reduced));
|
1305 |
+
break;
|
1306 |
+
case "null":
|
1307 |
+
$reduced = array("keyword", "");
|
1308 |
+
}
|
1309 |
+
|
1310 |
+
return $this->compileValue($reduced);
|
1311 |
+
case "null":
|
1312 |
+
return "null";
|
1313 |
+
default:
|
1314 |
+
$this->throwError("unknown value type: $type");
|
1315 |
+
}
|
1316 |
+
}
|
1317 |
+
|
1318 |
+
protected function compileStringContent($string) {
|
1319 |
+
$parts = array();
|
1320 |
+
foreach ($string[2] as $part) {
|
1321 |
+
if (is_array($part)) {
|
1322 |
+
$parts[] = $this->compileValue($part);
|
1323 |
+
} else {
|
1324 |
+
$parts[] = $part;
|
1325 |
+
}
|
1326 |
+
}
|
1327 |
+
|
1328 |
+
return implode($parts);
|
1329 |
+
}
|
1330 |
+
|
1331 |
+
// doesn't need to be recursive, compileValue will handle that
|
1332 |
+
protected function extractInterpolation($list) {
|
1333 |
+
$items = $list[2];
|
1334 |
+
foreach ($items as $i => $item) {
|
1335 |
+
if ($item[0] == "interpolate") {
|
1336 |
+
$before = array("list", $list[1], array_slice($items, 0, $i));
|
1337 |
+
$after = array("list", $list[1], array_slice($items, $i + 1));
|
1338 |
+
return array("interpolated", $item, $before, $after);
|
1339 |
+
}
|
1340 |
+
}
|
1341 |
+
return $list;
|
1342 |
+
}
|
1343 |
+
|
1344 |
+
// find the final set of selectors
|
1345 |
+
protected function multiplySelectors($env) {
|
1346 |
+
$envs = array();
|
1347 |
+
while (null !== $env) {
|
1348 |
+
if (!empty($env->selectors)) {
|
1349 |
+
$envs[] = $env;
|
1350 |
+
}
|
1351 |
+
$env = $env->parent;
|
1352 |
+
};
|
1353 |
+
|
1354 |
+
$selectors = array();
|
1355 |
+
$parentSelectors = array(array());
|
1356 |
+
while ($env = array_pop($envs)) {
|
1357 |
+
$selectors = array();
|
1358 |
+
foreach ($env->selectors as $selector) {
|
1359 |
+
foreach ($parentSelectors as $parent) {
|
1360 |
+
$selectors[] = $this->joinSelectors($parent, $selector);
|
1361 |
+
}
|
1362 |
+
}
|
1363 |
+
$parentSelectors = $selectors;
|
1364 |
+
}
|
1365 |
+
|
1366 |
+
return $selectors;
|
1367 |
+
}
|
1368 |
+
|
1369 |
+
// looks for & to replace, or append parent before child
|
1370 |
+
protected function joinSelectors($parent, $child) {
|
1371 |
+
$setSelf = false;
|
1372 |
+
$out = array();
|
1373 |
+
foreach ($child as $part) {
|
1374 |
+
$newPart = array();
|
1375 |
+
foreach ($part as $p) {
|
1376 |
+
if ($p == self::$selfSelector) {
|
1377 |
+
$setSelf = true;
|
1378 |
+
foreach ($parent as $i => $parentPart) {
|
1379 |
+
if ($i > 0) {
|
1380 |
+
$out[] = $newPart;
|
1381 |
+
$newPart = array();
|
1382 |
+
}
|
1383 |
+
|
1384 |
+
foreach ($parentPart as $pp) {
|
1385 |
+
$newPart[] = $pp;
|
1386 |
+
}
|
1387 |
+
}
|
1388 |
+
} else {
|
1389 |
+
$newPart[] = $p;
|
1390 |
+
}
|
1391 |
+
}
|
1392 |
+
|
1393 |
+
$out[] = $newPart;
|
1394 |
+
}
|
1395 |
+
|
1396 |
+
return $setSelf ? $out : array_merge($parent, $child);
|
1397 |
+
}
|
1398 |
+
|
1399 |
+
protected function multiplyMedia($env, $childQueries = null) {
|
1400 |
+
if (!isset($env) ||
|
1401 |
+
!empty($env->block->type) && $env->block->type != "media")
|
1402 |
+
{
|
1403 |
+
return $childQueries;
|
1404 |
+
}
|
1405 |
+
|
1406 |
+
// plain old block, skip
|
1407 |
+
if (empty($env->block->type)) {
|
1408 |
+
return $this->multiplyMedia($env->parent, $childQueries);
|
1409 |
+
}
|
1410 |
+
|
1411 |
+
$parentQueries = $env->block->queryList;
|
1412 |
+
if ($childQueries == null) {
|
1413 |
+
$childQueries = $parentQueries;
|
1414 |
+
} else {
|
1415 |
+
$originalQueries = $childQueries;
|
1416 |
+
$childQueries = array();
|
1417 |
+
|
1418 |
+
foreach ($parentQueries as $parentQuery){
|
1419 |
+
foreach ($originalQueries as $childQuery) {
|
1420 |
+
$childQueries []= array_merge($parentQuery, $childQuery);
|
1421 |
+
}
|
1422 |
+
}
|
1423 |
+
}
|
1424 |
+
|
1425 |
+
return $this->multiplyMedia($env->parent, $childQueries);
|
1426 |
+
}
|
1427 |
+
|
1428 |
+
// convert something to list
|
1429 |
+
protected function coerceList($item, $delim = ",") {
|
1430 |
+
if (isset($item) && $item[0] == "list") {
|
1431 |
+
return $item;
|
1432 |
+
}
|
1433 |
+
|
1434 |
+
return array("list", $delim, !isset($item) ? array(): array($item));
|
1435 |
+
}
|
1436 |
+
|
1437 |
+
protected function applyArguments($argDef, $argValues) {
|
1438 |
+
$hasVariable = false;
|
1439 |
+
$args = array();
|
1440 |
+
foreach ($argDef as $i => $arg) {
|
1441 |
+
list($name, $default, $isVariable) = $argDef[$i];
|
1442 |
+
$args[$name] = array($i, $name, $default, $isVariable);
|
1443 |
+
$hasVariable |= $isVariable;
|
1444 |
+
}
|
1445 |
+
|
1446 |
+
$keywordArgs = array();
|
1447 |
+
$deferredKeywordArgs = array();
|
1448 |
+
$remaining = array();
|
1449 |
+
// assign the keyword args
|
1450 |
+
foreach ((array) $argValues as $arg) {
|
1451 |
+
if (!empty($arg[0])) {
|
1452 |
+
if (!isset($args[$arg[0][1]])) {
|
1453 |
+
if ($hasVariable) {
|
1454 |
+
$deferredKeywordArgs[$arg[0][1]] = $arg[1];
|
1455 |
+
} else {
|
1456 |
+
$this->throwError("Mixin or function doesn't have an argument named $%s.", $arg[0][1]);
|
1457 |
+
}
|
1458 |
+
} elseif ($args[$arg[0][1]][0] < count($remaining)) {
|
1459 |
+
$this->throwError("The argument $%s was passed both by position and by name.", $arg[0][1]);
|
1460 |
+
} else {
|
1461 |
+
$keywordArgs[$arg[0][1]] = $arg[1];
|
1462 |
+
}
|
1463 |
+
} elseif (count($keywordArgs)) {
|
1464 |
+
$this->throwError('Positional arguments must come before keyword arguments.');
|
1465 |
+
} elseif ($arg[2] == true) {
|
1466 |
+
$val = $this->reduce($arg[1], true);
|
1467 |
+
if ($val[0] == "list") {
|
1468 |
+
foreach ($val[2] as $name => $item) {
|
1469 |
+
if (!is_numeric($name)) {
|
1470 |
+
$keywordArgs[$name] = $item;
|
1471 |
+
} else {
|
1472 |
+
$remaining[] = $item;
|
1473 |
+
}
|
1474 |
+
}
|
1475 |
+
} else {
|
1476 |
+
$remaining[] = $val;
|
1477 |
+
}
|
1478 |
+
} else {
|
1479 |
+
$remaining[] = $arg[1];
|
1480 |
+
}
|
1481 |
+
}
|
1482 |
+
|
1483 |
+
foreach ($args as $arg) {
|
1484 |
+
list($i, $name, $default, $isVariable) = $arg;
|
1485 |
+
if ($isVariable) {
|
1486 |
+
$val = array("list", ",", array());
|
1487 |
+
for ($count = count($remaining); $i < $count; $i++) {
|
1488 |
+
$val[2][] = $remaining[$i];
|
1489 |
+
}
|
1490 |
+
foreach ($deferredKeywordArgs as $itemName => $item) {
|
1491 |
+
$val[2][$itemName] = $item;
|
1492 |
+
}
|
1493 |
+
} elseif (isset($remaining[$i])) {
|
1494 |
+
$val = $remaining[$i];
|
1495 |
+
} elseif (isset($keywordArgs[$name])) {
|
1496 |
+
$val = $keywordArgs[$name];
|
1497 |
+
} elseif (!empty($default)) {
|
1498 |
+
$val = $default;
|
1499 |
+
} else {
|
1500 |
+
$this->throwError("Missing argument $name");
|
1501 |
+
}
|
1502 |
+
|
1503 |
+
$this->set($name, $this->reduce($val, true), true);
|
1504 |
+
}
|
1505 |
+
}
|
1506 |
+
|
1507 |
+
protected function pushEnv($block=null) {
|
1508 |
+
$env = new stdClass;
|
1509 |
+
$env->parent = $this->env;
|
1510 |
+
$env->store = array();
|
1511 |
+
$env->block = $block;
|
1512 |
+
$env->depth = isset($this->env->depth) ? $this->env->depth + 1 : 0;
|
1513 |
+
|
1514 |
+
$this->env = $env;
|
1515 |
+
return $env;
|
1516 |
+
}
|
1517 |
+
|
1518 |
+
protected function normalizeName($name) {
|
1519 |
+
return str_replace("-", "_", $name);
|
1520 |
+
}
|
1521 |
+
|
1522 |
+
protected function getStoreEnv() {
|
1523 |
+
return isset($this->storeEnv) ? $this->storeEnv : $this->env;
|
1524 |
+
}
|
1525 |
+
|
1526 |
+
protected function set($name, $value, $shadow=false) {
|
1527 |
+
$name = $this->normalizeName($name);
|
1528 |
+
|
1529 |
+
if ($shadow) {
|
1530 |
+
$this->setRaw($name, $value);
|
1531 |
+
} else {
|
1532 |
+
$this->setExisting($name, $value);
|
1533 |
+
}
|
1534 |
+
}
|
1535 |
+
|
1536 |
+
protected function setExisting($name, $value, $env = null) {
|
1537 |
+
if (!isset($env)) $env = $this->getStoreEnv();
|
1538 |
+
|
1539 |
+
if (isset($env->store[$name]) || !isset($env->parent)) {
|
1540 |
+
$env->store[$name] = $value;
|
1541 |
+
} else {
|
1542 |
+
$this->setExisting($name, $value, $env->parent);
|
1543 |
+
}
|
1544 |
+
}
|
1545 |
+
|
1546 |
+
protected function setRaw($name, $value) {
|
1547 |
+
$env = $this->getStoreEnv();
|
1548 |
+
$env->store[$name] = $value;
|
1549 |
+
}
|
1550 |
+
|
1551 |
+
public function get($name, $defaultValue = null, $env = null) {
|
1552 |
+
$name = $this->normalizeName($name);
|
1553 |
+
|
1554 |
+
if (!isset($env)) $env = $this->getStoreEnv();
|
1555 |
+
if (!isset($defaultValue)) $defaultValue = self::$defaultValue;
|
1556 |
+
|
1557 |
+
if (isset($env->store[$name])) {
|
1558 |
+
return $env->store[$name];
|
1559 |
+
} elseif (isset($env->parent)) {
|
1560 |
+
return $this->get($name, $defaultValue, $env->parent);
|
1561 |
+
}
|
1562 |
+
|
1563 |
+
return $defaultValue; // found nothing
|
1564 |
+
}
|
1565 |
+
|
1566 |
+
protected function injectVariables(array $args)
|
1567 |
+
{
|
1568 |
+
if (empty($args)) {
|
1569 |
+
return;
|
1570 |
+
}
|
1571 |
+
|
1572 |
+
$parser = new scss_parser(__METHOD__, false);
|
1573 |
+
|
1574 |
+
foreach ($args as $name => $strValue) {
|
1575 |
+
if ($name[0] === '$') {
|
1576 |
+
$name = substr($name, 1);
|
1577 |
+
}
|
1578 |
+
|
1579 |
+
$parser->env = null;
|
1580 |
+
$parser->count = 0;
|
1581 |
+
$parser->buffer = (string) $strValue;
|
1582 |
+
$parser->inParens = false;
|
1583 |
+
$parser->eatWhiteDefault = true;
|
1584 |
+
$parser->insertComments = true;
|
1585 |
+
|
1586 |
+
if ( ! $parser->valueList($value)) {
|
1587 |
+
throw new Exception("failed to parse passed in variable $name: $strValue");
|
1588 |
+
}
|
1589 |
+
|
1590 |
+
$this->set($name, $value);
|
1591 |
+
}
|
1592 |
+
}
|
1593 |
+
|
1594 |
+
/**
|
1595 |
+
* Set variables
|
1596 |
+
*
|
1597 |
+
* @param array $variables
|
1598 |
+
*/
|
1599 |
+
public function setVariables(array $variables)
|
1600 |
+
{
|
1601 |
+
$this->registeredVars = array_merge($this->registeredVars, $variables);
|
1602 |
+
}
|
1603 |
+
|
1604 |
+
/**
|
1605 |
+
* Unset variable
|
1606 |
+
*
|
1607 |
+
* @param string $name
|
1608 |
+
*/
|
1609 |
+
public function unsetVariable($name)
|
1610 |
+
{
|
1611 |
+
unset($this->registeredVars[$name]);
|
1612 |
+
}
|
1613 |
+
|
1614 |
+
protected function popEnv() {
|
1615 |
+
$env = $this->env;
|
1616 |
+
$this->env = $this->env->parent;
|
1617 |
+
return $env;
|
1618 |
+
}
|
1619 |
+
|
1620 |
+
public function getParsedFiles() {
|
1621 |
+
return $this->parsedFiles;
|
1622 |
+
}
|
1623 |
+
|
1624 |
+
public function addImportPath($path) {
|
1625 |
+
$this->importPaths[] = $path;
|
1626 |
+
}
|
1627 |
+
|
1628 |
+
public function setImportPaths($path) {
|
1629 |
+
$this->importPaths = (array)$path;
|
1630 |
+
}
|
1631 |
+
|
1632 |
+
public function setNumberPrecision($numberPrecision) {
|
1633 |
+
$this->numberPrecision = $numberPrecision;
|
1634 |
+
}
|
1635 |
+
|
1636 |
+
public function setFormatter($formatterName) {
|
1637 |
+
$this->formatter = $formatterName;
|
1638 |
+
}
|
1639 |
+
|
1640 |
+
public function registerFunction($name, $func) {
|
1641 |
+
$this->userFunctions[$this->normalizeName($name)] = $func;
|
1642 |
+
}
|
1643 |
+
|
1644 |
+
public function unregisterFunction($name) {
|
1645 |
+
unset($this->userFunctions[$this->normalizeName($name)]);
|
1646 |
+
}
|
1647 |
+
|
1648 |
+
protected function importFile($path, $out) {
|
1649 |
+
// see if tree is cached
|
1650 |
+
$realPath = realpath($path);
|
1651 |
+
if (isset($this->importCache[$realPath])) {
|
1652 |
+
$tree = $this->importCache[$realPath];
|
1653 |
+
} else {
|
1654 |
+
$code = file_get_contents($path);
|
1655 |
+
$parser = new scss_parser($path, false);
|
1656 |
+
$tree = $parser->parse($code);
|
1657 |
+
$this->parsedFiles[] = $path;
|
1658 |
+
|
1659 |
+
$this->importCache[$realPath] = $tree;
|
1660 |
+
}
|
1661 |
+
|
1662 |
+
$pi = pathinfo($path);
|
1663 |
+
array_unshift($this->importPaths, $pi['dirname']);
|
1664 |
+
$this->compileChildren($tree->children, $out);
|
1665 |
+
array_shift($this->importPaths);
|
1666 |
+
}
|
1667 |
+
|
1668 |
+
// results the file path for an import url if it exists
|
1669 |
+
public function findImport($url) {
|
1670 |
+
$urls = array();
|
1671 |
+
|
1672 |
+
// for "normal" scss imports (ignore vanilla css and external requests)
|
1673 |
+
if (!preg_match('/\.css|^http:\/\/$/', $url)) {
|
1674 |
+
// try both normal and the _partial filename
|
1675 |
+
$urls = array($url, preg_replace('/[^\/]+$/', '_\0', $url));
|
1676 |
+
}
|
1677 |
+
|
1678 |
+
foreach ($this->importPaths as $dir) {
|
1679 |
+
if (is_string($dir)) {
|
1680 |
+
// check urls for normal import paths
|
1681 |
+
foreach ($urls as $full) {
|
1682 |
+
$full = $dir .
|
1683 |
+
(!empty($dir) && substr($dir, -1) != '/' ? '/' : '') .
|
1684 |
+
$full;
|
1685 |
+
|
1686 |
+
if ($this->fileExists($file = $full.'.scss') ||
|
1687 |
+
$this->fileExists($file = $full))
|
1688 |
+
{
|
1689 |
+
return $file;
|
1690 |
+
}
|
1691 |
+
}
|
1692 |
+
} else {
|
1693 |
+
// check custom callback for import path
|
1694 |
+
$file = call_user_func($dir,$url,$this);
|
1695 |
+
if ($file !== null) {
|
1696 |
+
return $file;
|
1697 |
+
}
|
1698 |
+
}
|
1699 |
+
}
|
1700 |
+
|
1701 |
+
return null;
|
1702 |
+
}
|
1703 |
+
|
1704 |
+
protected function fileExists($name) {
|
1705 |
+
return is_file($name);
|
1706 |
+
}
|
1707 |
+
|
1708 |
+
protected function callBuiltin($name, $args, &$returnValue) {
|
1709 |
+
// try a lib function
|
1710 |
+
$name = $this->normalizeName($name);
|
1711 |
+
$libName = "lib_".$name;
|
1712 |
+
$f = array($this, $libName);
|
1713 |
+
if (is_callable($f)) {
|
1714 |
+
$prototype = isset(self::$$libName) ? self::$$libName : null;
|
1715 |
+
$sorted = $this->sortArgs($prototype, $args);
|
1716 |
+
foreach ($sorted as &$val) {
|
1717 |
+
$val = $this->reduce($val, true);
|
1718 |
+
}
|
1719 |
+
$returnValue = call_user_func($f, $sorted, $this);
|
1720 |
+
} elseif (isset($this->userFunctions[$name])) {
|
1721 |
+
// see if we can find a user function
|
1722 |
+
$fn = $this->userFunctions[$name];
|
1723 |
+
|
1724 |
+
foreach ($args as &$val) {
|
1725 |
+
$val = $this->reduce($val[1], true);
|
1726 |
+
}
|
1727 |
+
|
1728 |
+
$returnValue = call_user_func($fn, $args, $this);
|
1729 |
+
}
|
1730 |
+
|
1731 |
+
if (isset($returnValue)) {
|
1732 |
+
// coerce a php value into a scss one
|
1733 |
+
if (is_numeric($returnValue)) {
|
1734 |
+
$returnValue = array('number', $returnValue, "");
|
1735 |
+
} elseif (is_bool($returnValue)) {
|
1736 |
+
$returnValue = $returnValue ? self::$true : self::$false;
|
1737 |
+
} elseif (!is_array($returnValue)) {
|
1738 |
+
$returnValue = array('keyword', $returnValue);
|
1739 |
+
}
|
1740 |
+
|
1741 |
+
return true;
|
1742 |
+
}
|
1743 |
+
|
1744 |
+
return false;
|
1745 |
+
}
|
1746 |
+
|
1747 |
+
// sorts any keyword arguments
|
1748 |
+
// TODO: merge with apply arguments
|
1749 |
+
protected function sortArgs($prototype, $args) {
|
1750 |
+
$keyArgs = array();
|
1751 |
+
$posArgs = array();
|
1752 |
+
|
1753 |
+
foreach ($args as $arg) {
|
1754 |
+
list($key, $value) = $arg;
|
1755 |
+
$key = $key[1];
|
1756 |
+
if (empty($key)) {
|
1757 |
+
$posArgs[] = $value;
|
1758 |
+
} else {
|
1759 |
+
$keyArgs[$key] = $value;
|
1760 |
+
}
|
1761 |
+
}
|
1762 |
+
|
1763 |
+
if (!isset($prototype)) return $posArgs;
|
1764 |
+
|
1765 |
+
$finalArgs = array();
|
1766 |
+
foreach ($prototype as $i => $names) {
|
1767 |
+
if (isset($posArgs[$i])) {
|
1768 |
+
$finalArgs[] = $posArgs[$i];
|
1769 |
+
continue;
|
1770 |
+
}
|
1771 |
+
|
1772 |
+
$set = false;
|
1773 |
+
foreach ((array)$names as $name) {
|
1774 |
+
if (isset($keyArgs[$name])) {
|
1775 |
+
$finalArgs[] = $keyArgs[$name];
|
1776 |
+
$set = true;
|
1777 |
+
break;
|
1778 |
+
}
|
1779 |
+
}
|
1780 |
+
|
1781 |
+
if (!$set) {
|
1782 |
+
$finalArgs[] = null;
|
1783 |
+
}
|
1784 |
+
}
|
1785 |
+
|
1786 |
+
return $finalArgs;
|
1787 |
+
}
|
1788 |
+
|
1789 |
+
protected function coerceForExpression($value) {
|
1790 |
+
if ($color = $this->coerceColor($value)) {
|
1791 |
+
return $color;
|
1792 |
+
}
|
1793 |
+
|
1794 |
+
return $value;
|
1795 |
+
}
|
1796 |
+
|
1797 |
+
protected function coerceColor($value) {
|
1798 |
+
switch ($value[0]) {
|
1799 |
+
case "color": return $value;
|
1800 |
+
case "keyword":
|
1801 |
+
$name = $value[1];
|
1802 |
+
if (isset(self::$cssColors[$name])) {
|
1803 |
+
$rgba = explode(',', self::$cssColors[$name]);
|
1804 |
+
return isset($rgba[3])
|
1805 |
+
? array('color', (int) $rgba[0], (int) $rgba[1], (int) $rgba[2], (int) $rgba[3])
|
1806 |
+
: array('color', (int) $rgba[0], (int) $rgba[1], (int) $rgba[2]);
|
1807 |
+
}
|
1808 |
+
return null;
|
1809 |
+
}
|
1810 |
+
|
1811 |
+
return null;
|
1812 |
+
}
|
1813 |
+
|
1814 |
+
protected function coerceString($value) {
|
1815 |
+
switch ($value[0]) {
|
1816 |
+
case "string":
|
1817 |
+
return $value;
|
1818 |
+
case "keyword":
|
1819 |
+
return array("string", "", array($value[1]));
|
1820 |
+
}
|
1821 |
+
return null;
|
1822 |
+
}
|
1823 |
+
|
1824 |
+
public function assertList($value) {
|
1825 |
+
if ($value[0] != "list")
|
1826 |
+
$this->throwError("expecting list");
|
1827 |
+
return $value;
|
1828 |
+
}
|
1829 |
+
|
1830 |
+
public function assertColor($value) {
|
1831 |
+
if ($color = $this->coerceColor($value)) return $color;
|
1832 |
+
$this->throwError("expecting color");
|
1833 |
+
}
|
1834 |
+
|
1835 |
+
public function assertNumber($value) {
|
1836 |
+
if ($value[0] != "number")
|
1837 |
+
$this->throwError("expecting number");
|
1838 |
+
return $value[1];
|
1839 |
+
}
|
1840 |
+
|
1841 |
+
protected function coercePercent($value) {
|
1842 |
+
if ($value[0] == "number") {
|
1843 |
+
if ($value[2] == "%") {
|
1844 |
+
return $value[1] / 100;
|
1845 |
+
}
|
1846 |
+
return $value[1];
|
1847 |
+
}
|
1848 |
+
return 0;
|
1849 |
+
}
|
1850 |
+
|
1851 |
+
// make sure a color's components don't go out of bounds
|
1852 |
+
protected function fixColor($c) {
|
1853 |
+
foreach (range(1, 3) as $i) {
|
1854 |
+
if ($c[$i] < 0) $c[$i] = 0;
|
1855 |
+
if ($c[$i] > 255) $c[$i] = 255;
|
1856 |
+
}
|
1857 |
+
|
1858 |
+
return $c;
|
1859 |
+
}
|
1860 |
+
|
1861 |
+
public function toHSL($red, $green, $blue) {
|
1862 |
+
$min = min($red, $green, $blue);
|
1863 |
+
$max = max($red, $green, $blue);
|
1864 |
+
|
1865 |
+
$l = $min + $max;
|
1866 |
+
|
1867 |
+
if ($min == $max) {
|
1868 |
+
$s = $h = 0;
|
1869 |
+
} else {
|
1870 |
+
$d = $max - $min;
|
1871 |
+
|
1872 |
+
if ($l < 255)
|
1873 |
+
$s = $d / $l;
|
1874 |
+
else
|
1875 |
+
$s = $d / (510 - $l);
|
1876 |
+
|
1877 |
+
if ($red == $max)
|
1878 |
+
$h = 60 * ($green - $blue) / $d;
|
1879 |
+
elseif ($green == $max)
|
1880 |
+
$h = 60 * ($blue - $red) / $d + 120;
|
1881 |
+
elseif ($blue == $max)
|
1882 |
+
$h = 60 * ($red - $green) / $d + 240;
|
1883 |
+
}
|
1884 |
+
|
1885 |
+
return array('hsl', fmod($h, 360), $s * 100, $l / 5.1);
|
1886 |
+
}
|
1887 |
+
|
1888 |
+
public function hueToRGB($m1, $m2, $h) {
|
1889 |
+
if ($h < 0)
|
1890 |
+
$h += 1;
|
1891 |
+
elseif ($h > 1)
|
1892 |
+
$h -= 1;
|
1893 |
+
|
1894 |
+
if ($h * 6 < 1)
|
1895 |
+
return $m1 + ($m2 - $m1) * $h * 6;
|
1896 |
+
|
1897 |
+
if ($h * 2 < 1)
|
1898 |
+
return $m2;
|
1899 |
+
|
1900 |
+
if ($h * 3 < 2)
|
1901 |
+
return $m1 + ($m2 - $m1) * (2/3 - $h) * 6;
|
1902 |
+
|
1903 |
+
return $m1;
|
1904 |
+
}
|
1905 |
+
|
1906 |
+
// H from 0 to 360, S and L from 0 to 100
|
1907 |
+
public function toRGB($hue, $saturation, $lightness) {
|
1908 |
+
if ($hue < 0) {
|
1909 |
+
$hue += 360;
|
1910 |
+
}
|
1911 |
+
|
1912 |
+
$h = $hue / 360;
|
1913 |
+
$s = min(100, max(0, $saturation)) / 100;
|
1914 |
+
$l = min(100, max(0, $lightness)) / 100;
|
1915 |
+
|
1916 |
+
$m2 = $l <= 0.5 ? $l * ($s + 1) : $l + $s - $l * $s;
|
1917 |
+
$m1 = $l * 2 - $m2;
|
1918 |
+
|
1919 |
+
$r = $this->hueToRGB($m1, $m2, $h + 1/3) * 255;
|
1920 |
+
$g = $this->hueToRGB($m1, $m2, $h) * 255;
|
1921 |
+
$b = $this->hueToRGB($m1, $m2, $h - 1/3) * 255;
|
1922 |
+
|
1923 |
+
$out = array('color', $r, $g, $b);
|
1924 |
+
return $out;
|
1925 |
+
}
|
1926 |
+
|
1927 |
+
// Built in functions
|
1928 |
+
|
1929 |
+
protected static $lib_if = array("condition", "if-true", "if-false");
|
1930 |
+
protected function lib_if($args) {
|
1931 |
+
list($cond,$t, $f) = $args;
|
1932 |
+
if (!$this->isTruthy($cond)) return $f;
|
1933 |
+
return $t;
|
1934 |
+
}
|
1935 |
+
|
1936 |
+
protected static $lib_index = array("list", "value");
|
1937 |
+
protected function lib_index($args) {
|
1938 |
+
list($list, $value) = $args;
|
1939 |
+
$list = $this->assertList($list);
|
1940 |
+
|
1941 |
+
$values = array();
|
1942 |
+
foreach ($list[2] as $item) {
|
1943 |
+
$values[] = $this->normalizeValue($item);
|
1944 |
+
}
|
1945 |
+
$key = array_search($this->normalizeValue($value), $values);
|
1946 |
+
|
1947 |
+
return false === $key ? false : $key + 1;
|
1948 |
+
}
|
1949 |
+
|
1950 |
+
protected static $lib_rgb = array("red", "green", "blue");
|
1951 |
+
protected function lib_rgb($args) {
|
1952 |
+
list($r,$g,$b) = $args;
|
1953 |
+
return array("color", $r[1], $g[1], $b[1]);
|
1954 |
+
}
|
1955 |
+
|
1956 |
+
protected static $lib_rgba = array(
|
1957 |
+
array("red", "color"),
|
1958 |
+
"green", "blue", "alpha");
|
1959 |
+
protected function lib_rgba($args) {
|
1960 |
+
if ($color = $this->coerceColor($args[0])) {
|
1961 |
+
$num = !isset($args[1]) ? $args[3] : $args[1];
|
1962 |
+
$alpha = $this->assertNumber($num);
|
1963 |
+
$color[4] = $alpha;
|
1964 |
+
return $color;
|
1965 |
+
}
|
1966 |
+
|
1967 |
+
list($r,$g,$b, $a) = $args;
|
1968 |
+
return array("color", $r[1], $g[1], $b[1], $a[1]);
|
1969 |
+
}
|
1970 |
+
|
1971 |
+
// helper function for adjust_color, change_color, and scale_color
|
1972 |
+
protected function alter_color($args, $fn) {
|
1973 |
+
$color = $this->assertColor($args[0]);
|
1974 |
+
|
1975 |
+
foreach (array(1,2,3,7) as $i) {
|
1976 |
+
if (isset($args[$i])) {
|
1977 |
+
$val = $this->assertNumber($args[$i]);
|
1978 |
+
$ii = $i == 7 ? 4 : $i; // alpha
|
1979 |
+
$color[$ii] =
|
1980 |
+
$this->$fn(isset($color[$ii]) ? $color[$ii] : 0, $val, $i);
|
1981 |
+
}
|
1982 |
+
}
|
1983 |
+
|
1984 |
+
if (isset($args[4]) || isset($args[5]) || isset($args[6])) {
|
1985 |
+
$hsl = $this->toHSL($color[1], $color[2], $color[3]);
|
1986 |
+
foreach (array(4,5,6) as $i) {
|
1987 |
+
if (isset($args[$i])) {
|
1988 |
+
$val = $this->assertNumber($args[$i]);
|
1989 |
+
$hsl[$i - 3] = $this->$fn($hsl[$i - 3], $val, $i);
|
1990 |
+
}
|
1991 |
+
}
|
1992 |
+
|
1993 |
+
$rgb = $this->toRGB($hsl[1], $hsl[2], $hsl[3]);
|
1994 |
+
if (isset($color[4])) $rgb[4] = $color[4];
|
1995 |
+
$color = $rgb;
|
1996 |
+
}
|
1997 |
+
|
1998 |
+
return $color;
|
1999 |
+
}
|
2000 |
+
|
2001 |
+
protected static $lib_adjust_color = array(
|
2002 |
+
"color", "red", "green", "blue",
|
2003 |
+
"hue", "saturation", "lightness", "alpha"
|
2004 |
+
);
|
2005 |
+
protected function adjust_color_helper($base, $alter, $i) {
|
2006 |
+
return $base += $alter;
|
2007 |
+
}
|
2008 |
+
protected function lib_adjust_color($args) {
|
2009 |
+
return $this->alter_color($args, "adjust_color_helper");
|
2010 |
+
}
|
2011 |
+
|
2012 |
+
protected static $lib_change_color = array(
|
2013 |
+
"color", "red", "green", "blue",
|
2014 |
+
"hue", "saturation", "lightness", "alpha"
|
2015 |
+
);
|
2016 |
+
protected function change_color_helper($base, $alter, $i) {
|
2017 |
+
return $alter;
|
2018 |
+
}
|
2019 |
+
protected function lib_change_color($args) {
|
2020 |
+
return $this->alter_color($args, "change_color_helper");
|
2021 |
+
}
|
2022 |
+
|
2023 |
+
protected static $lib_scale_color = array(
|
2024 |
+
"color", "red", "green", "blue",
|
2025 |
+
"hue", "saturation", "lightness", "alpha"
|
2026 |
+
);
|
2027 |
+
protected function scale_color_helper($base, $scale, $i) {
|
2028 |
+
// 1,2,3 - rgb
|
2029 |
+
// 4, 5, 6 - hsl
|
2030 |
+
// 7 - a
|
2031 |
+
switch ($i) {
|
2032 |
+
case 1:
|
2033 |
+
case 2:
|
2034 |
+
case 3:
|
2035 |
+
$max = 255; break;
|
2036 |
+
case 4:
|
2037 |
+
$max = 360; break;
|
2038 |
+
case 7:
|
2039 |
+
$max = 1; break;
|
2040 |
+
default:
|
2041 |
+
$max = 100;
|
2042 |
+
}
|
2043 |
+
|
2044 |
+
$scale = $scale / 100;
|
2045 |
+
if ($scale < 0) {
|
2046 |
+
return $base * $scale + $base;
|
2047 |
+
} else {
|
2048 |
+
return ($max - $base) * $scale + $base;
|
2049 |
+
}
|
2050 |
+
}
|
2051 |
+
protected function lib_scale_color($args) {
|
2052 |
+
return $this->alter_color($args, "scale_color_helper");
|
2053 |
+
}
|
2054 |
+
|
2055 |
+
protected static $lib_ie_hex_str = array("color");
|
2056 |
+
protected function lib_ie_hex_str($args) {
|
2057 |
+
$color = $this->coerceColor($args[0]);
|
2058 |
+
$color[4] = isset($color[4]) ? round(255*$color[4]) : 255;
|
2059 |
+
|
2060 |
+
return sprintf('#%02X%02X%02X%02X', $color[4], $color[1], $color[2], $color[3]);
|
2061 |
+
}
|
2062 |
+
|
2063 |
+
protected static $lib_red = array("color");
|
2064 |
+
protected function lib_red($args) {
|
2065 |
+
$color = $this->coerceColor($args[0]);
|
2066 |
+
return $color[1];
|
2067 |
+
}
|
2068 |
+
|
2069 |
+
protected static $lib_green = array("color");
|
2070 |
+
protected function lib_green($args) {
|
2071 |
+
$color = $this->coerceColor($args[0]);
|
2072 |
+
return $color[2];
|
2073 |
+
}
|
2074 |
+
|
2075 |
+
protected static $lib_blue = array("color");
|
2076 |
+
protected function lib_blue($args) {
|
2077 |
+
$color = $this->coerceColor($args[0]);
|
2078 |
+
return $color[3];
|
2079 |
+
}
|
2080 |
+
|
2081 |
+
protected static $lib_alpha = array("color");
|
2082 |
+
protected function lib_alpha($args) {
|
2083 |
+
if ($color = $this->coerceColor($args[0])) {
|
2084 |
+
return isset($color[4]) ? $color[4] : 1;
|
2085 |
+
}
|
2086 |
+
|
2087 |
+
// this might be the IE function, so return value unchanged
|
2088 |
+
return null;
|
2089 |
+
}
|
2090 |
+
|
2091 |
+
protected static $lib_opacity = array("color");
|
2092 |
+
protected function lib_opacity($args) {
|
2093 |
+
$value = $args[0];
|
2094 |
+
if ($value[0] === 'number') return null;
|
2095 |
+
return $this->lib_alpha($args);
|
2096 |
+
}
|
2097 |
+
|
2098 |
+
// mix two colors
|
2099 |
+
protected static $lib_mix = array("color-1", "color-2", "weight");
|
2100 |
+
protected function lib_mix($args) {
|
2101 |
+
list($first, $second, $weight) = $args;
|
2102 |
+
$first = $this->assertColor($first);
|
2103 |
+
$second = $this->assertColor($second);
|
2104 |
+
|
2105 |
+
if (!isset($weight)) {
|
2106 |
+
$weight = 0.5;
|
2107 |
+
} else {
|
2108 |
+
$weight = $this->coercePercent($weight);
|
2109 |
+
}
|
2110 |
+
|
2111 |
+
$firstAlpha = isset($first[4]) ? $first[4] : 1;
|
2112 |
+
$secondAlpha = isset($second[4]) ? $second[4] : 1;
|
2113 |
+
|
2114 |
+
$w = $weight * 2 - 1;
|
2115 |
+
$a = $firstAlpha - $secondAlpha;
|
2116 |
+
|
2117 |
+
$w1 = (($w * $a == -1 ? $w : ($w + $a)/(1 + $w * $a)) + 1) / 2.0;
|
2118 |
+
$w2 = 1.0 - $w1;
|
2119 |
+
|
2120 |
+
$new = array('color',
|
2121 |
+
$w1 * $first[1] + $w2 * $second[1],
|
2122 |
+
$w1 * $first[2] + $w2 * $second[2],
|
2123 |
+
$w1 * $first[3] + $w2 * $second[3],
|
2124 |
+
);
|
2125 |
+
|
2126 |
+
if ($firstAlpha != 1.0 || $secondAlpha != 1.0) {
|
2127 |
+
$new[] = $firstAlpha * $weight + $secondAlpha * ($weight - 1);
|
2128 |
+
}
|
2129 |
+
|
2130 |
+
return $this->fixColor($new);
|
2131 |
+
}
|
2132 |
+
|
2133 |
+
protected static $lib_hsl = array("hue", "saturation", "lightness");
|
2134 |
+
protected function lib_hsl($args) {
|
2135 |
+
list($h, $s, $l) = $args;
|
2136 |
+
return $this->toRGB($h[1], $s[1], $l[1]);
|
2137 |
+
}
|
2138 |
+
|
2139 |
+
protected static $lib_hsla = array("hue", "saturation",
|
2140 |
+
"lightness", "alpha");
|
2141 |
+
protected function lib_hsla($args) {
|
2142 |
+
list($h, $s, $l, $a) = $args;
|
2143 |
+
$color = $this->toRGB($h[1], $s[1], $l[1]);
|
2144 |
+
$color[4] = $a[1];
|
2145 |
+
return $color;
|
2146 |
+
}
|
2147 |
+
|
2148 |
+
protected static $lib_hue = array("color");
|
2149 |
+
protected function lib_hue($args) {
|
2150 |
+
$color = $this->assertColor($args[0]);
|
2151 |
+
$hsl = $this->toHSL($color[1], $color[2], $color[3]);
|
2152 |
+
return array("number", $hsl[1], "deg");
|
2153 |
+
}
|
2154 |
+
|
2155 |
+
protected static $lib_saturation = array("color");
|
2156 |
+
protected function lib_saturation($args) {
|
2157 |
+
$color = $this->assertColor($args[0]);
|
2158 |
+
$hsl = $this->toHSL($color[1], $color[2], $color[3]);
|
2159 |
+
return array("number", $hsl[2], "%");
|
2160 |
+
}
|
2161 |
+
|
2162 |
+
protected static $lib_lightness = array("color");
|
2163 |
+
protected function lib_lightness($args) {
|
2164 |
+
$color = $this->assertColor($args[0]);
|
2165 |
+
$hsl = $this->toHSL($color[1], $color[2], $color[3]);
|
2166 |
+
return array("number", $hsl[3], "%");
|
2167 |
+
}
|
2168 |
+
|
2169 |
+
protected function adjustHsl($color, $idx, $amount) {
|
2170 |
+
$hsl = $this->toHSL($color[1], $color[2], $color[3]);
|
2171 |
+
$hsl[$idx] += $amount;
|
2172 |
+
$out = $this->toRGB($hsl[1], $hsl[2], $hsl[3]);
|
2173 |
+
if (isset($color[4])) $out[4] = $color[4];
|
2174 |
+
return $out;
|
2175 |
+
}
|
2176 |
+
|
2177 |
+
protected static $lib_adjust_hue = array("color", "degrees");
|
2178 |
+
protected function lib_adjust_hue($args) {
|
2179 |
+
$color = $this->assertColor($args[0]);
|
2180 |
+
$degrees = $this->assertNumber($args[1]);
|
2181 |
+
return $this->adjustHsl($color, 1, $degrees);
|
2182 |
+
}
|
2183 |
+
|
2184 |
+
protected static $lib_lighten = array("color", "amount");
|
2185 |
+
protected function lib_lighten($args) {
|
2186 |
+
$color = $this->assertColor($args[0]);
|
2187 |
+
$amount = 100*$this->coercePercent($args[1]);
|
2188 |
+
return $this->adjustHsl($color, 3, $amount);
|
2189 |
+
}
|
2190 |
+
|
2191 |
+
protected static $lib_darken = array("color", "amount");
|
2192 |
+
protected function lib_darken($args) {
|
2193 |
+
$color = $this->assertColor($args[0]);
|
2194 |
+
$amount = 100*$this->coercePercent($args[1]);
|
2195 |
+
return $this->adjustHsl($color, 3, -$amount);
|
2196 |
+
}
|
2197 |
+
|
2198 |
+
protected static $lib_saturate = array("color", "amount");
|
2199 |
+
protected function lib_saturate($args) {
|
2200 |
+
$value = $args[0];
|
2201 |
+
if ($value[0] === 'number') return null;
|
2202 |
+
$color = $this->assertColor($value);
|
2203 |
+
$amount = 100*$this->coercePercent($args[1]);
|
2204 |
+
return $this->adjustHsl($color, 2, $amount);
|
2205 |
+
}
|
2206 |
+
|
2207 |
+
protected static $lib_desaturate = array("color", "amount");
|
2208 |
+
protected function lib_desaturate($args) {
|
2209 |
+
$color = $this->assertColor($args[0]);
|
2210 |
+
$amount = 100*$this->coercePercent($args[1]);
|
2211 |
+
return $this->adjustHsl($color, 2, -$amount);
|
2212 |
+
}
|
2213 |
+
|
2214 |
+
protected static $lib_grayscale = array("color");
|
2215 |
+
protected function lib_grayscale($args) {
|
2216 |
+
$value = $args[0];
|
2217 |
+
if ($value[0] === 'number') return null;
|
2218 |
+
return $this->adjustHsl($this->assertColor($value), 2, -100);
|
2219 |
+
}
|
2220 |
+
|
2221 |
+
protected static $lib_complement = array("color");
|
2222 |
+
protected function lib_complement($args) {
|
2223 |
+
return $this->adjustHsl($this->assertColor($args[0]), 1, 180);
|
2224 |
+
}
|
2225 |
+
|
2226 |
+
protected static $lib_invert = array("color");
|
2227 |
+
protected function lib_invert($args) {
|
2228 |
+
$value = $args[0];
|
2229 |
+
if ($value[0] === 'number') return null;
|
2230 |
+
$color = $this->assertColor($value);
|
2231 |
+
$color[1] = 255 - $color[1];
|
2232 |
+
$color[2] = 255 - $color[2];
|
2233 |
+
$color[3] = 255 - $color[3];
|
2234 |
+
return $color;
|
2235 |
+
}
|
2236 |
+
|
2237 |
+
// increases opacity by amount
|
2238 |
+
protected static $lib_opacify = array("color", "amount");
|
2239 |
+
protected function lib_opacify($args) {
|
2240 |
+
$color = $this->assertColor($args[0]);
|
2241 |
+
$amount = $this->coercePercent($args[1]);
|
2242 |
+
|
2243 |
+
$color[4] = (isset($color[4]) ? $color[4] : 1) + $amount;
|
2244 |
+
$color[4] = min(1, max(0, $color[4]));
|
2245 |
+
return $color;
|
2246 |
+
}
|
2247 |
+
|
2248 |
+
protected static $lib_fade_in = array("color", "amount");
|
2249 |
+
protected function lib_fade_in($args) {
|
2250 |
+
return $this->lib_opacify($args);
|
2251 |
+
}
|
2252 |
+
|
2253 |
+
// decreases opacity by amount
|
2254 |
+
protected static $lib_transparentize = array("color", "amount");
|
2255 |
+
protected function lib_transparentize($args) {
|
2256 |
+
$color = $this->assertColor($args[0]);
|
2257 |
+
$amount = $this->coercePercent($args[1]);
|
2258 |
+
|
2259 |
+
$color[4] = (isset($color[4]) ? $color[4] : 1) - $amount;
|
2260 |
+
$color[4] = min(1, max(0, $color[4]));
|
2261 |
+
return $color;
|
2262 |
+
}
|
2263 |
+
|
2264 |
+
protected static $lib_fade_out = array("color", "amount");
|
2265 |
+
protected function lib_fade_out($args) {
|
2266 |
+
return $this->lib_transparentize($args);
|
2267 |
+
}
|
2268 |
+
|
2269 |
+
protected static $lib_unquote = array("string");
|
2270 |
+
protected function lib_unquote($args) {
|
2271 |
+
$str = $args[0];
|
2272 |
+
if ($str[0] == "string") $str[1] = "";
|
2273 |
+
return $str;
|
2274 |
+
}
|
2275 |
+
|
2276 |
+
protected static $lib_quote = array("string");
|
2277 |
+
protected function lib_quote($args) {
|
2278 |
+
$value = $args[0];
|
2279 |
+
if ($value[0] == "string" && !empty($value[1]))
|
2280 |
+
return $value;
|
2281 |
+
return array("string", '"', array($value));
|
2282 |
+
}
|
2283 |
+
|
2284 |
+
protected static $lib_percentage = array("value");
|
2285 |
+
protected function lib_percentage($args) {
|
2286 |
+
return array("number",
|
2287 |
+
$this->coercePercent($args[0]) * 100,
|
2288 |
+
"%");
|
2289 |
+
}
|
2290 |
+
|
2291 |
+
protected static $lib_round = array("value");
|
2292 |
+
protected function lib_round($args) {
|
2293 |
+
$num = $args[0];
|
2294 |
+
$num[1] = round($num[1]);
|
2295 |
+
return $num;
|
2296 |
+
}
|
2297 |
+
|
2298 |
+
protected static $lib_floor = array("value");
|
2299 |
+
protected function lib_floor($args) {
|
2300 |
+
$num = $args[0];
|
2301 |
+
$num[1] = floor($num[1]);
|
2302 |
+
return $num;
|
2303 |
+
}
|
2304 |
+
|
2305 |
+
protected static $lib_ceil = array("value");
|
2306 |
+
protected function lib_ceil($args) {
|
2307 |
+
$num = $args[0];
|
2308 |
+
$num[1] = ceil($num[1]);
|
2309 |
+
return $num;
|
2310 |
+
}
|
2311 |
+
|
2312 |
+
protected static $lib_abs = array("value");
|
2313 |
+
protected function lib_abs($args) {
|
2314 |
+
$num = $args[0];
|
2315 |
+
$num[1] = abs($num[1]);
|
2316 |
+
return $num;
|
2317 |
+
}
|
2318 |
+
|
2319 |
+
protected function lib_min($args) {
|
2320 |
+
$numbers = $this->getNormalizedNumbers($args);
|
2321 |
+
$min = null;
|
2322 |
+
foreach ($numbers as $key => $number) {
|
2323 |
+
if (null === $min || $number[1] <= $min[1]) {
|
2324 |
+
$min = array($key, $number[1]);
|
2325 |
+
}
|
2326 |
+
}
|
2327 |
+
|
2328 |
+
return $args[$min[0]];
|
2329 |
+
}
|
2330 |
+
|
2331 |
+
protected function lib_max($args) {
|
2332 |
+
$numbers = $this->getNormalizedNumbers($args);
|
2333 |
+
$max = null;
|
2334 |
+
foreach ($numbers as $key => $number) {
|
2335 |
+
if (null === $max || $number[1] >= $max[1]) {
|
2336 |
+
$max = array($key, $number[1]);
|
2337 |
+
}
|
2338 |
+
}
|
2339 |
+
|
2340 |
+
return $args[$max[0]];
|
2341 |
+
}
|
2342 |
+
|
2343 |
+
protected function getNormalizedNumbers($args) {
|
2344 |
+
$unit = null;
|
2345 |
+
$originalUnit = null;
|
2346 |
+
$numbers = array();
|
2347 |
+
foreach ($args as $key => $item) {
|
2348 |
+
if ('number' != $item[0]) {
|
2349 |
+
$this->throwError("%s is not a number", $item[0]);
|
2350 |
+
}
|
2351 |
+
$number = $this->normalizeNumber($item);
|
2352 |
+
|
2353 |
+
if (null === $unit) {
|
2354 |
+
$unit = $number[2];
|
2355 |
+
$originalUnit = $item[2];
|
2356 |
+
} elseif ($unit !== $number[2]) {
|
2357 |
+
$this->throwError('Incompatible units: "%s" and "%s".', $originalUnit, $item[2]);
|
2358 |
+
}
|
2359 |
+
|
2360 |
+
$numbers[$key] = $number;
|
2361 |
+
}
|
2362 |
+
|
2363 |
+
return $numbers;
|
2364 |
+
}
|
2365 |
+
|
2366 |
+
protected static $lib_length = array("list");
|
2367 |
+
protected function lib_length($args) {
|
2368 |
+
$list = $this->coerceList($args[0]);
|
2369 |
+
return count($list[2]);
|
2370 |
+
}
|
2371 |
+
|
2372 |
+
protected static $lib_nth = array("list", "n");
|
2373 |
+
protected function lib_nth($args) {
|
2374 |
+
$list = $this->coerceList($args[0]);
|
2375 |
+
$n = $this->assertNumber($args[1]) - 1;
|
2376 |
+
return isset($list[2][$n]) ? $list[2][$n] : self::$defaultValue;
|
2377 |
+
}
|
2378 |
+
|
2379 |
+
protected function listSeparatorForJoin($list1, $sep) {
|
2380 |
+
if (!isset($sep)) return $list1[1];
|
2381 |
+
switch ($this->compileValue($sep)) {
|
2382 |
+
case "comma":
|
2383 |
+
return ",";
|
2384 |
+
case "space":
|
2385 |
+
return "";
|
2386 |
+
default:
|
2387 |
+
return $list1[1];
|
2388 |
+
}
|
2389 |
+
}
|
2390 |
+
|
2391 |
+
protected static $lib_join = array("list1", "list2", "separator");
|
2392 |
+
protected function lib_join($args) {
|
2393 |
+
list($list1, $list2, $sep) = $args;
|
2394 |
+
$list1 = $this->coerceList($list1, " ");
|
2395 |
+
$list2 = $this->coerceList($list2, " ");
|
2396 |
+
$sep = $this->listSeparatorForJoin($list1, $sep);
|
2397 |
+
return array("list", $sep, array_merge($list1[2], $list2[2]));
|
2398 |
+
}
|
2399 |
+
|
2400 |
+
protected static $lib_append = array("list", "val", "separator");
|
2401 |
+
protected function lib_append($args) {
|
2402 |
+
list($list1, $value, $sep) = $args;
|
2403 |
+
$list1 = $this->coerceList($list1, " ");
|
2404 |
+
$sep = $this->listSeparatorForJoin($list1, $sep);
|
2405 |
+
return array("list", $sep, array_merge($list1[2], array($value)));
|
2406 |
+
}
|
2407 |
+
|
2408 |
+
protected function lib_zip($args) {
|
2409 |
+
foreach ($args as $arg) {
|
2410 |
+
$this->assertList($arg);
|
2411 |
+
}
|
2412 |
+
|
2413 |
+
$lists = array();
|
2414 |
+
$firstList = array_shift($args);
|
2415 |
+
foreach ($firstList[2] as $key => $item) {
|
2416 |
+
$list = array("list", "", array($item));
|
2417 |
+
foreach ($args as $arg) {
|
2418 |
+
if (isset($arg[2][$key])) {
|
2419 |
+
$list[2][] = $arg[2][$key];
|
2420 |
+
} else {
|
2421 |
+
break 2;
|
2422 |
+
}
|
2423 |
+
}
|
2424 |
+
$lists[] = $list;
|
2425 |
+
}
|
2426 |
+
|
2427 |
+
return array("list", ",", $lists);
|
2428 |
+
}
|
2429 |
+
|
2430 |
+
protected static $lib_type_of = array("value");
|
2431 |
+
protected function lib_type_of($args) {
|
2432 |
+
$value = $args[0];
|
2433 |
+
switch ($value[0]) {
|
2434 |
+
case "keyword":
|
2435 |
+
if ($value == self::$true || $value == self::$false) {
|
2436 |
+
return "bool";
|
2437 |
+
}
|
2438 |
+
|
2439 |
+
if ($this->coerceColor($value)) {
|
2440 |
+
return "color";
|
2441 |
+
}
|
2442 |
+
|
2443 |
+
return "string";
|
2444 |
+
default:
|
2445 |
+
return $value[0];
|
2446 |
+
}
|
2447 |
+
}
|
2448 |
+
|
2449 |
+
protected static $lib_unit = array("number");
|
2450 |
+
protected function lib_unit($args) {
|
2451 |
+
$num = $args[0];
|
2452 |
+
if ($num[0] == "number") {
|
2453 |
+
return array("string", '"', array($num[2]));
|
2454 |
+
}
|
2455 |
+
return "";
|
2456 |
+
}
|
2457 |
+
|
2458 |
+
protected static $lib_unitless = array("number");
|
2459 |
+
protected function lib_unitless($args) {
|
2460 |
+
$value = $args[0];
|
2461 |
+
return $value[0] == "number" && empty($value[2]);
|
2462 |
+
}
|
2463 |
+
|
2464 |
+
protected static $lib_comparable = array("number-1", "number-2");
|
2465 |
+
protected function lib_comparable($args) {
|
2466 |
+
list($number1, $number2) = $args;
|
2467 |
+
if (!isset($number1[0]) || $number1[0] != "number" || !isset($number2[0]) || $number2[0] != "number") {
|
2468 |
+
$this->throwError('Invalid argument(s) for "comparable"');
|
2469 |
+
}
|
2470 |
+
|
2471 |
+
$number1 = $this->normalizeNumber($number1);
|
2472 |
+
$number2 = $this->normalizeNumber($number2);
|
2473 |
+
|
2474 |
+
return $number1[2] == $number2[2] || $number1[2] == "" || $number2[2] == "";
|
2475 |
+
}
|
2476 |
+
|
2477 |
+
/**
|
2478 |
+
* Workaround IE7's content counter bug.
|
2479 |
+
*
|
2480 |
+
* @param array $args
|
2481 |
+
*/
|
2482 |
+
protected function lib_counter($args) {
|
2483 |
+
$list = array_map(array($this, 'compileValue'), $args);
|
2484 |
+
return array('string', '', array('counter(' . implode(',', $list) . ')'));
|
2485 |
+
}
|
2486 |
+
|
2487 |
+
public function throwError($msg = null) {
|
2488 |
+
if (func_num_args() > 1) {
|
2489 |
+
$msg = call_user_func_array("sprintf", func_get_args());
|
2490 |
+
}
|
2491 |
+
|
2492 |
+
if ($this->sourcePos >= 0 && isset($this->sourceParser)) {
|
2493 |
+
$this->sourceParser->throwParseError($msg, $this->sourcePos);
|
2494 |
+
}
|
2495 |
+
|
2496 |
+
throw new Exception($msg);
|
2497 |
+
}
|
2498 |
+
|
2499 |
+
/**
|
2500 |
+
* CSS Colors
|
2501 |
+
*
|
2502 |
+
* @see http://www.w3.org/TR/css3-color
|
2503 |
+
*/
|
2504 |
+
static protected $cssColors = array(
|
2505 |
+
'aliceblue' => '240,248,255',
|
2506 |
+
'antiquewhite' => '250,235,215',
|
2507 |
+
'aqua' => '0,255,255',
|
2508 |
+
'aquamarine' => '127,255,212',
|
2509 |
+
'azure' => '240,255,255',
|
2510 |
+
'beige' => '245,245,220',
|
2511 |
+
'bisque' => '255,228,196',
|
2512 |
+
'black' => '0,0,0',
|
2513 |
+
'blanchedalmond' => '255,235,205',
|
2514 |
+
'blue' => '0,0,255',
|
2515 |
+
'blueviolet' => '138,43,226',
|
2516 |
+
'brown' => '165,42,42',
|
2517 |
+
'burlywood' => '222,184,135',
|
2518 |
+
'cadetblue' => '95,158,160',
|
2519 |
+
'chartreuse' => '127,255,0',
|
2520 |
+
'chocolate' => '210,105,30',
|
2521 |
+
'coral' => '255,127,80',
|
2522 |
+
'cornflowerblue' => '100,149,237',
|
2523 |
+
'cornsilk' => '255,248,220',
|
2524 |
+
'crimson' => '220,20,60',
|
2525 |
+
'cyan' => '0,255,255',
|
2526 |
+
'darkblue' => '0,0,139',
|
2527 |
+
'darkcyan' => '0,139,139',
|
2528 |
+
'darkgoldenrod' => '184,134,11',
|
2529 |
+
'darkgray' => '169,169,169',
|
2530 |
+
'darkgreen' => '0,100,0',
|
2531 |
+
'darkgrey' => '169,169,169',
|
2532 |
+
'darkkhaki' => '189,183,107',
|
2533 |
+
'darkmagenta' => '139,0,139',
|
2534 |
+
'darkolivegreen' => '85,107,47',
|
2535 |
+
'darkorange' => '255,140,0',
|
2536 |
+
'darkorchid' => '153,50,204',
|
2537 |
+
'darkred' => '139,0,0',
|
2538 |
+
'darksalmon' => '233,150,122',
|
2539 |
+
'darkseagreen' => '143,188,143',
|
2540 |
+
'darkslateblue' => '72,61,139',
|
2541 |
+
'darkslategray' => '47,79,79',
|
2542 |
+
'darkslategrey' => '47,79,79',
|
2543 |
+
'darkturquoise' => '0,206,209',
|
2544 |
+
'darkviolet' => '148,0,211',
|
2545 |
+
'deeppink' => '255,20,147',
|
2546 |
+
'deepskyblue' => '0,191,255',
|
2547 |
+
'dimgray' => '105,105,105',
|
2548 |
+
'dimgrey' => '105,105,105',
|
2549 |
+
'dodgerblue' => '30,144,255',
|
2550 |
+
'firebrick' => '178,34,34',
|
2551 |
+
'floralwhite' => '255,250,240',
|
2552 |
+
'forestgreen' => '34,139,34',
|
2553 |
+
'fuchsia' => '255,0,255',
|
2554 |
+
'gainsboro' => '220,220,220',
|
2555 |
+
'ghostwhite' => '248,248,255',
|
2556 |
+
'gold' => '255,215,0',
|
2557 |
+
'goldenrod' => '218,165,32',
|
2558 |
+
'gray' => '128,128,128',
|
2559 |
+
'green' => '0,128,0',
|
2560 |
+
'greenyellow' => '173,255,47',
|
2561 |
+
'grey' => '128,128,128',
|
2562 |
+
'honeydew' => '240,255,240',
|
2563 |
+
'hotpink' => '255,105,180',
|
2564 |
+
'indianred' => '205,92,92',
|
2565 |
+
'indigo' => '75,0,130',
|
2566 |
+
'ivory' => '255,255,240',
|
2567 |
+
'khaki' => '240,230,140',
|
2568 |
+
'lavender' => '230,230,250',
|
2569 |
+
'lavenderblush' => '255,240,245',
|
2570 |
+
'lawngreen' => '124,252,0',
|
2571 |
+
'lemonchiffon' => '255,250,205',
|
2572 |
+
'lightblue' => '173,216,230',
|
2573 |
+
'lightcoral' => '240,128,128',
|
2574 |
+
'lightcyan' => '224,255,255',
|
2575 |
+
'lightgoldenrodyellow' => '250,250,210',
|
2576 |
+
'lightgray' => '211,211,211',
|
2577 |
+
'lightgreen' => '144,238,144',
|
2578 |
+
'lightgrey' => '211,211,211',
|
2579 |
+
'lightpink' => '255,182,193',
|
2580 |
+
'lightsalmon' => '255,160,122',
|
2581 |
+
'lightseagreen' => '32,178,170',
|
2582 |
+
'lightskyblue' => '135,206,250',
|
2583 |
+
'lightslategray' => '119,136,153',
|
2584 |
+
'lightslategrey' => '119,136,153',
|
2585 |
+
'lightsteelblue' => '176,196,222',
|
2586 |
+
'lightyellow' => '255,255,224',
|
2587 |
+
'lime' => '0,255,0',
|
2588 |
+
'limegreen' => '50,205,50',
|
2589 |
+
'linen' => '250,240,230',
|
2590 |
+
'magenta' => '255,0,255',
|
2591 |
+
'maroon' => '128,0,0',
|
2592 |
+
'mediumaquamarine' => '102,205,170',
|
2593 |
+
'mediumblue' => '0,0,205',
|
2594 |
+
'mediumorchid' => '186,85,211',
|
2595 |
+
'mediumpurple' => '147,112,219',
|
2596 |
+
'mediumseagreen' => '60,179,113',
|
2597 |
+
'mediumslateblue' => '123,104,238',
|
2598 |
+
'mediumspringgreen' => '0,250,154',
|
2599 |
+
'mediumturquoise' => '72,209,204',
|
2600 |
+
'mediumvioletred' => '199,21,133',
|
2601 |
+
'midnightblue' => '25,25,112',
|
2602 |
+
'mintcream' => '245,255,250',
|
2603 |
+
'mistyrose' => '255,228,225',
|
2604 |
+
'moccasin' => '255,228,181',
|
2605 |
+
'navajowhite' => '255,222,173',
|
2606 |
+
'navy' => '0,0,128',
|
2607 |
+
'oldlace' => '253,245,230',
|
2608 |
+
'olive' => '128,128,0',
|
2609 |
+
'olivedrab' => '107,142,35',
|
2610 |
+
'orange' => '255,165,0',
|
2611 |
+
'orangered' => '255,69,0',
|
2612 |
+
'orchid' => '218,112,214',
|
2613 |
+
'palegoldenrod' => '238,232,170',
|
2614 |
+
'palegreen' => '152,251,152',
|
2615 |
+
'paleturquoise' => '175,238,238',
|
2616 |
+
'palevioletred' => '219,112,147',
|
2617 |
+
'papayawhip' => '255,239,213',
|
2618 |
+
'peachpuff' => '255,218,185',
|
2619 |
+
'peru' => '205,133,63',
|
2620 |
+
'pink' => '255,192,203',
|
2621 |
+
'plum' => '221,160,221',
|
2622 |
+
'powderblue' => '176,224,230',
|
2623 |
+
'purple' => '128,0,128',
|
2624 |
+
'red' => '255,0,0',
|
2625 |
+
'rosybrown' => '188,143,143',
|
2626 |
+
'royalblue' => '65,105,225',
|
2627 |
+
'saddlebrown' => '139,69,19',
|
2628 |
+
'salmon' => '250,128,114',
|
2629 |
+
'sandybrown' => '244,164,96',
|
2630 |
+
'seagreen' => '46,139,87',
|
2631 |
+
'seashell' => '255,245,238',
|
2632 |
+
'sienna' => '160,82,45',
|
2633 |
+
'silver' => '192,192,192',
|
2634 |
+
'skyblue' => '135,206,235',
|
2635 |
+
'slateblue' => '106,90,205',
|
2636 |
+
'slategray' => '112,128,144',
|
2637 |
+
'slategrey' => '112,128,144',
|
2638 |
+
'snow' => '255,250,250',
|
2639 |
+
'springgreen' => '0,255,127',
|
2640 |
+
'steelblue' => '70,130,180',
|
2641 |
+
'tan' => '210,180,140',
|
2642 |
+
'teal' => '0,128,128',
|
2643 |
+
'thistle' => '216,191,216',
|
2644 |
+
'tomato' => '255,99,71',
|
2645 |
+
'transparent' => '0,0,0,0',
|
2646 |
+
'turquoise' => '64,224,208',
|
2647 |
+
'violet' => '238,130,238',
|
2648 |
+
'wheat' => '245,222,179',
|
2649 |
+
'white' => '255,255,255',
|
2650 |
+
'whitesmoke' => '245,245,245',
|
2651 |
+
'yellow' => '255,255,0',
|
2652 |
+
'yellowgreen' => '154,205,50'
|
2653 |
+
);
|
2654 |
+
}
|
2655 |
+
|
2656 |
+
/**
|
2657 |
+
* SCSS parser
|
2658 |
+
*
|
2659 |
+
* @author Leaf Corcoran <leafot@gmail.com>
|
2660 |
+
*/
|
2661 |
+
class scss_parser {
|
2662 |
+
static protected $precedence = array(
|
2663 |
+
"or" => 0,
|
2664 |
+
"and" => 1,
|
2665 |
+
|
2666 |
+
'==' => 2,
|
2667 |
+
'!=' => 2,
|
2668 |
+
'<=' => 2,
|
2669 |
+
'>=' => 2,
|
2670 |
+
'=' => 2,
|
2671 |
+
'<' => 3,
|
2672 |
+
'>' => 2,
|
2673 |
+
|
2674 |
+
'+' => 3,
|
2675 |
+
'-' => 3,
|
2676 |
+
'*' => 4,
|
2677 |
+
'/' => 4,
|
2678 |
+
'%' => 4,
|
2679 |
+
);
|
2680 |
+
|
2681 |
+
static protected $operators = array("+", "-", "*", "/", "%",
|
2682 |
+
"==", "!=", "<=", ">=", "<", ">", "and", "or");
|
2683 |
+
|
2684 |
+
static protected $operatorStr;
|
2685 |
+
static protected $whitePattern;
|
2686 |
+
static protected $commentMulti;
|
2687 |
+
|
2688 |
+
static protected $commentSingle = "//";
|
2689 |
+
static protected $commentMultiLeft = "/*";
|
2690 |
+
static protected $commentMultiRight = "*/";
|
2691 |
+
|
2692 |
+
/**
|
2693 |
+
* Constructor
|
2694 |
+
*
|
2695 |
+
* @param string $sourceName
|
2696 |
+
* @param boolean $rootParser
|
2697 |
+
*/
|
2698 |
+
public function __construct($sourceName = null, $rootParser = true) {
|
2699 |
+
$this->sourceName = $sourceName;
|
2700 |
+
$this->rootParser = $rootParser;
|
2701 |
+
|
2702 |
+
if (empty(self::$operatorStr)) {
|
2703 |
+
self::$operatorStr = $this->makeOperatorStr(self::$operators);
|
2704 |
+
|
2705 |
+
$commentSingle = $this->preg_quote(self::$commentSingle);
|
2706 |
+
$commentMultiLeft = $this->preg_quote(self::$commentMultiLeft);
|
2707 |
+
$commentMultiRight = $this->preg_quote(self::$commentMultiRight);
|
2708 |
+
self::$commentMulti = $commentMultiLeft.'.*?'.$commentMultiRight;
|
2709 |
+
self::$whitePattern = '/'.$commentSingle.'[^\n]*\s*|('.self::$commentMulti.')\s*|\s+/Ais';
|
2710 |
+
}
|
2711 |
+
}
|
2712 |
+
|
2713 |
+
static protected function makeOperatorStr($operators) {
|
2714 |
+
return '('.implode('|', array_map(array('scss_parser','preg_quote'),
|
2715 |
+
$operators)).')';
|
2716 |
+
}
|
2717 |
+
|
2718 |
+
/**
|
2719 |
+
* Parser buffer
|
2720 |
+
*
|
2721 |
+
* @param string $buffer;
|
2722 |
+
*
|
2723 |
+
* @return \StdClass
|
2724 |
+
*/
|
2725 |
+
public function parse($buffer)
|
2726 |
+
{
|
2727 |
+
$this->count = 0;
|
2728 |
+
$this->env = null;
|
2729 |
+
$this->inParens = false;
|
2730 |
+
$this->eatWhiteDefault = true;
|
2731 |
+
$this->insertComments = true;
|
2732 |
+
$this->buffer = $buffer;
|
2733 |
+
|
2734 |
+
$this->pushBlock(null); // root block
|
2735 |
+
$this->whitespace();
|
2736 |
+
|
2737 |
+
while (false !== $this->parseChunk())
|
2738 |
+
;
|
2739 |
+
|
2740 |
+
if ($this->count != strlen($this->buffer)) {
|
2741 |
+
$this->throwParseError();
|
2742 |
+
}
|
2743 |
+
|
2744 |
+
if (!empty($this->env->parent)) {
|
2745 |
+
$this->throwParseError("unclosed block");
|
2746 |
+
}
|
2747 |
+
|
2748 |
+
$this->env->isRoot = true;
|
2749 |
+
|
2750 |
+
return $this->env;
|
2751 |
+
}
|
2752 |
+
|
2753 |
+
/**
|
2754 |
+
* Parse a single chunk off the head of the buffer and append it to the
|
2755 |
+
* current parse environment.
|
2756 |
+
*
|
2757 |
+
* Returns false when the buffer is empty, or when there is an error.
|
2758 |
+
*
|
2759 |
+
* This function is called repeatedly until the entire document is
|
2760 |
+
* parsed.
|
2761 |
+
*
|
2762 |
+
* This parser is most similar to a recursive descent parser. Single
|
2763 |
+
* functions represent discrete grammatical rules for the language, and
|
2764 |
+
* they are able to capture the text that represents those rules.
|
2765 |
+
*
|
2766 |
+
* Consider the function scssc::keyword(). (All parse functions are
|
2767 |
+
* structured the same.)
|
2768 |
+
*
|
2769 |
+
* The function takes a single reference argument. When calling the
|
2770 |
+
* function it will attempt to match a keyword on the head of the buffer.
|
2771 |
+
* If it is successful, it will place the keyword in the referenced
|
2772 |
+
* argument, advance the position in the buffer, and return true. If it
|
2773 |
+
* fails then it won't advance the buffer and it will return false.
|
2774 |
+
*
|
2775 |
+
* All of these parse functions are powered by scssc::match(), which behaves
|
2776 |
+
* the same way, but takes a literal regular expression. Sometimes it is
|
2777 |
+
* more convenient to use match instead of creating a new function.
|
2778 |
+
*
|
2779 |
+
* Because of the format of the functions, to parse an entire string of
|
2780 |
+
* grammatical rules, you can chain them together using &&.
|
2781 |
+
*
|
2782 |
+
* But, if some of the rules in the chain succeed before one fails, then
|
2783 |
+
* the buffer position will be left at an invalid state. In order to
|
2784 |
+
* avoid this, scssc::seek() is used to remember and set buffer positions.
|
2785 |
+
*
|
2786 |
+
* Before parsing a chain, use $s = $this->seek() to remember the current
|
2787 |
+
* position into $s. Then if a chain fails, use $this->seek($s) to
|
2788 |
+
* go back where we started.
|
2789 |
+
*
|
2790 |
+
* @return boolean
|
2791 |
+
*/
|
2792 |
+
protected function parseChunk() {
|
2793 |
+
$s = $this->seek();
|
2794 |
+
|
2795 |
+
// the directives
|
2796 |
+
if (isset($this->buffer[$this->count]) && $this->buffer[$this->count] == "@") {
|
2797 |
+
if ($this->literal("@media") && $this->mediaQueryList($mediaQueryList) && $this->literal("{")) {
|
2798 |
+
$media = $this->pushSpecialBlock("media");
|
2799 |
+
$media->queryList = $mediaQueryList[2];
|
2800 |
+
return true;
|
2801 |
+
} else {
|
2802 |
+
$this->seek($s);
|
2803 |
+
}
|
2804 |
+
|
2805 |
+
if ($this->literal("@mixin") &&
|
2806 |
+
$this->keyword($mixinName) &&
|
2807 |
+
($this->argumentDef($args) || true) &&
|
2808 |
+
$this->literal("{"))
|
2809 |
+
{
|
2810 |
+
$mixin = $this->pushSpecialBlock("mixin");
|
2811 |
+
$mixin->name = $mixinName;
|
2812 |
+
$mixin->args = $args;
|
2813 |
+
return true;
|
2814 |
+
} else {
|
2815 |
+
$this->seek($s);
|
2816 |
+
}
|
2817 |
+
|
2818 |
+
if ($this->literal("@include") &&
|
2819 |
+
$this->keyword($mixinName) &&
|
2820 |
+
($this->literal("(") &&
|
2821 |
+
($this->argValues($argValues) || true) &&
|
2822 |
+
$this->literal(")") || true) &&
|
2823 |
+
($this->end() ||
|
2824 |
+
$this->literal("{") && $hasBlock = true))
|
2825 |
+
{
|
2826 |
+
$child = array("include",
|
2827 |
+
$mixinName, isset($argValues) ? $argValues : null, null);
|
2828 |
+
|
2829 |
+
if (!empty($hasBlock)) {
|
2830 |
+
$include = $this->pushSpecialBlock("include");
|
2831 |
+
$include->child = $child;
|
2832 |
+
} else {
|
2833 |
+
$this->append($child, $s);
|
2834 |
+
}
|
2835 |
+
|
2836 |
+
return true;
|
2837 |
+
} else {
|
2838 |
+
$this->seek($s);
|
2839 |
+
}
|
2840 |
+
|
2841 |
+
if ($this->literal("@import") &&
|
2842 |
+
$this->valueList($importPath) &&
|
2843 |
+
$this->end())
|
2844 |
+
{
|
2845 |
+
$this->append(array("import", $importPath), $s);
|
2846 |
+
return true;
|
2847 |
+
} else {
|
2848 |
+
$this->seek($s);
|
2849 |
+
}
|
2850 |
+
|
2851 |
+
if ($this->literal("@extend") &&
|
2852 |
+
$this->selectors($selector) &&
|
2853 |
+
$this->end())
|
2854 |
+
{
|
2855 |
+
$this->append(array("extend", $selector), $s);
|
2856 |
+
return true;
|
2857 |
+
} else {
|
2858 |
+
$this->seek($s);
|
2859 |
+
}
|
2860 |
+
|
2861 |
+
if ($this->literal("@function") &&
|
2862 |
+
$this->keyword($fnName) &&
|
2863 |
+
$this->argumentDef($args) &&
|
2864 |
+
$this->literal("{"))
|
2865 |
+
{
|
2866 |
+
$func = $this->pushSpecialBlock("function");
|
2867 |
+
$func->name = $fnName;
|
2868 |
+
$func->args = $args;
|
2869 |
+
return true;
|
2870 |
+
} else {
|
2871 |
+
$this->seek($s);
|
2872 |
+
}
|
2873 |
+
|
2874 |
+
if ($this->literal("@return") && $this->valueList($retVal) && $this->end()) {
|
2875 |
+
$this->append(array("return", $retVal), $s);
|
2876 |
+
return true;
|
2877 |
+
} else {
|
2878 |
+
$this->seek($s);
|
2879 |
+
}
|
2880 |
+
|
2881 |
+
if ($this->literal("@each") &&
|
2882 |
+
$this->variable($varName) &&
|
2883 |
+
$this->literal("in") &&
|
2884 |
+
$this->valueList($list) &&
|
2885 |
+
$this->literal("{"))
|
2886 |
+
{
|
2887 |
+
$each = $this->pushSpecialBlock("each");
|
2888 |
+
$each->var = $varName[1];
|
2889 |
+
$each->list = $list;
|
2890 |
+
return true;
|
2891 |
+
} else {
|
2892 |
+
$this->seek($s);
|
2893 |
+
}
|
2894 |
+
|
2895 |
+
if ($this->literal("@while") &&
|
2896 |
+
$this->expression($cond) &&
|
2897 |
+
$this->literal("{"))
|
2898 |
+
{
|
2899 |
+
$while = $this->pushSpecialBlock("while");
|
2900 |
+
$while->cond = $cond;
|
2901 |
+
return true;
|
2902 |
+
} else {
|
2903 |
+
$this->seek($s);
|
2904 |
+
}
|
2905 |
+
|
2906 |
+
if ($this->literal("@for") &&
|
2907 |
+
$this->variable($varName) &&
|
2908 |
+
$this->literal("from") &&
|
2909 |
+
$this->expression($start) &&
|
2910 |
+
($this->literal("through") ||
|
2911 |
+
($forUntil = true && $this->literal("to"))) &&
|
2912 |
+
$this->expression($end) &&
|
2913 |
+
$this->literal("{"))
|
2914 |
+
{
|
2915 |
+
$for = $this->pushSpecialBlock("for");
|
2916 |
+
$for->var = $varName[1];
|
2917 |
+
$for->start = $start;
|
2918 |
+
$for->end = $end;
|
2919 |
+
$for->until = isset($forUntil);
|
2920 |
+
return true;
|
2921 |
+
} else {
|
2922 |
+
$this->seek($s);
|
2923 |
+
}
|
2924 |
+
|
2925 |
+
if ($this->literal("@if") && $this->valueList($cond) && $this->literal("{")) {
|
2926 |
+
$if = $this->pushSpecialBlock("if");
|
2927 |
+
$if->cond = $cond;
|
2928 |
+
$if->cases = array();
|
2929 |
+
return true;
|
2930 |
+
} else {
|
2931 |
+
$this->seek($s);
|
2932 |
+
}
|
2933 |
+
|
2934 |
+
if (($this->literal("@debug") || $this->literal("@warn")) &&
|
2935 |
+
$this->valueList($value) &&
|
2936 |
+
$this->end()) {
|
2937 |
+
$this->append(array("debug", $value, $s), $s);
|
2938 |
+
return true;
|
2939 |
+
} else {
|
2940 |
+
$this->seek($s);
|
2941 |
+
}
|
2942 |
+
|
2943 |
+
if ($this->literal("@content") && $this->end()) {
|
2944 |
+
$this->append(array("mixin_content"), $s);
|
2945 |
+
return true;
|
2946 |
+
} else {
|
2947 |
+
$this->seek($s);
|
2948 |
+
}
|
2949 |
+
|
2950 |
+
$last = $this->last();
|
2951 |
+
if (isset($last) && $last[0] == "if") {
|
2952 |
+
list(, $if) = $last;
|
2953 |
+
if ($this->literal("@else")) {
|
2954 |
+
if ($this->literal("{")) {
|
2955 |
+
$else = $this->pushSpecialBlock("else");
|
2956 |
+
} elseif ($this->literal("if") && $this->valueList($cond) && $this->literal("{")) {
|
2957 |
+
$else = $this->pushSpecialBlock("elseif");
|
2958 |
+
$else->cond = $cond;
|
2959 |
+
}
|
2960 |
+
|
2961 |
+
if (isset($else)) {
|
2962 |
+
$else->dontAppend = true;
|
2963 |
+
$if->cases[] = $else;
|
2964 |
+
return true;
|
2965 |
+
}
|
2966 |
+
}
|
2967 |
+
|
2968 |
+
$this->seek($s);
|
2969 |
+
}
|
2970 |
+
|
2971 |
+
if ($this->literal("@charset") &&
|
2972 |
+
$this->valueList($charset) && $this->end())
|
2973 |
+
{
|
2974 |
+
$this->append(array("charset", $charset), $s);
|
2975 |
+
return true;
|
2976 |
+
} else {
|
2977 |
+
$this->seek($s);
|
2978 |
+
}
|
2979 |
+
|
2980 |
+
// doesn't match built in directive, do generic one
|
2981 |
+
if ($this->literal("@", false) && $this->keyword($dirName) &&
|
2982 |
+
($this->openString("{", $dirValue) || true) &&
|
2983 |
+
$this->literal("{"))
|
2984 |
+
{
|
2985 |
+
$directive = $this->pushSpecialBlock("directive");
|
2986 |
+
$directive->name = $dirName;
|
2987 |
+
if (isset($dirValue)) $directive->value = $dirValue;
|
2988 |
+
return true;
|
2989 |
+
}
|
2990 |
+
|
2991 |
+
$this->seek($s);
|
2992 |
+
return false;
|
2993 |
+
}
|
2994 |
+
|
2995 |
+
// property shortcut
|
2996 |
+
// captures most properties before having to parse a selector
|
2997 |
+
if ($this->keyword($name, false) &&
|
2998 |
+
$this->literal(": ") &&
|
2999 |
+
$this->valueList($value) &&
|
3000 |
+
$this->end())
|
3001 |
+
{
|
3002 |
+
$name = array("string", "", array($name));
|
3003 |
+
$this->append(array("assign", $name, $value), $s);
|
3004 |
+
return true;
|
3005 |
+
} else {
|
3006 |
+
$this->seek($s);
|
3007 |
+
}
|
3008 |
+
|
3009 |
+
// variable assigns
|
3010 |
+
if ($this->variable($name) &&
|
3011 |
+
$this->literal(":") &&
|
3012 |
+
$this->valueList($value) && $this->end())
|
3013 |
+
{
|
3014 |
+
// check for !default
|
3015 |
+
$defaultVar = $value[0] == "list" && $this->stripDefault($value);
|
3016 |
+
$this->append(array("assign", $name, $value, $defaultVar), $s);
|
3017 |
+
return true;
|
3018 |
+
} else {
|
3019 |
+
$this->seek($s);
|
3020 |
+
}
|
3021 |
+
|
3022 |
+
// misc
|
3023 |
+
if ($this->literal("-->")) {
|
3024 |
+
return true;
|
3025 |
+
}
|
3026 |
+
|
3027 |
+
// opening css block
|
3028 |
+
$oldComments = $this->insertComments;
|
3029 |
+
$this->insertComments = false;
|
3030 |
+
if ($this->selectors($selectors) && $this->literal("{")) {
|
3031 |
+
$this->pushBlock($selectors);
|
3032 |
+
$this->insertComments = $oldComments;
|
3033 |
+
return true;
|
3034 |
+
} else {
|
3035 |
+
$this->seek($s);
|
3036 |
+
}
|
3037 |
+
$this->insertComments = $oldComments;
|
3038 |
+
|
3039 |
+
// property assign, or nested assign
|
3040 |
+
if ($this->propertyName($name) && $this->literal(":")) {
|
3041 |
+
$foundSomething = false;
|
3042 |
+
if ($this->valueList($value)) {
|
3043 |
+
$this->append(array("assign", $name, $value), $s);
|
3044 |
+
$foundSomething = true;
|
3045 |
+
}
|
3046 |
+
|
3047 |
+
if ($this->literal("{")) {
|
3048 |
+
$propBlock = $this->pushSpecialBlock("nestedprop");
|
3049 |
+
$propBlock->prefix = $name;
|
3050 |
+
$foundSomething = true;
|
3051 |
+
} elseif ($foundSomething) {
|
3052 |
+
$foundSomething = $this->end();
|
3053 |
+
}
|
3054 |
+
|
3055 |
+
if ($foundSomething) {
|
3056 |
+
return true;
|
3057 |
+
}
|
3058 |
+
|
3059 |
+
$this->seek($s);
|
3060 |
+
} else {
|
3061 |
+
$this->seek($s);
|
3062 |
+
}
|
3063 |
+
|
3064 |
+
// closing a block
|
3065 |
+
if ($this->literal("}")) {
|
3066 |
+
$block = $this->popBlock();
|
3067 |
+
if (isset($block->type) && $block->type == "include") {
|
3068 |
+
$include = $block->child;
|
3069 |
+
unset($block->child);
|
3070 |
+
$include[3] = $block;
|
3071 |
+
$this->append($include, $s);
|
3072 |
+
} elseif (empty($block->dontAppend)) {
|
3073 |
+
$type = isset($block->type) ? $block->type : "block";
|
3074 |
+
$this->append(array($type, $block), $s);
|
3075 |
+
}
|
3076 |
+
return true;
|
3077 |
+
}
|
3078 |
+
|
3079 |
+
// extra stuff
|
3080 |
+
if ($this->literal(";") ||
|
3081 |
+
$this->literal("<!--"))
|
3082 |
+
{
|
3083 |
+
return true;
|
3084 |
+
}
|
3085 |
+
|
3086 |
+
return false;
|
3087 |
+
}
|
3088 |
+
|
3089 |
+
protected function stripDefault(&$value) {
|
3090 |
+
$def = end($value[2]);
|
3091 |
+
if ($def[0] == "keyword" && $def[1] == "!default") {
|
3092 |
+
array_pop($value[2]);
|
3093 |
+
$value = $this->flattenList($value);
|
3094 |
+
return true;
|
3095 |
+
}
|
3096 |
+
|
3097 |
+
if ($def[0] == "list") {
|
3098 |
+
return $this->stripDefault($value[2][count($value[2]) - 1]);
|
3099 |
+
}
|
3100 |
+
|
3101 |
+
return false;
|
3102 |
+
}
|
3103 |
+
|
3104 |
+
protected function literal($what, $eatWhitespace = null) {
|
3105 |
+
if (!isset($eatWhitespace)) $eatWhitespace = $this->eatWhiteDefault;
|
3106 |
+
|
3107 |
+
// shortcut on single letter
|
3108 |
+
if (!isset($what[1]) && isset($this->buffer[$this->count])) {
|
3109 |
+
if ($this->buffer[$this->count] == $what) {
|
3110 |
+
if (!$eatWhitespace) {
|
3111 |
+
$this->count++;
|
3112 |
+
return true;
|
3113 |
+
}
|
3114 |
+
// goes below...
|
3115 |
+
} else {
|
3116 |
+
return false;
|
3117 |
+
}
|
3118 |
+
}
|
3119 |
+
|
3120 |
+
return $this->match($this->preg_quote($what), $m, $eatWhitespace);
|
3121 |
+
}
|
3122 |
+
|
3123 |
+
// tree builders
|
3124 |
+
|
3125 |
+
protected function pushBlock($selectors) {
|
3126 |
+
$b = new stdClass;
|
3127 |
+
$b->parent = $this->env; // not sure if we need this yet
|
3128 |
+
|
3129 |
+
$b->selectors = $selectors;
|
3130 |
+
$b->children = array();
|
3131 |
+
|
3132 |
+
$this->env = $b;
|
3133 |
+
return $b;
|
3134 |
+
}
|
3135 |
+
|
3136 |
+
protected function pushSpecialBlock($type) {
|
3137 |
+
$block = $this->pushBlock(null);
|
3138 |
+
$block->type = $type;
|
3139 |
+
return $block;
|
3140 |
+
}
|
3141 |
+
|
3142 |
+
protected function popBlock() {
|
3143 |
+
if (empty($this->env->parent)) {
|
3144 |
+
$this->throwParseError("unexpected }");
|
3145 |
+
}
|
3146 |
+
|
3147 |
+
$old = $this->env;
|
3148 |
+
$this->env = $this->env->parent;
|
3149 |
+
unset($old->parent);
|
3150 |
+
return $old;
|
3151 |
+
}
|
3152 |
+
|
3153 |
+
protected function append($statement, $pos=null) {
|
3154 |
+
if ($pos !== null) {
|
3155 |
+
$statement[-1] = $pos;
|
3156 |
+
if (!$this->rootParser) $statement[-2] = $this;
|
3157 |
+
}
|
3158 |
+
$this->env->children[] = $statement;
|
3159 |
+
}
|
3160 |
+
|
3161 |
+
// last child that was appended
|
3162 |
+
protected function last() {
|
3163 |
+
$i = count($this->env->children) - 1;
|
3164 |
+
if (isset($this->env->children[$i]))
|
3165 |
+
return $this->env->children[$i];
|
3166 |
+
}
|
3167 |
+
|
3168 |
+
// high level parsers (they return parts of ast)
|
3169 |
+
|
3170 |
+
protected function mediaQueryList(&$out) {
|
3171 |
+
return $this->genericList($out, "mediaQuery", ",", false);
|
3172 |
+
}
|
3173 |
+
|
3174 |
+
protected function mediaQuery(&$out) {
|
3175 |
+
$s = $this->seek();
|
3176 |
+
|
3177 |
+
$expressions = null;
|
3178 |
+
$parts = array();
|
3179 |
+
|
3180 |
+
if (($this->literal("only") && ($only = true) || $this->literal("not") && ($not = true) || true) && $this->mixedKeyword($mediaType)) {
|
3181 |
+
$prop = array("mediaType");
|
3182 |
+
if (isset($only)) $prop[] = array("keyword", "only");
|
3183 |
+
if (isset($not)) $prop[] = array("keyword", "not");
|
3184 |
+
$media = array("list", "", array());
|
3185 |
+
foreach ((array)$mediaType as $type) {
|
3186 |
+
if (is_array($type)) {
|
3187 |
+
$media[2][] = $type;
|
3188 |
+
} else {
|
3189 |
+
$media[2][] = array("keyword", $type);
|
3190 |
+
}
|
3191 |
+
}
|
3192 |
+
$prop[] = $media;
|
3193 |
+
$parts[] = $prop;
|
3194 |
+
}
|
3195 |
+
|
3196 |
+
if (empty($parts) || $this->literal("and")) {
|
3197 |
+
$this->genericList($expressions, "mediaExpression", "and", false);
|
3198 |
+
if (is_array($expressions)) $parts = array_merge($parts, $expressions[2]);
|
3199 |
+
}
|
3200 |
+
|
3201 |
+
$out = $parts;
|
3202 |
+
return true;
|
3203 |
+
}
|
3204 |
+
|
3205 |
+
protected function mediaExpression(&$out) {
|
3206 |
+
$s = $this->seek();
|
3207 |
+
$value = null;
|
3208 |
+
if ($this->literal("(") &&
|
3209 |
+
$this->expression($feature) &&
|
3210 |
+
($this->literal(":") && $this->expression($value) || true) &&
|
3211 |
+
$this->literal(")"))
|
3212 |
+
{
|
3213 |
+
$out = array("mediaExp", $feature);
|
3214 |
+
if ($value) $out[] = $value;
|
3215 |
+
return true;
|
3216 |
+
}
|
3217 |
+
|
3218 |
+
$this->seek($s);
|
3219 |
+
return false;
|
3220 |
+
}
|
3221 |
+
|
3222 |
+
protected function argValues(&$out) {
|
3223 |
+
if ($this->genericList($list, "argValue", ",", false)) {
|
3224 |
+
$out = $list[2];
|
3225 |
+
return true;
|
3226 |
+
}
|
3227 |
+
return false;
|
3228 |
+
}
|
3229 |
+
|
3230 |
+
protected function argValue(&$out) {
|
3231 |
+
$s = $this->seek();
|
3232 |
+
|
3233 |
+
$keyword = null;
|
3234 |
+
if (!$this->variable($keyword) || !$this->literal(":")) {
|
3235 |
+
$this->seek($s);
|
3236 |
+
$keyword = null;
|
3237 |
+
}
|
3238 |
+
|
3239 |
+
if ($this->genericList($value, "expression")) {
|
3240 |
+
$out = array($keyword, $value, false);
|
3241 |
+
$s = $this->seek();
|
3242 |
+
if ($this->literal("...")) {
|
3243 |
+
$out[2] = true;
|
3244 |
+
} else {
|
3245 |
+
$this->seek($s);
|
3246 |
+
}
|
3247 |
+
return true;
|
3248 |
+
}
|
3249 |
+
|
3250 |
+
return false;
|
3251 |
+
}
|
3252 |
+
|
3253 |
+
/**
|
3254 |
+
* Parse list
|
3255 |
+
*
|
3256 |
+
* @param string $out
|
3257 |
+
*
|
3258 |
+
* @return boolean
|
3259 |
+
*/
|
3260 |
+
public function valueList(&$out)
|
3261 |
+
{
|
3262 |
+
return $this->genericList($out, 'spaceList', ',');
|
3263 |
+
}
|
3264 |
+
|
3265 |
+
protected function spaceList(&$out)
|
3266 |
+
{
|
3267 |
+
return $this->genericList($out, 'expression');
|
3268 |
+
}
|
3269 |
+
|
3270 |
+
protected function genericList(&$out, $parseItem, $delim="", $flatten=true) {
|
3271 |
+
$s = $this->seek();
|
3272 |
+
$items = array();
|
3273 |
+
while ($this->$parseItem($value)) {
|
3274 |
+
$items[] = $value;
|
3275 |
+
if ($delim) {
|
3276 |
+
if (!$this->literal($delim)) break;
|
3277 |
+
}
|
3278 |
+
}
|
3279 |
+
|
3280 |
+
if (count($items) == 0) {
|
3281 |
+
$this->seek($s);
|
3282 |
+
return false;
|
3283 |
+
}
|
3284 |
+
|
3285 |
+
if ($flatten && count($items) == 1) {
|
3286 |
+
$out = $items[0];
|
3287 |
+
} else {
|
3288 |
+
$out = array("list", $delim, $items);
|
3289 |
+
}
|
3290 |
+
|
3291 |
+
return true;
|
3292 |
+
}
|
3293 |
+
|
3294 |
+
protected function expression(&$out) {
|
3295 |
+
$s = $this->seek();
|
3296 |
+
|
3297 |
+
if ($this->literal("(")) {
|
3298 |
+
if ($this->literal(")")) {
|
3299 |
+
$out = array("list", "", array());
|
3300 |
+
return true;
|
3301 |
+
}
|
3302 |
+
|
3303 |
+
if ($this->valueList($out) && $this->literal(')') && $out[0] == "list") {
|
3304 |
+
return true;
|
3305 |
+
}
|
3306 |
+
|
3307 |
+
$this->seek($s);
|
3308 |
+
}
|
3309 |
+
|
3310 |
+
if ($this->value($lhs)) {
|
3311 |
+
$out = $this->expHelper($lhs, 0);
|
3312 |
+
return true;
|
3313 |
+
}
|
3314 |
+
|
3315 |
+
return false;
|
3316 |
+
}
|
3317 |
+
|
3318 |
+
protected function expHelper($lhs, $minP) {
|
3319 |
+
$opstr = self::$operatorStr;
|
3320 |
+
|
3321 |
+
$ss = $this->seek();
|
3322 |
+
$whiteBefore = isset($this->buffer[$this->count - 1]) &&
|
3323 |
+
ctype_space($this->buffer[$this->count - 1]);
|
3324 |
+
while ($this->match($opstr, $m) && self::$precedence[$m[1]] >= $minP) {
|
3325 |
+
$whiteAfter = isset($this->buffer[$this->count - 1]) &&
|
3326 |
+
ctype_space($this->buffer[$this->count - 1]);
|
3327 |
+
|
3328 |
+
$op = $m[1];
|
3329 |
+
|
3330 |
+
// don't turn negative numbers into expressions
|
3331 |
+
if ($op == "-" && $whiteBefore) {
|
3332 |
+
if (!$whiteAfter) break;
|
3333 |
+
}
|
3334 |
+
|
3335 |
+
if (!$this->value($rhs)) break;
|
3336 |
+
|
3337 |
+
// peek and see if rhs belongs to next operator
|
3338 |
+
if ($this->peek($opstr, $next) && self::$precedence[$next[1]] > self::$precedence[$op]) {
|
3339 |
+
$rhs = $this->expHelper($rhs, self::$precedence[$next[1]]);
|
3340 |
+
}
|
3341 |
+
|
3342 |
+
$lhs = array("exp", $op, $lhs, $rhs, $this->inParens, $whiteBefore, $whiteAfter);
|
3343 |
+
$ss = $this->seek();
|
3344 |
+
$whiteBefore = isset($this->buffer[$this->count - 1]) &&
|
3345 |
+
ctype_space($this->buffer[$this->count - 1]);
|
3346 |
+
}
|
3347 |
+
|
3348 |
+
$this->seek($ss);
|
3349 |
+
return $lhs;
|
3350 |
+
}
|
3351 |
+
|
3352 |
+
protected function value(&$out) {
|
3353 |
+
$s = $this->seek();
|
3354 |
+
|
3355 |
+
if ($this->literal("not", false) && $this->whitespace() && $this->value($inner)) {
|
3356 |
+
$out = array("unary", "not", $inner, $this->inParens);
|
3357 |
+
return true;
|
3358 |
+
} else {
|
3359 |
+
$this->seek($s);
|
3360 |
+
}
|
3361 |
+
|
3362 |
+
if ($this->literal("+") && $this->value($inner)) {
|
3363 |
+
$out = array("unary", "+", $inner, $this->inParens);
|
3364 |
+
return true;
|
3365 |
+
} else {
|
3366 |
+
$this->seek($s);
|
3367 |
+
}
|
3368 |
+
|
3369 |
+
// negation
|
3370 |
+
if ($this->literal("-", false) &&
|
3371 |
+
($this->variable($inner) ||
|
3372 |
+
$this->unit($inner) ||
|
3373 |
+
$this->parenValue($inner)))
|
3374 |
+
{
|
3375 |
+
$out = array("unary", "-", $inner, $this->inParens);
|
3376 |
+
return true;
|
3377 |
+
} else {
|
3378 |
+
$this->seek($s);
|
3379 |
+
}
|
3380 |
+
|
3381 |
+
if ($this->parenValue($out)) return true;
|
3382 |
+
if ($this->interpolation($out)) return true;
|
3383 |
+
if ($this->variable($out)) return true;
|
3384 |
+
if ($this->color($out)) return true;
|
3385 |
+
if ($this->unit($out)) return true;
|
3386 |
+
if ($this->string($out)) return true;
|
3387 |
+
if ($this->func($out)) return true;
|
3388 |
+
if ($this->progid($out)) return true;
|
3389 |
+
|
3390 |
+
if ($this->keyword($keyword)) {
|
3391 |
+
if ($keyword == "null") {
|
3392 |
+
$out = array("null");
|
3393 |
+
} else {
|
3394 |
+
$out = array("keyword", $keyword);
|
3395 |
+
}
|
3396 |
+
return true;
|
3397 |
+
}
|
3398 |
+
|
3399 |
+
return false;
|
3400 |
+
}
|
3401 |
+
|
3402 |
+
// value wrappen in parentheses
|
3403 |
+
protected function parenValue(&$out) {
|
3404 |
+
$s = $this->seek();
|
3405 |
+
|
3406 |
+
$inParens = $this->inParens;
|
3407 |
+
if ($this->literal("(") &&
|
3408 |
+
($this->inParens = true) && $this->expression($exp) &&
|
3409 |
+
$this->literal(")"))
|
3410 |
+
{
|
3411 |
+
$out = $exp;
|
3412 |
+
$this->inParens = $inParens;
|
3413 |
+
return true;
|
3414 |
+
} else {
|
3415 |
+
$this->inParens = $inParens;
|
3416 |
+
$this->seek($s);
|
3417 |
+
}
|
3418 |
+
|
3419 |
+
return false;
|
3420 |
+
}
|
3421 |
+
|
3422 |
+
protected function progid(&$out) {
|
3423 |
+
$s = $this->seek();
|
3424 |
+
if ($this->literal("progid:", false) &&
|
3425 |
+
$this->openString("(", $fn) &&
|
3426 |
+
$this->literal("("))
|
3427 |
+
{
|
3428 |
+
$this->openString(")", $args, "(");
|
3429 |
+
if ($this->literal(")")) {
|
3430 |
+
$out = array("string", "", array(
|
3431 |
+
"progid:", $fn, "(", $args, ")"
|
3432 |
+
));
|
3433 |
+
return true;
|
3434 |
+
}
|
3435 |
+
}
|
3436 |
+
|
3437 |
+
$this->seek($s);
|
3438 |
+
return false;
|
3439 |
+
}
|
3440 |
+
|
3441 |
+
protected function func(&$func) {
|
3442 |
+
$s = $this->seek();
|
3443 |
+
|
3444 |
+
if ($this->keyword($name, false) &&
|
3445 |
+
$this->literal("("))
|
3446 |
+
{
|
3447 |
+
if ($name == "alpha" && $this->argumentList($args)) {
|
3448 |
+
$func = array("function", $name, array("string", "", $args));
|
3449 |
+
return true;
|
3450 |
+
}
|
3451 |
+
|
3452 |
+
if ($name != "expression" && !preg_match("/^(-[a-z]+-)?calc$/", $name)) {
|
3453 |
+
$ss = $this->seek();
|
3454 |
+
if ($this->argValues($args) && $this->literal(")")) {
|
3455 |
+
$func = array("fncall", $name, $args);
|
3456 |
+
return true;
|
3457 |
+
}
|
3458 |
+
$this->seek($ss);
|
3459 |
+
}
|
3460 |
+
|
3461 |
+
if (($this->openString(")", $str, "(") || true ) &&
|
3462 |
+
$this->literal(")"))
|
3463 |
+
{
|
3464 |
+
$args = array();
|
3465 |
+
if (!empty($str)) {
|
3466 |
+
$args[] = array(null, array("string", "", array($str)));
|
3467 |
+
}
|
3468 |
+
|
3469 |
+
$func = array("fncall", $name, $args);
|
3470 |
+
return true;
|
3471 |
+
}
|
3472 |
+
}
|
3473 |
+
|
3474 |
+
$this->seek($s);
|
3475 |
+
return false;
|
3476 |
+
}
|
3477 |
+
|
3478 |
+
protected function argumentList(&$out) {
|
3479 |
+
$s = $this->seek();
|
3480 |
+
$this->literal("(");
|
3481 |
+
|
3482 |
+
$args = array();
|
3483 |
+
while ($this->keyword($var)) {
|
3484 |
+
$ss = $this->seek();
|
3485 |
+
|
3486 |
+
if ($this->literal("=") && $this->expression($exp)) {
|
3487 |
+
$args[] = array("string", "", array($var."="));
|
3488 |
+
$arg = $exp;
|
3489 |
+
} else {
|
3490 |
+
break;
|
3491 |
+
}
|
3492 |
+
|
3493 |
+
$args[] = $arg;
|
3494 |
+
|
3495 |
+
if (!$this->literal(",")) break;
|
3496 |
+
|
3497 |
+
$args[] = array("string", "", array(", "));
|
3498 |
+
}
|
3499 |
+
|
3500 |
+
if (!$this->literal(")") || !count($args)) {
|
3501 |
+
$this->seek($s);
|
3502 |
+
return false;
|
3503 |
+
}
|
3504 |
+
|
3505 |
+
$out = $args;
|
3506 |
+
return true;
|
3507 |
+
}
|
3508 |
+
|
3509 |
+
protected function argumentDef(&$out) {
|
3510 |
+
$s = $this->seek();
|
3511 |
+
$this->literal("(");
|
3512 |
+
|
3513 |
+
$args = array();
|
3514 |
+
while ($this->variable($var)) {
|
3515 |
+
$arg = array($var[1], null, false);
|
3516 |
+
|
3517 |
+
$ss = $this->seek();
|
3518 |
+
if ($this->literal(":") && $this->genericList($defaultVal, "expression")) {
|
3519 |
+
$arg[1] = $defaultVal;
|
3520 |
+
} else {
|
3521 |
+
$this->seek($ss);
|
3522 |
+
}
|
3523 |
+
|
3524 |
+
$ss = $this->seek();
|
3525 |
+
if ($this->literal("...")) {
|
3526 |
+
$sss = $this->seek();
|
3527 |
+
if (!$this->literal(")")) {
|
3528 |
+
$this->throwParseError("... has to be after the final argument");
|
3529 |
+
}
|
3530 |
+
$arg[2] = true;
|
3531 |
+
$this->seek($sss);
|
3532 |
+
} else {
|
3533 |
+
$this->seek($ss);
|
3534 |
+
}
|
3535 |
+
|
3536 |
+
$args[] = $arg;
|
3537 |
+
if (!$this->literal(",")) break;
|
3538 |
+
}
|
3539 |
+
|
3540 |
+
if (!$this->literal(")")) {
|
3541 |
+
$this->seek($s);
|
3542 |
+
return false;
|
3543 |
+
}
|
3544 |
+
|
3545 |
+
$out = $args;
|
3546 |
+
return true;
|
3547 |
+
}
|
3548 |
+
|
3549 |
+
protected function color(&$out) {
|
3550 |
+
$color = array('color');
|
3551 |
+
|
3552 |
+
if ($this->match('(#([0-9a-f]{6})|#([0-9a-f]{3}))', $m)) {
|
3553 |
+
if (isset($m[3])) {
|
3554 |
+
$num = $m[3];
|
3555 |
+
$width = 16;
|
3556 |
+
} else {
|
3557 |
+
$num = $m[2];
|
3558 |
+
$width = 256;
|
3559 |
+
}
|
3560 |
+
|
3561 |
+
$num = hexdec($num);
|
3562 |
+
foreach (array(3,2,1) as $i) {
|
3563 |
+
$t = $num % $width;
|
3564 |
+
$num /= $width;
|
3565 |
+
|
3566 |
+
$color[$i] = $t * (256/$width) + $t * floor(16/$width);
|
3567 |
+
}
|
3568 |
+
|
3569 |
+
$out = $color;
|
3570 |
+
return true;
|
3571 |
+
}
|
3572 |
+
|
3573 |
+
return false;
|
3574 |
+
}
|
3575 |
+
|
3576 |
+
protected function unit(&$unit) {
|
3577 |
+
if ($this->match('([0-9]*(\.)?[0-9]+)([%a-zA-Z]+)?', $m)) {
|
3578 |
+
$unit = array("number", $m[1], empty($m[3]) ? "" : $m[3]);
|
3579 |
+
return true;
|
3580 |
+
}
|
3581 |
+
return false;
|
3582 |
+
}
|
3583 |
+
|
3584 |
+
protected function string(&$out) {
|
3585 |
+
$s = $this->seek();
|
3586 |
+
if ($this->literal('"', false)) {
|
3587 |
+
$delim = '"';
|
3588 |
+
} elseif ($this->literal("'", false)) {
|
3589 |
+
$delim = "'";
|
3590 |
+
} else {
|
3591 |
+
return false;
|
3592 |
+
}
|
3593 |
+
|
3594 |
+
$content = array();
|
3595 |
+
$oldWhite = $this->eatWhiteDefault;
|
3596 |
+
$this->eatWhiteDefault = false;
|
3597 |
+
|
3598 |
+
while ($this->matchString($m, $delim)) {
|
3599 |
+
$content[] = $m[1];
|
3600 |
+
if ($m[2] == "#{") {
|
3601 |
+
$this->count -= strlen($m[2]);
|
3602 |
+
if ($this->interpolation($inter, false)) {
|
3603 |
+
$content[] = $inter;
|
3604 |
+
} else {
|
3605 |
+
$this->count += strlen($m[2]);
|
3606 |
+
$content[] = "#{"; // ignore it
|
3607 |
+
}
|
3608 |
+
} elseif ($m[2] == '\\') {
|
3609 |
+
$content[] = $m[2];
|
3610 |
+
if ($this->literal($delim, false)) {
|
3611 |
+
$content[] = $delim;
|
3612 |
+
}
|
3613 |
+
} else {
|
3614 |
+
$this->count -= strlen($delim);
|
3615 |
+
break; // delim
|
3616 |
+
}
|
3617 |
+
}
|
3618 |
+
|
3619 |
+
$this->eatWhiteDefault = $oldWhite;
|
3620 |
+
|
3621 |
+
if ($this->literal($delim)) {
|
3622 |
+
$out = array("string", $delim, $content);
|
3623 |
+
return true;
|
3624 |
+
}
|
3625 |
+
|
3626 |
+
$this->seek($s);
|
3627 |
+
return false;
|
3628 |
+
}
|
3629 |
+
|
3630 |
+
protected function mixedKeyword(&$out) {
|
3631 |
+
$s = $this->seek();
|
3632 |
+
|
3633 |
+
$parts = array();
|
3634 |
+
|
3635 |
+
$oldWhite = $this->eatWhiteDefault;
|
3636 |
+
$this->eatWhiteDefault = false;
|
3637 |
+
|
3638 |
+
while (true) {
|
3639 |
+
if ($this->keyword($key)) {
|
3640 |
+
$parts[] = $key;
|
3641 |
+
continue;
|
3642 |
+
}
|
3643 |
+
|
3644 |
+
if ($this->interpolation($inter)) {
|
3645 |
+
$parts[] = $inter;
|
3646 |
+
continue;
|
3647 |
+
}
|
3648 |
+
|
3649 |
+
break;
|
3650 |
+
}
|
3651 |
+
|
3652 |
+
$this->eatWhiteDefault = $oldWhite;
|
3653 |
+
|
3654 |
+
if (count($parts) == 0) return false;
|
3655 |
+
|
3656 |
+
if ($this->eatWhiteDefault) {
|
3657 |
+
$this->whitespace();
|
3658 |
+
}
|
3659 |
+
|
3660 |
+
$out = $parts;
|
3661 |
+
return true;
|
3662 |
+
}
|
3663 |
+
|
3664 |
+
// an unbounded string stopped by $end
|
3665 |
+
protected function openString($end, &$out, $nestingOpen=null) {
|
3666 |
+
$oldWhite = $this->eatWhiteDefault;
|
3667 |
+
$this->eatWhiteDefault = false;
|
3668 |
+
|
3669 |
+
$stop = array("'", '"', "#{", $end);
|
3670 |
+
$stop = array_map(array($this, "preg_quote"), $stop);
|
3671 |
+
$stop[] = self::$commentMulti;
|
3672 |
+
|
3673 |
+
$patt = '(.*?)('.implode("|", $stop).')';
|
3674 |
+
|
3675 |
+
$nestingLevel = 0;
|
3676 |
+
|
3677 |
+
$content = array();
|
3678 |
+
while ($this->match($patt, $m, false)) {
|
3679 |
+
if (isset($m[1]) && $m[1] !== '') {
|
3680 |
+
$content[] = $m[1];
|
3681 |
+
if ($nestingOpen) {
|
3682 |
+
$nestingLevel += substr_count($m[1], $nestingOpen);
|
3683 |
+
}
|
3684 |
+
}
|
3685 |
+
|
3686 |
+
$tok = $m[2];
|
3687 |
+
|
3688 |
+
$this->count-= strlen($tok);
|
3689 |
+
if ($tok == $end) {
|
3690 |
+
if ($nestingLevel == 0) {
|
3691 |
+
break;
|
3692 |
+
} else {
|
3693 |
+
$nestingLevel--;
|
3694 |
+
}
|
3695 |
+
}
|
3696 |
+
|
3697 |
+
if (($tok == "'" || $tok == '"') && $this->string($str)) {
|
3698 |
+
$content[] = $str;
|
3699 |
+
continue;
|
3700 |
+
}
|
3701 |
+
|
3702 |
+
if ($tok == "#{" && $this->interpolation($inter)) {
|
3703 |
+
$content[] = $inter;
|
3704 |
+
continue;
|
3705 |
+
}
|
3706 |
+
|
3707 |
+
$content[] = $tok;
|
3708 |
+
$this->count+= strlen($tok);
|
3709 |
+
}
|
3710 |
+
|
3711 |
+
$this->eatWhiteDefault = $oldWhite;
|
3712 |
+
|
3713 |
+
if (count($content) == 0) return false;
|
3714 |
+
|
3715 |
+
// trim the end
|
3716 |
+
if (is_string(end($content))) {
|
3717 |
+
$content[count($content) - 1] = rtrim(end($content));
|
3718 |
+
}
|
3719 |
+
|
3720 |
+
$out = array("string", "", $content);
|
3721 |
+
return true;
|
3722 |
+
}
|
3723 |
+
|
3724 |
+
// $lookWhite: save information about whitespace before and after
|
3725 |
+
protected function interpolation(&$out, $lookWhite=true) {
|
3726 |
+
$oldWhite = $this->eatWhiteDefault;
|
3727 |
+
$this->eatWhiteDefault = true;
|
3728 |
+
|
3729 |
+
$s = $this->seek();
|
3730 |
+
if ($this->literal("#{") && $this->valueList($value) && $this->literal("}", false)) {
|
3731 |
+
|
3732 |
+
// TODO: don't error if out of bounds
|
3733 |
+
|
3734 |
+
if ($lookWhite) {
|
3735 |
+
$left = preg_match('/\s/', $this->buffer[$s - 1]) ? " " : "";
|
3736 |
+
$right = preg_match('/\s/', $this->buffer[$this->count]) ? " ": "";
|
3737 |
+
} else {
|
3738 |
+
$left = $right = false;
|
3739 |
+
}
|
3740 |
+
|
3741 |
+
$out = array("interpolate", $value, $left, $right);
|
3742 |
+
$this->eatWhiteDefault = $oldWhite;
|
3743 |
+
if ($this->eatWhiteDefault) $this->whitespace();
|
3744 |
+
return true;
|
3745 |
+
}
|
3746 |
+
|
3747 |
+
$this->seek($s);
|
3748 |
+
$this->eatWhiteDefault = $oldWhite;
|
3749 |
+
return false;
|
3750 |
+
}
|
3751 |
+
|
3752 |
+
// low level parsers
|
3753 |
+
|
3754 |
+
// returns an array of parts or a string
|
3755 |
+
protected function propertyName(&$out) {
|
3756 |
+
$s = $this->seek();
|
3757 |
+
$parts = array();
|
3758 |
+
|
3759 |
+
$oldWhite = $this->eatWhiteDefault;
|
3760 |
+
$this->eatWhiteDefault = false;
|
3761 |
+
|
3762 |
+
while (true) {
|
3763 |
+
if ($this->interpolation($inter)) {
|
3764 |
+
$parts[] = $inter;
|
3765 |
+
} elseif ($this->keyword($text)) {
|
3766 |
+
$parts[] = $text;
|
3767 |
+
} elseif (count($parts) == 0 && $this->match('[:.#]', $m, false)) {
|
3768 |
+
// css hacks
|
3769 |
+
$parts[] = $m[0];
|
3770 |
+
} else {
|
3771 |
+
break;
|
3772 |
+
}
|
3773 |
+
}
|
3774 |
+
|
3775 |
+
$this->eatWhiteDefault = $oldWhite;
|
3776 |
+
if (count($parts) == 0) return false;
|
3777 |
+
|
3778 |
+
// match comment hack
|
3779 |
+
if (preg_match(self::$whitePattern,
|
3780 |
+
$this->buffer, $m, null, $this->count))
|
3781 |
+
{
|
3782 |
+
if (!empty($m[0])) {
|
3783 |
+
$parts[] = $m[0];
|
3784 |
+
$this->count += strlen($m[0]);
|
3785 |
+
}
|
3786 |
+
}
|
3787 |
+
|
3788 |
+
$this->whitespace(); // get any extra whitespace
|
3789 |
+
|
3790 |
+
$out = array("string", "", $parts);
|
3791 |
+
return true;
|
3792 |
+
}
|
3793 |
+
|
3794 |
+
// comma separated list of selectors
|
3795 |
+
protected function selectors(&$out) {
|
3796 |
+
$s = $this->seek();
|
3797 |
+
$selectors = array();
|
3798 |
+
while ($this->selector($sel)) {
|
3799 |
+
$selectors[] = $sel;
|
3800 |
+
if (!$this->literal(",")) break;
|
3801 |
+
while ($this->literal(",")); // ignore extra
|
3802 |
+
}
|
3803 |
+
|
3804 |
+
if (count($selectors) == 0) {
|
3805 |
+
$this->seek($s);
|
3806 |
+
return false;
|
3807 |
+
}
|
3808 |
+
|
3809 |
+
$out = $selectors;
|
3810 |
+
return true;
|
3811 |
+
}
|
3812 |
+
|
3813 |
+
// whitespace separated list of selectorSingle
|
3814 |
+
protected function selector(&$out) {
|
3815 |
+
$selector = array();
|
3816 |
+
|
3817 |
+
while (true) {
|
3818 |
+
if ($this->match('[>+~]+', $m)) {
|
3819 |
+
$selector[] = array($m[0]);
|
3820 |
+
} elseif ($this->selectorSingle($part)) {
|
3821 |
+
$selector[] = $part;
|
3822 |
+
$this->whitespace();
|
3823 |
+
} elseif ($this->match('\/[^\/]+\/', $m)) {
|
3824 |
+
$selector[] = array($m[0]);
|
3825 |
+
} else {
|
3826 |
+
break;
|
3827 |
+
}
|
3828 |
+
|
3829 |
+
}
|
3830 |
+
|
3831 |
+
if (count($selector) == 0) {
|
3832 |
+
return false;
|
3833 |
+
}
|
3834 |
+
|
3835 |
+
$out = $selector;
|
3836 |
+
return true;
|
3837 |
+
}
|
3838 |
+
|
3839 |
+
// the parts that make up
|
3840 |
+
// div[yes=no]#something.hello.world:nth-child(-2n+1)%placeholder
|
3841 |
+
protected function selectorSingle(&$out) {
|
3842 |
+
$oldWhite = $this->eatWhiteDefault;
|
3843 |
+
$this->eatWhiteDefault = false;
|
3844 |
+
|
3845 |
+
$parts = array();
|
3846 |
+
|
3847 |
+
if ($this->literal("*", false)) {
|
3848 |
+
$parts[] = "*";
|
3849 |
+
}
|
3850 |
+
|
3851 |
+
while (true) {
|
3852 |
+
// see if we can stop early
|
3853 |
+
if ($this->match("\s*[{,]", $m)) {
|
3854 |
+
$this->count--;
|
3855 |
+
break;
|
3856 |
+
}
|
3857 |
+
|
3858 |
+
$s = $this->seek();
|
3859 |
+
// self
|
3860 |
+
if ($this->literal("&", false)) {
|
3861 |
+
$parts[] = scssc::$selfSelector;
|
3862 |
+
continue;
|
3863 |
+
}
|
3864 |
+
|
3865 |
+
if ($this->literal(".", false)) {
|
3866 |
+
$parts[] = ".";
|
3867 |
+
continue;
|
3868 |
+
}
|
3869 |
+
|
3870 |
+
if ($this->literal("|", false)) {
|
3871 |
+
$parts[] = "|";
|
3872 |
+
continue;
|
3873 |
+
}
|
3874 |
+
|
3875 |
+
// for keyframes
|
3876 |
+
if ($this->unit($unit)) {
|
3877 |
+
$parts[] = $unit;
|
3878 |
+
continue;
|
3879 |
+
}
|
3880 |
+
|
3881 |
+
if ($this->keyword($name)) {
|
3882 |
+
$parts[] = $name;
|
3883 |
+
continue;
|
3884 |
+
}
|
3885 |
+
|
3886 |
+
if ($this->interpolation($inter)) {
|
3887 |
+
$parts[] = $inter;
|
3888 |
+
continue;
|
3889 |
+
}
|
3890 |
+
|
3891 |
+
if ($this->literal('%', false) && $this->placeholder($placeholder)) {
|
3892 |
+
$parts[] = '%';
|
3893 |
+
$parts[] = $placeholder;
|
3894 |
+
continue;
|
3895 |
+
}
|
3896 |
+
|
3897 |
+
if ($this->literal("#", false)) {
|
3898 |
+
$parts[] = "#";
|
3899 |
+
continue;
|
3900 |
+
}
|
3901 |
+
|
3902 |
+
// a pseudo selector
|
3903 |
+
if ($this->match("::?", $m) && $this->mixedKeyword($nameParts)) {
|
3904 |
+
$parts[] = $m[0];
|
3905 |
+
foreach ($nameParts as $sub) {
|
3906 |
+
$parts[] = $sub;
|
3907 |
+
}
|
3908 |
+
|
3909 |
+
$ss = $this->seek();
|
3910 |
+
if ($this->literal("(") &&
|
3911 |
+
($this->openString(")", $str, "(") || true ) &&
|
3912 |
+
$this->literal(")"))
|
3913 |
+
{
|
3914 |
+
$parts[] = "(";
|
3915 |
+
if (!empty($str)) $parts[] = $str;
|
3916 |
+
$parts[] = ")";
|
3917 |
+
} else {
|
3918 |
+
$this->seek($ss);
|
3919 |
+
}
|
3920 |
+
|
3921 |
+
continue;
|
3922 |
+
} else {
|
3923 |
+
$this->seek($s);
|
3924 |
+
}
|
3925 |
+
|
3926 |
+
// attribute selector
|
3927 |
+
// TODO: replace with open string?
|
3928 |
+
if ($this->literal("[", false)) {
|
3929 |
+
$attrParts = array("[");
|
3930 |
+
// keyword, string, operator
|
3931 |
+
while (true) {
|
3932 |
+
if ($this->literal("]", false)) {
|
3933 |
+
$this->count--;
|
3934 |
+
break; // get out early
|
3935 |
+
}
|
3936 |
+
|
3937 |
+
if ($this->match('\s+', $m)) {
|
3938 |
+
$attrParts[] = " ";
|
3939 |
+
continue;
|
3940 |
+
}
|
3941 |
+
if ($this->string($str)) {
|
3942 |
+
$attrParts[] = $str;
|
3943 |
+
continue;
|
3944 |
+
}
|
3945 |
+
|
3946 |
+
if ($this->keyword($word)) {
|
3947 |
+
$attrParts[] = $word;
|
3948 |
+
continue;
|
3949 |
+
}
|
3950 |
+
|
3951 |
+
if ($this->interpolation($inter, false)) {
|
3952 |
+
$attrParts[] = $inter;
|
3953 |
+
continue;
|
3954 |
+
}
|
3955 |
+
|
3956 |
+
// operator, handles attr namespace too
|
3957 |
+
if ($this->match('[|-~\$\*\^=]+', $m)) {
|
3958 |
+
$attrParts[] = $m[0];
|
3959 |
+
continue;
|
3960 |
+
}
|
3961 |
+
|
3962 |
+
break;
|
3963 |
+
}
|
3964 |
+
|
3965 |
+
if ($this->literal("]", false)) {
|
3966 |
+
$attrParts[] = "]";
|
3967 |
+
foreach ($attrParts as $part) {
|
3968 |
+
$parts[] = $part;
|
3969 |
+
}
|
3970 |
+
continue;
|
3971 |
+
}
|
3972 |
+
$this->seek($s);
|
3973 |
+
// should just break here?
|
3974 |
+
}
|
3975 |
+
|
3976 |
+
break;
|
3977 |
+
}
|
3978 |
+
|
3979 |
+
$this->eatWhiteDefault = $oldWhite;
|
3980 |
+
|
3981 |
+
if (count($parts) == 0) return false;
|
3982 |
+
|
3983 |
+
$out = $parts;
|
3984 |
+
return true;
|
3985 |
+
}
|
3986 |
+
|
3987 |
+
protected function variable(&$out) {
|
3988 |
+
$s = $this->seek();
|
3989 |
+
if ($this->literal("$", false) && $this->keyword($name)) {
|
3990 |
+
$out = array("var", $name);
|
3991 |
+
return true;
|
3992 |
+
}
|
3993 |
+
$this->seek($s);
|
3994 |
+
return false;
|
3995 |
+
}
|
3996 |
+
|
3997 |
+
protected function keyword(&$word, $eatWhitespace = null) {
|
3998 |
+
if ($this->match('([\w_\-\*!"\'\\\\][\w\-_"\'\\\\]*)',
|
3999 |
+
$m, $eatWhitespace))
|
4000 |
+
{
|
4001 |
+
$word = $m[1];
|
4002 |
+
return true;
|
4003 |
+
}
|
4004 |
+
return false;
|
4005 |
+
}
|
4006 |
+
|
4007 |
+
protected function placeholder(&$placeholder) {
|
4008 |
+
if ($this->match('([\w\-_]+)', $m)) {
|
4009 |
+
$placeholder = $m[1];
|
4010 |
+
return true;
|
4011 |
+
}
|
4012 |
+
return false;
|
4013 |
+
}
|
4014 |
+
|
4015 |
+
// consume an end of statement delimiter
|
4016 |
+
protected function end() {
|
4017 |
+
if ($this->literal(';')) {
|
4018 |
+
return true;
|
4019 |
+
} elseif ($this->count == strlen($this->buffer) || $this->buffer[$this->count] == '}') {
|
4020 |
+
// if there is end of file or a closing block next then we don't need a ;
|
4021 |
+
return true;
|
4022 |
+
}
|
4023 |
+
return false;
|
4024 |
+
}
|
4025 |
+
|
4026 |
+
// advance counter to next occurrence of $what
|
4027 |
+
// $until - don't include $what in advance
|
4028 |
+
// $allowNewline, if string, will be used as valid char set
|
4029 |
+
protected function to($what, &$out, $until = false, $allowNewline = false) {
|
4030 |
+
if (is_string($allowNewline)) {
|
4031 |
+
$validChars = $allowNewline;
|
4032 |
+
} else {
|
4033 |
+
$validChars = $allowNewline ? "." : "[^\n]";
|
4034 |
+
}
|
4035 |
+
if (!$this->match('('.$validChars.'*?)'.$this->preg_quote($what), $m, !$until)) return false;
|
4036 |
+
if ($until) $this->count -= strlen($what); // give back $what
|
4037 |
+
$out = $m[1];
|
4038 |
+
return true;
|
4039 |
+
}
|
4040 |
+
|
4041 |
+
public function throwParseError($msg = "parse error", $count = null) {
|
4042 |
+
$count = !isset($count) ? $this->count : $count;
|
4043 |
+
|
4044 |
+
$line = $this->getLineNo($count);
|
4045 |
+
|
4046 |
+
if (!empty($this->sourceName)) {
|
4047 |
+
$loc = "$this->sourceName on line $line";
|
4048 |
+
} else {
|
4049 |
+
$loc = "line: $line";
|
4050 |
+
}
|
4051 |
+
|
4052 |
+
if ($this->peek("(.*?)(\n|$)", $m, $count)) {
|
4053 |
+
throw new Exception("$msg: failed at `$m[1]` $loc");
|
4054 |
+
} else {
|
4055 |
+
throw new Exception("$msg: $loc");
|
4056 |
+
}
|
4057 |
+
}
|
4058 |
+
|
4059 |
+
public function getLineNo($pos) {
|
4060 |
+
return 1 + substr_count(substr($this->buffer, 0, $pos), "\n");
|
4061 |
+
}
|
4062 |
+
|
4063 |
+
/**
|
4064 |
+
* Match string looking for either ending delim, escape, or string interpolation
|
4065 |
+
*
|
4066 |
+
* {@internal This is a workaround for preg_match's 250K string match limit. }}
|
4067 |
+
*
|
4068 |
+
* @param array $m Matches (passed by reference)
|
4069 |
+
* @param string $delim Delimeter
|
4070 |
+
*
|
4071 |
+
* @return boolean True if match; false otherwise
|
4072 |
+
*/
|
4073 |
+
protected function matchString(&$m, $delim) {
|
4074 |
+
$token = null;
|
4075 |
+
|
4076 |
+
$end = strpos($this->buffer, "\n", $this->count);
|
4077 |
+
if ($end === false || $this->buffer[$end - 1] == '\\' || $this->buffer[$end - 2] == '\\' && $this->buffer[$end - 1] == "\r") {
|
4078 |
+
$end = strlen($this->buffer);
|
4079 |
+
}
|
4080 |
+
|
4081 |
+
// look for either ending delim, escape, or string interpolation
|
4082 |
+
foreach (array('#{', '\\', $delim) as $lookahead) {
|
4083 |
+
$pos = strpos($this->buffer, $lookahead, $this->count);
|
4084 |
+
if ($pos !== false && $pos < $end) {
|
4085 |
+
$end = $pos;
|
4086 |
+
$token = $lookahead;
|
4087 |
+
}
|
4088 |
+
}
|
4089 |
+
|
4090 |
+
if (!isset($token)) {
|
4091 |
+
return false;
|
4092 |
+
}
|
4093 |
+
|
4094 |
+
$match = substr($this->buffer, $this->count, $end - $this->count);
|
4095 |
+
$m = array(
|
4096 |
+
$match . $token,
|
4097 |
+
$match,
|
4098 |
+
$token
|
4099 |
+
);
|
4100 |
+
$this->count = $end + strlen($token);
|
4101 |
+
|
4102 |
+
return true;
|
4103 |
+
}
|
4104 |
+
|
4105 |
+
// try to match something on head of buffer
|
4106 |
+
protected function match($regex, &$out, $eatWhitespace = null) {
|
4107 |
+
if (!isset($eatWhitespace)) $eatWhitespace = $this->eatWhiteDefault;
|
4108 |
+
|
4109 |
+
$r = '/'.$regex.'/Ais';
|
4110 |
+
if (preg_match($r, $this->buffer, $out, null, $this->count)) {
|
4111 |
+
$this->count += strlen($out[0]);
|
4112 |
+
if ($eatWhitespace) $this->whitespace();
|
4113 |
+
return true;
|
4114 |
+
}
|
4115 |
+
return false;
|
4116 |
+
}
|
4117 |
+
|
4118 |
+
// match some whitespace
|
4119 |
+
protected function whitespace() {
|
4120 |
+
$gotWhite = false;
|
4121 |
+
while (preg_match(self::$whitePattern, $this->buffer, $m, null, $this->count)) {
|
4122 |
+
if ($this->insertComments) {
|
4123 |
+
if (isset($m[1]) && empty($this->commentsSeen[$this->count])) {
|
4124 |
+
$this->append(array("comment", $m[1]));
|
4125 |
+
$this->commentsSeen[$this->count] = true;
|
4126 |
+
}
|
4127 |
+
}
|
4128 |
+
$this->count += strlen($m[0]);
|
4129 |
+
$gotWhite = true;
|
4130 |
+
}
|
4131 |
+
return $gotWhite;
|
4132 |
+
}
|
4133 |
+
|
4134 |
+
protected function peek($regex, &$out, $from=null) {
|
4135 |
+
if (!isset($from)) $from = $this->count;
|
4136 |
+
|
4137 |
+
$r = '/'.$regex.'/Ais';
|
4138 |
+
$result = preg_match($r, $this->buffer, $out, null, $from);
|
4139 |
+
|
4140 |
+
return $result;
|
4141 |
+
}
|
4142 |
+
|
4143 |
+
protected function seek($where = null) {
|
4144 |
+
if ($where === null) return $this->count;
|
4145 |
+
else $this->count = $where;
|
4146 |
+
return true;
|
4147 |
+
}
|
4148 |
+
|
4149 |
+
static function preg_quote($what) {
|
4150 |
+
return preg_quote($what, '/');
|
4151 |
+
}
|
4152 |
+
|
4153 |
+
protected function show() {
|
4154 |
+
if ($this->peek("(.*?)(\n|$)", $m, $this->count)) {
|
4155 |
+
return $m[1];
|
4156 |
+
}
|
4157 |
+
return "";
|
4158 |
+
}
|
4159 |
+
|
4160 |
+
// turn list of length 1 into value type
|
4161 |
+
protected function flattenList($value) {
|
4162 |
+
if ($value[0] == "list" && count($value[2]) == 1) {
|
4163 |
+
return $this->flattenList($value[2][0]);
|
4164 |
+
}
|
4165 |
+
return $value;
|
4166 |
+
}
|
4167 |
+
}
|
4168 |
+
|
4169 |
+
/**
|
4170 |
+
* SCSS base formatter
|
4171 |
+
*
|
4172 |
+
* @author Leaf Corcoran <leafot@gmail.com>
|
4173 |
+
*/
|
4174 |
+
class scss_formatter {
|
4175 |
+
public $indentChar = " ";
|
4176 |
+
|
4177 |
+
public $break = "\n";
|
4178 |
+
public $open = " {";
|
4179 |
+
public $close = "}";
|
4180 |
+
public $tagSeparator = ", ";
|
4181 |
+
public $assignSeparator = ": ";
|
4182 |
+
|
4183 |
+
public function __construct() {
|
4184 |
+
$this->indentLevel = 0;
|
4185 |
+
}
|
4186 |
+
|
4187 |
+
public function indentStr($n = 0) {
|
4188 |
+
return str_repeat($this->indentChar, max($this->indentLevel + $n, 0));
|
4189 |
+
}
|
4190 |
+
|
4191 |
+
public function property($name, $value) {
|
4192 |
+
return $name . $this->assignSeparator . $value . ";";
|
4193 |
+
}
|
4194 |
+
|
4195 |
+
protected function block($block) {
|
4196 |
+
if (empty($block->lines) && empty($block->children)) return;
|
4197 |
+
|
4198 |
+
$inner = $pre = $this->indentStr();
|
4199 |
+
|
4200 |
+
if (!empty($block->selectors)) {
|
4201 |
+
echo $pre .
|
4202 |
+
implode($this->tagSeparator, $block->selectors) .
|
4203 |
+
$this->open . $this->break;
|
4204 |
+
$this->indentLevel++;
|
4205 |
+
$inner = $this->indentStr();
|
4206 |
+
}
|
4207 |
+
|
4208 |
+
if (!empty($block->lines)) {
|
4209 |
+
$glue = $this->break.$inner;
|
4210 |
+
echo $inner . implode($glue, $block->lines);
|
4211 |
+
if (!empty($block->children)) {
|
4212 |
+
echo $this->break;
|
4213 |
+
}
|
4214 |
+
}
|
4215 |
+
|
4216 |
+
foreach ($block->children as $child) {
|
4217 |
+
$this->block($child);
|
4218 |
+
}
|
4219 |
+
|
4220 |
+
if (!empty($block->selectors)) {
|
4221 |
+
$this->indentLevel--;
|
4222 |
+
if (empty($block->children)) echo $this->break;
|
4223 |
+
echo $pre . $this->close . $this->break;
|
4224 |
+
}
|
4225 |
+
}
|
4226 |
+
|
4227 |
+
public function format($block) {
|
4228 |
+
ob_start();
|
4229 |
+
$this->block($block);
|
4230 |
+
$out = ob_get_clean();
|
4231 |
+
|
4232 |
+
return $out;
|
4233 |
+
}
|
4234 |
+
}
|
4235 |
+
|
4236 |
+
/**
|
4237 |
+
* SCSS nested formatter
|
4238 |
+
*
|
4239 |
+
* @author Leaf Corcoran <leafot@gmail.com>
|
4240 |
+
*/
|
4241 |
+
class scss_formatter_nested extends scss_formatter {
|
4242 |
+
public $close = " }";
|
4243 |
+
|
4244 |
+
// adjust the depths of all children, depth first
|
4245 |
+
public function adjustAllChildren($block) {
|
4246 |
+
// flatten empty nested blocks
|
4247 |
+
$children = array();
|
4248 |
+
foreach ($block->children as $i => $child) {
|
4249 |
+
if (empty($child->lines) && empty($child->children)) {
|
4250 |
+
if (isset($block->children[$i + 1])) {
|
4251 |
+
$block->children[$i + 1]->depth = $child->depth;
|
4252 |
+
}
|
4253 |
+
continue;
|
4254 |
+
}
|
4255 |
+
$children[] = $child;
|
4256 |
+
}
|
4257 |
+
|
4258 |
+
$count = count($children);
|
4259 |
+
for ($i = 0; $i < $count; $i++) {
|
4260 |
+
$depth = $children[$i]->depth;
|
4261 |
+
$j = $i + 1;
|
4262 |
+
if (isset($children[$j]) && $depth < $children[$j]->depth) {
|
4263 |
+
$childDepth = $children[$j]->depth;
|
4264 |
+
for (; $j < $count; $j++) {
|
4265 |
+
if ($depth < $children[$j]->depth && $childDepth >= $children[$j]->depth) {
|
4266 |
+
$children[$j]->depth = $depth + 1;
|
4267 |
+
}
|
4268 |
+
}
|
4269 |
+
}
|
4270 |
+
}
|
4271 |
+
|
4272 |
+
$block->children = $children;
|
4273 |
+
|
4274 |
+
// make relative to parent
|
4275 |
+
foreach ($block->children as $child) {
|
4276 |
+
$this->adjustAllChildren($child);
|
4277 |
+
$child->depth = $child->depth - $block->depth;
|
4278 |
+
}
|
4279 |
+
}
|
4280 |
+
|
4281 |
+
protected function block($block) {
|
4282 |
+
if ($block->type == "root") {
|
4283 |
+
$this->adjustAllChildren($block);
|
4284 |
+
}
|
4285 |
+
|
4286 |
+
$inner = $pre = $this->indentStr($block->depth - 1);
|
4287 |
+
if (!empty($block->selectors)) {
|
4288 |
+
echo $pre .
|
4289 |
+
implode($this->tagSeparator, $block->selectors) .
|
4290 |
+
$this->open . $this->break;
|
4291 |
+
$this->indentLevel++;
|
4292 |
+
$inner = $this->indentStr($block->depth - 1);
|
4293 |
+
}
|
4294 |
+
|
4295 |
+
if (!empty($block->lines)) {
|
4296 |
+
$glue = $this->break.$inner;
|
4297 |
+
echo $inner . implode($glue, $block->lines);
|
4298 |
+
if (!empty($block->children)) echo $this->break;
|
4299 |
+
}
|
4300 |
+
|
4301 |
+
foreach ($block->children as $i => $child) {
|
4302 |
+
// echo "*** block: ".$block->depth." child: ".$child->depth."\n";
|
4303 |
+
$this->block($child);
|
4304 |
+
if ($i < count($block->children) - 1) {
|
4305 |
+
echo $this->break;
|
4306 |
+
|
4307 |
+
if (isset($block->children[$i + 1])) {
|
4308 |
+
$next = $block->children[$i + 1];
|
4309 |
+
if ($next->depth == max($block->depth, 1) && $child->depth >= $next->depth) {
|
4310 |
+
echo $this->break;
|
4311 |
+
}
|
4312 |
+
}
|
4313 |
+
}
|
4314 |
+
}
|
4315 |
+
|
4316 |
+
if (!empty($block->selectors)) {
|
4317 |
+
$this->indentLevel--;
|
4318 |
+
echo $this->close;
|
4319 |
+
}
|
4320 |
+
|
4321 |
+
if ($block->type == "root") {
|
4322 |
+
echo $this->break;
|
4323 |
+
}
|
4324 |
+
}
|
4325 |
+
}
|
4326 |
+
|
4327 |
+
/**
|
4328 |
+
* SCSS compressed formatter
|
4329 |
+
*
|
4330 |
+
* @author Leaf Corcoran <leafot@gmail.com>
|
4331 |
+
*/
|
4332 |
+
class scss_formatter_compressed extends scss_formatter {
|
4333 |
+
public $open = "{";
|
4334 |
+
public $tagSeparator = ",";
|
4335 |
+
public $assignSeparator = ":";
|
4336 |
+
public $break = "";
|
4337 |
+
|
4338 |
+
public function indentStr($n = 0) {
|
4339 |
+
return "";
|
4340 |
+
}
|
4341 |
+
}
|
4342 |
+
|
4343 |
+
/**
|
4344 |
+
* SCSS server
|
4345 |
+
*
|
4346 |
+
* @author Leaf Corcoran <leafot@gmail.com>
|
4347 |
+
*/
|
4348 |
+
class scss_server {
|
4349 |
+
/**
|
4350 |
+
* Join path components
|
4351 |
+
*
|
4352 |
+
* @param string $left Path component, left of the directory separator
|
4353 |
+
* @param string $right Path component, right of the directory separator
|
4354 |
+
*
|
4355 |
+
* @return string
|
4356 |
+
*/
|
4357 |
+
protected function join($left, $right) {
|
4358 |
+
return rtrim($left, '/\\') . DIRECTORY_SEPARATOR . ltrim($right, '/\\');
|
4359 |
+
}
|
4360 |
+
|
4361 |
+
/**
|
4362 |
+
* Get name of requested .scss file
|
4363 |
+
*
|
4364 |
+
* @return string|null
|
4365 |
+
*/
|
4366 |
+
protected function inputName() {
|
4367 |
+
switch (true) {
|
4368 |
+
case isset($_GET['p']):
|
4369 |
+
return $_GET['p'];
|
4370 |
+
case isset($_SERVER['PATH_INFO']):
|
4371 |
+
return $_SERVER['PATH_INFO'];
|
4372 |
+
case isset($_SERVER['DOCUMENT_URI']):
|
4373 |
+
return substr($_SERVER['DOCUMENT_URI'], strlen($_SERVER['SCRIPT_NAME']));
|
4374 |
+
}
|
4375 |
+
}
|
4376 |
+
|
4377 |
+
/**
|
4378 |
+
* Get path to requested .scss file
|
4379 |
+
*
|
4380 |
+
* @return string
|
4381 |
+
*/
|
4382 |
+
protected function findInput() {
|
4383 |
+
if (($input = $this->inputName())
|
4384 |
+
&& strpos($input, '..') === false
|
4385 |
+
&& substr($input, -5) === '.scss'
|
4386 |
+
) {
|
4387 |
+
$name = $this->join($this->dir, $input);
|
4388 |
+
|
4389 |
+
if (is_file($name) && is_readable($name)) {
|
4390 |
+
return $name;
|
4391 |
+
}
|
4392 |
+
}
|
4393 |
+
|
4394 |
+
return false;
|
4395 |
+
}
|
4396 |
+
|
4397 |
+
/**
|
4398 |
+
* Get path to cached .css file
|
4399 |
+
*
|
4400 |
+
* @return string
|
4401 |
+
*/
|
4402 |
+
protected function cacheName($fname) {
|
4403 |
+
return $this->join($this->cacheDir, md5($fname) . '.css');
|
4404 |
+
}
|
4405 |
+
|
4406 |
+
/**
|
4407 |
+
* Get path to cached imports
|
4408 |
+
*
|
4409 |
+
* @return string
|
4410 |
+
*/
|
4411 |
+
protected function importsCacheName($out) {
|
4412 |
+
return $out . '.imports';
|
4413 |
+
}
|
4414 |
+
|
4415 |
+
/**
|
4416 |
+
* Determine whether .scss file needs to be re-compiled.
|
4417 |
+
*
|
4418 |
+
* @param string $in Input path
|
4419 |
+
* @param string $out Output path
|
4420 |
+
*
|
4421 |
+
* @return boolean True if compile required.
|
4422 |
+
*/
|
4423 |
+
protected function needsCompile($in, $out) {
|
4424 |
+
if (!is_file($out)) return true;
|
4425 |
+
|
4426 |
+
$mtime = filemtime($out);
|
4427 |
+
if (filemtime($in) > $mtime) return true;
|
4428 |
+
|
4429 |
+
// look for modified imports
|
4430 |
+
$icache = $this->importsCacheName($out);
|
4431 |
+
if (is_readable($icache)) {
|
4432 |
+
$imports = unserialize(file_get_contents($icache));
|
4433 |
+
foreach ($imports as $import) {
|
4434 |
+
if (filemtime($import) > $mtime) return true;
|
4435 |
+
}
|
4436 |
+
}
|
4437 |
+
return false;
|
4438 |
+
}
|
4439 |
+
|
4440 |
+
/**
|
4441 |
+
* Get If-Modified-Since header from client request
|
4442 |
+
*
|
4443 |
+
* @return string
|
4444 |
+
*/
|
4445 |
+
protected function getModifiedSinceHeader()
|
4446 |
+
{
|
4447 |
+
$modifiedSince = '';
|
4448 |
+
|
4449 |
+
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
|
4450 |
+
$modifiedSince = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
|
4451 |
+
|
4452 |
+
if (false !== ($semicolonPos = strpos($modifiedSince, ';'))) {
|
4453 |
+
$modifiedSince = substr($modifiedSince, 0, $semicolonPos);
|
4454 |
+
}
|
4455 |
+
}
|
4456 |
+
|
4457 |
+
return $modifiedSince;
|
4458 |
+
}
|
4459 |
+
|
4460 |
+
/**
|
4461 |
+
* Compile .scss file
|
4462 |
+
*
|
4463 |
+
* @param string $in Input path (.scss)
|
4464 |
+
* @param string $out Output path (.css)
|
4465 |
+
*
|
4466 |
+
* @return string
|
4467 |
+
*/
|
4468 |
+
protected function compile($in, $out) {
|
4469 |
+
$start = microtime(true);
|
4470 |
+
$css = $this->scss->compile(file_get_contents($in), $in);
|
4471 |
+
$elapsed = round((microtime(true) - $start), 4);
|
4472 |
+
|
4473 |
+
$v = scssc::$VERSION;
|
4474 |
+
$t = @date('r');
|
4475 |
+
$css = "/* compiled by scssphp $v on $t (${elapsed}s) */\n\n" . $css;
|
4476 |
+
|
4477 |
+
file_put_contents($out, $css);
|
4478 |
+
file_put_contents($this->importsCacheName($out),
|
4479 |
+
serialize($this->scss->getParsedFiles()));
|
4480 |
+
return $css;
|
4481 |
+
}
|
4482 |
+
|
4483 |
+
/**
|
4484 |
+
* Compile requested scss and serve css. Outputs HTTP response.
|
4485 |
+
*
|
4486 |
+
* @param string $salt Prefix a string to the filename for creating the cache name hash
|
4487 |
+
*/
|
4488 |
+
public function serve($salt = '') {
|
4489 |
+
$protocol = isset($_SERVER['SERVER_PROTOCOL'])
|
4490 |
+
? $_SERVER['SERVER_PROTOCOL']
|
4491 |
+
: 'HTTP/1.0';
|
4492 |
+
|
4493 |
+
if ($input = $this->findInput()) {
|
4494 |
+
$output = $this->cacheName($salt . $input);
|
4495 |
+
|
4496 |
+
if ($this->needsCompile($input, $output)) {
|
4497 |
+
try {
|
4498 |
+
$css = $this->compile($input, $output);
|
4499 |
+
|
4500 |
+
$lastModified = gmdate('D, d M Y H:i:s', filemtime($output)) . ' GMT';
|
4501 |
+
|
4502 |
+
header('Last-Modified: ' . $lastModified);
|
4503 |
+
header('Content-type: text/css');
|
4504 |
+
|
4505 |
+
echo $css;
|
4506 |
+
|
4507 |
+
return;
|
4508 |
+
} catch (Exception $e) {
|
4509 |
+
header($protocol . ' 500 Internal Server Error');
|
4510 |
+
header('Content-type: text/plain');
|
4511 |
+
|
4512 |
+
echo 'Parse error: ' . $e->getMessage() . "\n";
|
4513 |
+
}
|
4514 |
+
}
|
4515 |
+
|
4516 |
+
header('X-SCSS-Cache: true');
|
4517 |
+
header('Content-type: text/css');
|
4518 |
+
|
4519 |
+
$modifiedSince = $this->getModifiedSinceHeader();
|
4520 |
+
$mtime = filemtime($output);
|
4521 |
+
|
4522 |
+
if (@strtotime($modifiedSince) === $mtime) {
|
4523 |
+
header($protocol . ' 304 Not Modified');
|
4524 |
+
|
4525 |
+
return;
|
4526 |
+
}
|
4527 |
+
|
4528 |
+
$lastModified = gmdate('D, d M Y H:i:s', $mtime) . ' GMT';
|
4529 |
+
header('Last-Modified: ' . $lastModified);
|
4530 |
+
|
4531 |
+
echo file_get_contents($output);
|
4532 |
+
|
4533 |
+
return;
|
4534 |
+
}
|
4535 |
+
|
4536 |
+
header($protocol . ' 404 Not Found');
|
4537 |
+
header('Content-type: text/plain');
|
4538 |
+
|
4539 |
+
$v = scssc::$VERSION;
|
4540 |
+
echo "/* INPUT NOT FOUND scss $v */\n";
|
4541 |
+
}
|
4542 |
+
|
4543 |
+
/**
|
4544 |
+
* Constructor
|
4545 |
+
*
|
4546 |
+
* @param string $dir Root directory to .scss files
|
4547 |
+
* @param string $cacheDir Cache directory
|
4548 |
+
* @param \scssc|null $scss SCSS compiler instance
|
4549 |
+
*/
|
4550 |
+
public function __construct($dir, $cacheDir=null, $scss=null) {
|
4551 |
+
$this->dir = $dir;
|
4552 |
+
|
4553 |
+
if (!isset($cacheDir)) {
|
4554 |
+
$cacheDir = $this->join($dir, 'scss_cache');
|
4555 |
+
}
|
4556 |
+
|
4557 |
+
$this->cacheDir = $cacheDir;
|
4558 |
+
if (!is_dir($this->cacheDir)) mkdir($this->cacheDir, 0755, true);
|
4559 |
+
|
4560 |
+
if (!isset($scss)) {
|
4561 |
+
$scss = new scssc();
|
4562 |
+
$scss->setImportPaths($this->dir);
|
4563 |
+
}
|
4564 |
+
$this->scss = $scss;
|
4565 |
+
}
|
4566 |
+
|
4567 |
+
/**
|
4568 |
+
* Helper method to serve compiled scss
|
4569 |
+
*
|
4570 |
+
* @param string $path Root path
|
4571 |
+
*/
|
4572 |
+
static public function serveFrom($path) {
|
4573 |
+
$server = new self($path);
|
4574 |
+
$server->serve();
|
4575 |
+
}
|
4576 |
+
}
|
src/app/Mappers/scssphp/tests/ApiTest.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once __DIR__ . "/../scss.inc.php";
|
4 |
+
|
5 |
+
class ApiTest extends PHPUnit_Framework_TestCase
|
6 |
+
{
|
7 |
+
public function setUp()
|
8 |
+
{
|
9 |
+
$this->scss = new scssc();
|
10 |
+
}
|
11 |
+
|
12 |
+
public function testUserFunction()
|
13 |
+
{
|
14 |
+
$this->scss->registerFunction("add-two", function ($args) {
|
15 |
+
list($a, $b) = $args;
|
16 |
+
return $a[1] + $b[1];
|
17 |
+
});
|
18 |
+
|
19 |
+
$this->assertEquals(
|
20 |
+
"result: 30;",
|
21 |
+
$this->compile("result: add-two(10, 20);")
|
22 |
+
);
|
23 |
+
}
|
24 |
+
|
25 |
+
public function testImportMissing()
|
26 |
+
{
|
27 |
+
$this->assertEquals(
|
28 |
+
'@import "missing";',
|
29 |
+
$this->compile('@import "missing";')
|
30 |
+
);
|
31 |
+
}
|
32 |
+
|
33 |
+
public function testImportCustomCallback()
|
34 |
+
{
|
35 |
+
$this->scss->addImportPath(function ($path) {
|
36 |
+
return __DIR__ . '/inputs/' . str_replace('.css', '.scss', $path);
|
37 |
+
});
|
38 |
+
|
39 |
+
$this->assertEquals(
|
40 |
+
trim(file_get_contents(__DIR__ . '/outputs/variables.css')),
|
41 |
+
$this->compile('@import "variables.css";')
|
42 |
+
);
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* @dataProvider provideSetVariables
|
47 |
+
*/
|
48 |
+
public function testSetVariables($expected, $scss, $variables)
|
49 |
+
{
|
50 |
+
$this->scss->setVariables($variables);
|
51 |
+
|
52 |
+
$this->assertEquals($expected, $this->compile($scss));
|
53 |
+
}
|
54 |
+
|
55 |
+
public function provideSetVariables()
|
56 |
+
{
|
57 |
+
return array(
|
58 |
+
array(
|
59 |
+
".magic {\n color: red;\n width: 760px; }",
|
60 |
+
'.magic { color: $color; width: $base - 200; }',
|
61 |
+
array(
|
62 |
+
'color' => 'red',
|
63 |
+
'base' => '960px',
|
64 |
+
),
|
65 |
+
),
|
66 |
+
array(
|
67 |
+
".logo {\n color: #808080; }",
|
68 |
+
'.logo { color: desaturate($primary, 100%); }',
|
69 |
+
array(
|
70 |
+
'primary' => '#ff0000',
|
71 |
+
),
|
72 |
+
),
|
73 |
+
);
|
74 |
+
}
|
75 |
+
|
76 |
+
public function compile($str)
|
77 |
+
{
|
78 |
+
return trim($this->scss->compile($str));
|
79 |
+
}
|
80 |
+
}
|
src/app/Mappers/scssphp/tests/ExceptionTest.php
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once __DIR__ . "/../scss.inc.php";
|
4 |
+
|
5 |
+
class ExceptionTest extends PHPUnit_Framework_TestCase {
|
6 |
+
public function setUp() {
|
7 |
+
$this->scss = new scssc();
|
8 |
+
}
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @param string $scss
|
12 |
+
* @param string $expectedExceptionMessage
|
13 |
+
*
|
14 |
+
* @dataProvider provideScss
|
15 |
+
*/
|
16 |
+
public function testThrowError($scss, $expectedExceptionMessage) {
|
17 |
+
try {
|
18 |
+
$this->compile($scss);
|
19 |
+
} catch (Exception $e) {
|
20 |
+
if (strpos($e->getMessage(), $expectedExceptionMessage) !== false) {
|
21 |
+
return;
|
22 |
+
};
|
23 |
+
}
|
24 |
+
|
25 |
+
$this->fail('Expected exception to be raised: ' . $expectedExceptionMessage);
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @return array
|
30 |
+
*/
|
31 |
+
public function provideScss() {
|
32 |
+
return array(
|
33 |
+
array(<<<END_OF_SCSS
|
34 |
+
.test {
|
35 |
+
foo : bar;
|
36 |
+
END_OF_SCSS
|
37 |
+
,
|
38 |
+
'unclosed block'
|
39 |
+
),
|
40 |
+
array(<<<END_OF_SCSS
|
41 |
+
.test {
|
42 |
+
}}
|
43 |
+
END_OF_SCSS
|
44 |
+
,
|
45 |
+
'unexpected }'
|
46 |
+
),
|
47 |
+
array(<<<END_OF_SCSS
|
48 |
+
.test { color: #fff / 0; }
|
49 |
+
END_OF_SCSS
|
50 |
+
,
|
51 |
+
'color: Can\'t divide by zero'
|
52 |
+
),
|
53 |
+
array(<<<END_OF_SCSS
|
54 |
+
.test {
|
55 |
+
@include foo();
|
56 |
+
}
|
57 |
+
END_OF_SCSS
|
58 |
+
,
|
59 |
+
'Undefined mixin foo'
|
60 |
+
),
|
61 |
+
array(<<<END_OF_SCSS
|
62 |
+
@mixin do-nothing() {
|
63 |
+
}
|
64 |
+
|
65 |
+
.test {
|
66 |
+
@include do-nothing(\$a: "hello");
|
67 |
+
}
|
68 |
+
END_OF_SCSS
|
69 |
+
,
|
70 |
+
'Mixin or function doesn\'t have an argument named $a.'
|
71 |
+
),
|
72 |
+
array(<<<END_OF_SCSS
|
73 |
+
div {
|
74 |
+
color: darken(cobaltgreen, 10%);
|
75 |
+
}
|
76 |
+
END_OF_SCSS
|
77 |
+
,
|
78 |
+
'expecting color'
|
79 |
+
),
|
80 |
+
);
|
81 |
+
}
|
82 |
+
|
83 |
+
private function compile($str) {
|
84 |
+
return trim($this->scss->compile($str));
|
85 |
+
}
|
86 |
+
}
|
src/app/Mappers/scssphp/tests/InputTest.php
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once __DIR__ . "/../scss.inc.php";
|
4 |
+
|
5 |
+
// Runs all the tests in inputs/ and compares their output to ouputs/
|
6 |
+
|
7 |
+
function _dump($value) {
|
8 |
+
fwrite(STDOUT, print_r($value, true));
|
9 |
+
}
|
10 |
+
|
11 |
+
function _quote($str) {
|
12 |
+
return preg_quote($str, "/");
|
13 |
+
}
|
14 |
+
|
15 |
+
class InputTest extends PHPUnit_Framework_TestCase {
|
16 |
+
protected static $inputDir = "inputs";
|
17 |
+
protected static $outputDir = "outputs";
|
18 |
+
|
19 |
+
public function setUp() {
|
20 |
+
$this->scss = new scssc();
|
21 |
+
$this->scss->addImportPath(__DIR__ . "/" . self::$inputDir);
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @dataProvider fileNameProvider
|
26 |
+
*/
|
27 |
+
public function testInputFile($inFname, $outFname) {
|
28 |
+
if (getenv("BUILD")) {
|
29 |
+
return $this->buildInput($inFname,$outFname);
|
30 |
+
}
|
31 |
+
|
32 |
+
if (!is_readable($outFname)) {
|
33 |
+
$this->fail("$outFname is missing, ".
|
34 |
+
"consider building tests with BUILD=true");
|
35 |
+
}
|
36 |
+
|
37 |
+
$input = file_get_contents($inFname);
|
38 |
+
$output = file_get_contents($outFname);
|
39 |
+
|
40 |
+
$this->assertEquals($output, $this->scss->compile($input));
|
41 |
+
}
|
42 |
+
|
43 |
+
public function fileNameProvider() {
|
44 |
+
return array_map(function($a) { return array($a, InputTest::outputNameFor($a)); },
|
45 |
+
self::findInputNames());
|
46 |
+
}
|
47 |
+
|
48 |
+
// only run when env is set
|
49 |
+
public function buildInput($inFname, $outFname) {
|
50 |
+
$css = $this->scss->compile(file_get_contents($inFname));
|
51 |
+
file_put_contents($outFname, $css);
|
52 |
+
}
|
53 |
+
|
54 |
+
static public function findInputNames($pattern="*") {
|
55 |
+
$files = glob(__DIR__ . "/" . self::$inputDir . "/" . $pattern);
|
56 |
+
$files = array_filter($files, "is_file");
|
57 |
+
if ($pattern = getenv("MATCH")) {
|
58 |
+
$files = array_filter($files, function($fname) use ($pattern) {
|
59 |
+
return preg_match("/$pattern/", $fname);
|
60 |
+
});
|
61 |
+
}
|
62 |
+
|
63 |
+
return $files;
|
64 |
+
}
|
65 |
+
|
66 |
+
static public function outputNameFor($input) {
|
67 |
+
$front = _quote(__DIR__ . "/");
|
68 |
+
$out = preg_replace("/^$front/", "", $input);
|
69 |
+
|
70 |
+
$in = _quote(self::$inputDir . "/");
|
71 |
+
$out = preg_replace("/$in/", self::$outputDir . "/", $out);
|
72 |
+
$out = preg_replace("/.scss$/", ".css", $out);
|
73 |
+
|
74 |
+
return __DIR__ . "/" . $out;
|
75 |
+
}
|
76 |
+
|
77 |
+
static public function buildTests($pattern) {
|
78 |
+
$files = self::findInputNames($pattern);
|
79 |
+
foreach ($files as $file) {
|
80 |
+
}
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
src/app/Mappers/scssphp/tests/compare-scss.sh
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
diff_tool="$1"
|
4 |
+
|
5 |
+
for file in $(ls inputs/*.scss); do
|
6 |
+
out_file=$(echo $file | sed -e 's/inputs/outputs/' -e 's/\.scss$/\.css/')
|
7 |
+
sass=$(scss < $file 2> /dev/null)
|
8 |
+
if [ $? = "0" ]; then
|
9 |
+
# echo $file
|
10 |
+
# echo "$sass"
|
11 |
+
# echo
|
12 |
+
|
13 |
+
if [ "$(cat $out_file)" != "$sass" ]; then
|
14 |
+
echo "* [FAIL] $file"
|
15 |
+
if [ -n "$diff_tool" ]; then
|
16 |
+
$diff_tool $out_file <(echo "$sass") 2> /dev/null
|
17 |
+
fi
|
18 |
+
else
|
19 |
+
echo " [PASS] $file"
|
20 |
+
fi
|
21 |
+
else
|
22 |
+
echo " $file"
|
23 |
+
fi
|
24 |
+
done
|
25 |
+
|
src/app/Mappers/scssphp/tests/inputs/builtins.scss
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
#color {
|
3 |
+
color: rgb(34,234,24);
|
4 |
+
|
5 |
+
red: red(rgb(34,234,24));
|
6 |
+
green: green(rgb(34,234,24));
|
7 |
+
blue: blue(rgb(34,234,24));
|
8 |
+
|
9 |
+
color: rgba(1,2,4, 0.5);
|
10 |
+
a1: alpha(rgb(1,2,4));
|
11 |
+
a2: alpha(rgba(1,2,4, 0.5));
|
12 |
+
|
13 |
+
mix: mix(rgb(1,2,3), rgb(3,4,5));
|
14 |
+
|
15 |
+
rgba: rgba($color: #a7c, $alpha: 0.4);
|
16 |
+
rgba: rgba(#a7c, 0.4);
|
17 |
+
}
|
18 |
+
|
19 |
+
#hsl {
|
20 |
+
color: hsl(100, 50, 55);
|
21 |
+
color: hsla(100, 50, 55, 0.5);
|
22 |
+
|
23 |
+
hue: hue(hsl(100, 50, 55));
|
24 |
+
sat: saturation(hsl(100, 50, 55));
|
25 |
+
lig: lightness(hsl(100, 50, 55));
|
26 |
+
}
|
27 |
+
|
28 |
+
#more-color {
|
29 |
+
$color: hsl(-80,44,33);
|
30 |
+
|
31 |
+
light: lighten($color, 10%);
|
32 |
+
dark: darken($color, 10%);
|
33 |
+
|
34 |
+
sat: saturate($color, 10%);
|
35 |
+
desat: desaturate($color, 10%);
|
36 |
+
|
37 |
+
gray: grayscale($color);
|
38 |
+
comp: complement($color);
|
39 |
+
inv: invert($color);
|
40 |
+
}
|
41 |
+
|
42 |
+
#more-more-color {
|
43 |
+
$color: rgba(1,2,3,0.5);
|
44 |
+
op: opacity($color);
|
45 |
+
|
46 |
+
opacify: opacify($color, 0.1);
|
47 |
+
opacify: fade-in($color, 0.1);
|
48 |
+
|
49 |
+
transparentize: transparentize($color, 0.1);
|
50 |
+
transparentize: fade-out($color, 0.1);
|
51 |
+
transparentize: transparentize(#348203, 0.1);
|
52 |
+
}
|
53 |
+
|
54 |
+
#more-more-more-color {
|
55 |
+
$color: rgba(10,10,10,0);
|
56 |
+
color: adjust-color($color, $blue: 69, $red: 55, $green: 100, $alpha: 0.4);
|
57 |
+
color: adjust-color($color, $hue: 170, $saturation: 100, $lightness: 50);
|
58 |
+
|
59 |
+
color: change-color($color, $blue: 69, $red: 55, $green: 100, $alpha: 0.4);
|
60 |
+
color: change-color($color, $hue: 170, $saturation: 100, $lightness: 50);
|
61 |
+
|
62 |
+
color: scale-color($color, $red: 55%);
|
63 |
+
color: scale-color($color, $red: -55%);
|
64 |
+
|
65 |
+
color: scale-color($color, $lightness: 55%);
|
66 |
+
color: scale-color($color, $lightness: -55%);
|
67 |
+
|
68 |
+
color: ie-hex-str($color);
|
69 |
+
color: ie-hex-str(#abc);
|
70 |
+
}
|
71 |
+
|
72 |
+
#string {
|
73 |
+
color: unquote("hello what is going on");
|
74 |
+
// color: quote(yeah you know it); // **
|
75 |
+
color: quote(yeah);
|
76 |
+
color: quote("I do?");
|
77 |
+
}
|
78 |
+
|
79 |
+
#number {
|
80 |
+
color: percentage(100/40);
|
81 |
+
color: round(3.4);
|
82 |
+
color: floor(3.4);
|
83 |
+
color: ceil(3.4);
|
84 |
+
|
85 |
+
top: floor(10.4px);
|
86 |
+
top: ceil(.4ex);
|
87 |
+
width: percentage(100px / 50px);
|
88 |
+
bottom: abs(-10px);
|
89 |
+
padding: min(5em, 3em, 4em) max(2px, 1in) min(1in, 96px) max(1in, 72pt);
|
90 |
+
}
|
91 |
+
|
92 |
+
#list {
|
93 |
+
len: length(hello world what);
|
94 |
+
len: length(thing);
|
95 |
+
|
96 |
+
n: nth(hello world what, 1);
|
97 |
+
// n: nth(hello world what, 100); // **
|
98 |
+
|
99 |
+
hello: join(one two three, hello, comma);
|
100 |
+
hello: join(one two three, hello world what is going, comma);
|
101 |
+
hello: append(one two three, hello, comma);
|
102 |
+
|
103 |
+
index: index(1px solid red, solid);
|
104 |
+
index: index(1px solid red, dashed);
|
105 |
+
index: index(1px solid red, #f00);
|
106 |
+
index: index(96px solid red, 1in);
|
107 |
+
index: index((1in 2) a b, 1in);
|
108 |
+
index: index((1in 2) a b, (96px 2));
|
109 |
+
index: index((1in 2) a b, (1in, 2));
|
110 |
+
index: index((1px solid red), solid);
|
111 |
+
index: index(1px 3px + 3px, 4+2px);
|
112 |
+
$var: oo;
|
113 |
+
index: index(foo bar, f#{$var});
|
114 |
+
|
115 |
+
$yes: one, two, three;
|
116 |
+
$no: great job;
|
117 |
+
world: join($yes, $no);
|
118 |
+
world: append($yes, $no);
|
119 |
+
|
120 |
+
cool: join($yes, $no, space);
|
121 |
+
cool: join($no, $yes);
|
122 |
+
|
123 |
+
zip: zip((1px, 2px), (solid dashed));
|
124 |
+
zip: zip(1px 2px 3px, solid dashed, red green blue);
|
125 |
+
}
|
126 |
+
|
127 |
+
#introspection {
|
128 |
+
t: type-of(100px);
|
129 |
+
t: type-of(asdf);
|
130 |
+
t: type-of("asdf");
|
131 |
+
t: type-of(true);
|
132 |
+
t: type-of(#fff);
|
133 |
+
t: type-of(blue);
|
134 |
+
t: type-of(one two three);
|
135 |
+
|
136 |
+
u: unit(12);
|
137 |
+
u: unit(12px);
|
138 |
+
u: unit(12em);
|
139 |
+
|
140 |
+
l: unitless(23);
|
141 |
+
l: unitless(23deg);
|
142 |
+
|
143 |
+
c: comparable(2px, 1px);
|
144 |
+
c: comparable(100px, 3em);
|
145 |
+
c: comparable(10cm, 3mm);
|
146 |
+
c: comparable(1, 4);
|
147 |
+
c: comparable(1ex, 4em);
|
148 |
+
c: comparable(2em, 5em);
|
149 |
+
}
|
150 |
+
|
151 |
+
#if {
|
152 |
+
color: if(true, yes, no);
|
153 |
+
color: if(false, yes, no);
|
154 |
+
color: if(false or true, yes, no);
|
155 |
+
color: if(10px, yes, no);
|
156 |
+
}
|
157 |
+
|
158 |
+
.transparent {
|
159 |
+
r: red(transparent);
|
160 |
+
g: green(transparent);
|
161 |
+
b: blue(transparent);
|
162 |
+
a: alpha(transparent);
|
163 |
+
}
|
164 |
+
|
165 |
+
.alpha {
|
166 |
+
a: alpha(black);
|
167 |
+
a: alpha(#fff);
|
168 |
+
a: alpha(rgb(0, 0, 0));
|
169 |
+
a: alpha(rgba(0, 0, 0, 0.5));
|
170 |
+
a: alpha(currentColor);
|
171 |
+
}
|
src/app/Mappers/scssphp/tests/inputs/comments.scss
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
// what is going on?
|
3 |
+
|
4 |
+
/** what the heck **/
|
5 |
+
|
6 |
+
/**
|
7 |
+
|
8 |
+
Here is a block comment
|
9 |
+
|
10 |
+
**/
|
11 |
+
|
12 |
+
|
13 |
+
// this is a comment
|
14 |
+
|
15 |
+
// trailing backslash \
|
16 |
+
/*hello*/div /*yeah*/ { //surew
|
17 |
+
border: 1px solid red; // world
|
18 |
+
/* another property */
|
19 |
+
color: url('http://mage-page.com');
|
20 |
+
string: "hello /* this is not a comment */";
|
21 |
+
world: "// neither is this";
|
22 |
+
string: 'hello /* this is not a comment */' /*what if this is a comment */;
|
23 |
+
world: '// neither is this' // hell world;
|
24 |
+
;
|
25 |
+
what-ever: 100px;
|
26 |
+
background: url(/*this is not a comment?*/); // uhh what happens here
|
27 |
+
}
|
28 |
+
|
src/app/Mappers/scssphp/tests/inputs/compass_extract.scss
ADDED
@@ -0,0 +1,248 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Extracted from compass/typography/vertical_rhythm.scss
|
2 |
+
|
3 |
+
|
4 |
+
// The base font size.
|
5 |
+
$base-font-size: 16px !default;
|
6 |
+
|
7 |
+
// The base line height determines the basic unit of vertical rhythm.
|
8 |
+
$base-line-height: 24px !default;
|
9 |
+
|
10 |
+
// Set the default border style for rhythm borders.
|
11 |
+
$default-rhythm-border-style: solid !default;
|
12 |
+
|
13 |
+
// The default font size in all browsers.
|
14 |
+
$browser-default-font-size: 16px;
|
15 |
+
|
16 |
+
// Set to false if you want to use absolute pixels in sizing your typography.
|
17 |
+
$relative-font-sizing: true !default;
|
18 |
+
|
19 |
+
// Allows the `adjust-font-size-to` mixin and the `lines-for-font-size` function
|
20 |
+
// to round the line height to the nearest half line height instead of the
|
21 |
+
// nearest integral line height to avoid large spacing between lines.
|
22 |
+
$round-to-nearest-half-line: false !default;
|
23 |
+
|
24 |
+
// Ensure there is at least this many pixels
|
25 |
+
// of vertical padding above and below the text.
|
26 |
+
$min-line-padding: 2px !default;
|
27 |
+
|
28 |
+
// $base-font-size but in your output unit of choice.
|
29 |
+
// Defaults to 1em when `$relative-font-sizing` is true.
|
30 |
+
$font-unit: if($relative-font-sizing, 1em, $base-font-size) !default;
|
31 |
+
|
32 |
+
// The basic unit of font rhythm.
|
33 |
+
$base-rhythm-unit: $base-line-height / $base-font-size * $font-unit;
|
34 |
+
|
35 |
+
// The leader is the amount of whitespace in a line.
|
36 |
+
// It might be useful in your calculations.
|
37 |
+
$base-leader: ($base-line-height - $base-font-size) * $font-unit / $base-font-size;
|
38 |
+
|
39 |
+
// The half-leader is the amount of whitespace above and below a line.
|
40 |
+
// It might be useful in your calculations.
|
41 |
+
$base-half-leader: $base-leader / 2;
|
42 |
+
|
43 |
+
// True if a number has a relative unit.
|
44 |
+
@function relative-unit($number) {
|
45 |
+
@return unit($number) == "%" or unit($number) == "em" or unit($number) == "rem"
|
46 |
+
}
|
47 |
+
|
48 |
+
// True if a number has an absolute unit.
|
49 |
+
@function absolute-unit($number) {
|
50 |
+
@return not (relative-unit($number) or unitless($number));
|
51 |
+
}
|
52 |
+
|
53 |
+
@if $relative-font-sizing and not relative-unit($font-unit) {
|
54 |
+
@warn "$relative-font-sizing is true but $font-unit is set to #{$font-unit} which is not a relative unit.";
|
55 |
+
}
|
56 |
+
|
57 |
+
// Establishes a font baseline for the given font-size.
|
58 |
+
@mixin establish-baseline($font-size: $base-font-size) {
|
59 |
+
// IE 6 refuses to resize fonts set in pixels and it weirdly resizes fonts
|
60 |
+
// whose root is set in ems. So we set the root font size in percentages of
|
61 |
+
// the default font size.
|
62 |
+
* html {
|
63 |
+
font-size: 100% * ($font-size / $browser-default-font-size);
|
64 |
+
}
|
65 |
+
html {
|
66 |
+
font-size: $font-size;
|
67 |
+
@include adjust-leading-to(1, if($relative-font-sizing, $font-size, $base-font-size));
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
// Resets the line-height to 1 vertical rhythm unit.
|
72 |
+
// Does not work on elements whose font-size is different from $base-font-size.
|
73 |
+
//
|
74 |
+
// @deprecated This mixin will be removed in the next release.
|
75 |
+
// Please use the `adjust-leading-to` mixin instead.
|
76 |
+
@mixin reset-baseline {
|
77 |
+
@include adjust-leading-to(1, if($relative-font-sizing, $base-font-size, $base-font-size));
|
78 |
+
}
|
79 |
+
|
80 |
+
// Show a background image that can be used to debug your alignments.
|
81 |
+
// Include the $img argument if you would rather use your own image than the
|
82 |
+
// Compass default gradient image.
|
83 |
+
@mixin debug-vertical-alignment($img: false) {
|
84 |
+
@if $img {
|
85 |
+
background: image-url($img);
|
86 |
+
} @else {
|
87 |
+
@include baseline-grid-background($base-rhythm-unit);
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
// Adjust a block to have a different font size and line height to maintain the
|
92 |
+
// rhythm. $lines specifies how many multiples of the baseline rhythm each line
|
93 |
+
// of this font should use up. It does not have to be an integer, but it
|
94 |
+
// defaults to the smallest integer that is large enough to fit the font.
|
95 |
+
// Use $from-size to adjust from a font-size other than the base font-size.
|
96 |
+
@mixin adjust-font-size-to($to-size, $lines: lines-for-font-size($to-size), $from-size: $base-font-size) {
|
97 |
+
@if not $relative-font-sizing and $from-size != $base-font-size {
|
98 |
+
@warn "$relative-font-sizing is false but a relative font size was passed to adjust-font-size-to";
|
99 |
+
}
|
100 |
+
font-size: $font-unit * $to-size / $from-size;
|
101 |
+
@include adjust-leading-to($lines, if($relative-font-sizing, $to-size, $base-font-size));
|
102 |
+
}
|
103 |
+
|
104 |
+
// Adjust a block to have different line height to maintain the rhythm.
|
105 |
+
// $lines specifies how many multiples of the baseline rhythm each line of this
|
106 |
+
// font should use up. It does not have to be an integer, but it defaults to the
|
107 |
+
// smallest integer that is large enough to fit the font.
|
108 |
+
@mixin adjust-leading-to($lines, $font-size: $base-font-size) {
|
109 |
+
line-height: rhythm($lines, $font-size);
|
110 |
+
}
|
111 |
+
|
112 |
+
// Calculate rhythm units.
|
113 |
+
@function rhythm(
|
114 |
+
$lines: 1,
|
115 |
+
$font-size: $base-font-size,
|
116 |
+
$offset: 0
|
117 |
+
) {
|
118 |
+
@if not $relative-font-sizing and $font-size != $base-font-size {
|
119 |
+
@warn "$relative-font-sizing is false but a relative font size was passed to the rhythm function";
|
120 |
+
}
|
121 |
+
$rhythm: $font-unit * ($lines * $base-line-height - $offset) / $font-size;
|
122 |
+
// Round the pixels down to nearest integer.
|
123 |
+
@if unit($rhythm) == px {
|
124 |
+
$rhythm: floor($rhythm);
|
125 |
+
}
|
126 |
+
@return $rhythm;
|
127 |
+
}
|
128 |
+
|
129 |
+
// Calculate the minimum multiple of rhythm units needed to contain the font-size.
|
130 |
+
@function lines-for-font-size($font-size) {
|
131 |
+
$lines: if($round-to-nearest-half-line,
|
132 |
+
ceil(2 * $font-size / $base-line-height) / 2,
|
133 |
+
ceil($font-size / $base-line-height));
|
134 |
+
@if $lines * $base-line-height - $font-size < $min-line-padding * 2 {
|
135 |
+
$lines: $lines + if($round-to-nearest-half-line, 0.5, 1);
|
136 |
+
}
|
137 |
+
@return $lines;
|
138 |
+
}
|
139 |
+
|
140 |
+
// Apply leading whitespace. The $property can be margin or padding.
|
141 |
+
@mixin leader($lines: 1, $font-size: $base-font-size, $property: margin) {
|
142 |
+
#{$property}-top: rhythm($lines, $font-size);
|
143 |
+
}
|
144 |
+
|
145 |
+
// Apply leading whitespace as padding.
|
146 |
+
@mixin padding-leader($lines: 1, $font-size: $base-font-size) {
|
147 |
+
padding-top: rhythm($lines, $font-size);
|
148 |
+
}
|
149 |
+
|
150 |
+
// Apply leading whitespace as margin.
|
151 |
+
@mixin margin-leader($lines: 1, $font-size: $base-font-size) {
|
152 |
+
margin-top: rhythm($lines, $font-size);
|
153 |
+
}
|
154 |
+
|
155 |
+
// Apply trailing whitespace. The $property can be margin or padding.
|
156 |
+
@mixin trailer($lines: 1, $font-size: $base-font-size, $property: margin) {
|
157 |
+
#{$property}-bottom: rhythm($lines, $font-size);
|
158 |
+
}
|
159 |
+
|
160 |
+
// Apply trailing whitespace as padding.
|
161 |
+
@mixin padding-trailer($lines: 1, $font-size: $base-font-size) {
|
162 |
+
padding-bottom: rhythm($lines, $font-size);
|
163 |
+
}
|
164 |
+
|
165 |
+
// Apply trailing whitespace as margin.
|
166 |
+
@mixin margin-trailer($lines: 1, $font-size: $base-font-size) {
|
167 |
+
margin-bottom: rhythm($lines, $font-size);
|
168 |
+
}
|
169 |
+
|
170 |
+
// Shorthand mixin to apply whitespace for top and bottom margins and padding.
|
171 |
+
@mixin rhythm($leader: 0, $padding-leader: 0, $padding-trailer: 0, $trailer: 0, $font-size: $base-font-size) {
|
172 |
+
@include leader($leader, $font-size);
|
173 |
+
@include padding-leader($padding-leader, $font-size);
|
174 |
+
@include padding-trailer($padding-trailer, $font-size);
|
175 |
+
@include trailer($trailer, $font-size);
|
176 |
+
}
|
177 |
+
|
178 |
+
// Apply a border and whitespace to any side without destroying the vertical
|
179 |
+
// rhythm. The whitespace must be greater than the width of the border.
|
180 |
+
@mixin apply-side-rhythm-border($side, $width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) {
|
181 |
+
@if not $relative-font-sizing and $font-size != $base-font-size {
|
182 |
+
@warn "$relative-font-sizing is false but a relative font size was passed to apply-side-rhythm-border";
|
183 |
+
}
|
184 |
+
border-#{$side}: {
|
185 |
+
style: $border-style;
|
186 |
+
width: $font-unit * $width / $font-size;
|
187 |
+
};
|
188 |
+
padding-#{$side}: rhythm($lines, $font-size, $offset: $width);
|
189 |
+
}
|
190 |
+
|
191 |
+
// Apply borders and whitespace equally to all sides.
|
192 |
+
@mixin rhythm-borders($width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) {
|
193 |
+
@if not $relative-font-sizing and $font-size != $base-font-size {
|
194 |
+
@warn "$relative-font-sizing is false but a relative font size was passed to rhythm-borders";
|
195 |
+
}
|
196 |
+
border: {
|
197 |
+
style: $border-style;
|
198 |
+
width: $font-unit * $width / $font-size;
|
199 |
+
};
|
200 |
+
padding: rhythm($lines, $font-size, $offset: $width);
|
201 |
+
}
|
202 |
+
|
203 |
+
// Apply a leading border.
|
204 |
+
@mixin leading-border($width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) {
|
205 |
+
@include apply-side-rhythm-border(top, $width, $lines, $font-size, $border-style);
|
206 |
+
}
|
207 |
+
|
208 |
+
// Apply a trailing border.
|
209 |
+
@mixin trailing-border($width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) {
|
210 |
+
@include apply-side-rhythm-border(bottom, $width, $lines, $font-size, $border-style);
|
211 |
+
}
|
212 |
+
|
213 |
+
// Apply both leading and trailing borders.
|
214 |
+
@mixin horizontal-borders($width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) {
|
215 |
+
@include leading-border($width, $lines, $font-size, $border-style);
|
216 |
+
@include trailing-border($width, $lines, $font-size, $border-style);
|
217 |
+
}
|
218 |
+
|
219 |
+
// Alias for `horizontal-borders` mixin.
|
220 |
+
@mixin h-borders($width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) {
|
221 |
+
@include horizontal-borders($width, $lines, $font-size, $border-style);
|
222 |
+
}
|
223 |
+
|
224 |
+
#test-0 {
|
225 |
+
unit: relative-unit(10px);
|
226 |
+
unit: relative-unit(50%);
|
227 |
+
rhythm: rhythm();
|
228 |
+
size: lines-for-font-size(15px);
|
229 |
+
size: lines-for-font-size(16px);
|
230 |
+
size: lines-for-font-size(17px);
|
231 |
+
size: lines-for-font-size(27px);
|
232 |
+
size: lines-for-font-size(37px);
|
233 |
+
}
|
234 |
+
|
235 |
+
|
236 |
+
#test-1 {
|
237 |
+
@include rhythm(5, 6, 7);
|
238 |
+
}
|
239 |
+
|
240 |
+
#test-2 {
|
241 |
+
@include rhythm-borders;
|
242 |
+
}
|
243 |
+
|
244 |
+
#test-3 {
|
245 |
+
@include horizontal-borders;
|
246 |
+
}
|
247 |
+
|
248 |
+
|
src/app/Mappers/scssphp/tests/inputs/content.scss
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
@mixin apply-to-ie6-only {
|
3 |
+
* html {
|
4 |
+
@content;
|
5 |
+
}
|
6 |
+
}
|
7 |
+
@include apply-to-ie6-only {
|
8 |
+
#logo {
|
9 |
+
background-image: url(/logo.gif);
|
10 |
+
}
|
11 |
+
}
|
12 |
+
|
13 |
+
|
14 |
+
$color: white;
|
15 |
+
@mixin colors($color: blue) {
|
16 |
+
background-color: $color;
|
17 |
+
@content;
|
18 |
+
border-color: $color;
|
19 |
+
}
|
20 |
+
.colors {
|
21 |
+
@include colors { color: $color; }
|
22 |
+
}
|
23 |
+
|
24 |
+
|
25 |
+
@mixin iphone {
|
26 |
+
@media only screen and (max-width: 480px) {
|
27 |
+
@content;
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
@include iphone {
|
32 |
+
body { color: red }
|
33 |
+
}
|
34 |
+
|
35 |
+
|
36 |
+
#sidebar {
|
37 |
+
$sidebar-width: 300px;
|
38 |
+
width: $sidebar-width;
|
39 |
+
@include iphone {
|
40 |
+
width: $sidebar-width / 3;
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
|
45 |
+
@mixin respond-to($width) {
|
46 |
+
@media only screen and (min-width: $width) { @content; }
|
47 |
+
}
|
48 |
+
|
49 |
+
@include respond-to(40em) {
|
50 |
+
@for $i from 1 through 2 {
|
51 |
+
.grid-#{$i} { width: 100%; }
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
@include respond-to(40em) {
|
56 |
+
$i: 1;
|
57 |
+
@while $i <= 2 {
|
58 |
+
.grid-#{$i} { width: 100%; }
|
59 |
+
$i: $i + 1;
|
60 |
+
}
|
61 |
+
}
|
src/app/Mappers/scssphp/tests/inputs/content_with_function.scss
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
$test-var: true;
|
2 |
+
|
3 |
+
@mixin mixin-using-content() {
|
4 |
+
@content;
|
5 |
+
}
|
6 |
+
|
7 |
+
@function test-function($value) {
|
8 |
+
@return $value;
|
9 |
+
}
|
10 |
+
|
11 |
+
@include mixin-using-content {
|
12 |
+
@if $test-var {
|
13 |
+
body {
|
14 |
+
padding: test-function(1 px);
|
15 |
+
}
|
16 |
+
}
|
17 |
+
}
|
src/app/Mappers/scssphp/tests/inputs/default_args.scss
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
@mixin cool($color: blue) {
|
4 |
+
margin: 100px;
|
5 |
+
}
|
6 |
+
|
7 |
+
@function what($height: red) {
|
8 |
+
@return $height;
|
9 |
+
}
|
10 |
+
|
11 |
+
div {
|
12 |
+
height: what();
|
13 |
+
@include cool;
|
14 |
+
}
|
15 |
+
|
src/app/Mappers/scssphp/tests/inputs/directives.scss
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
@charset "hello-world";
|
3 |
+
|
4 |
+
@page :left {
|
5 |
+
div {
|
6 |
+
color: red;
|
7 |
+
}
|
8 |
+
}
|
9 |
+
|
10 |
+
@page test {
|
11 |
+
@media yes {
|
12 |
+
div {
|
13 |
+
color: red;
|
14 |
+
}
|
15 |
+
|
16 |
+
@media no {
|
17 |
+
pre {
|
18 |
+
color: blue;
|
19 |
+
}
|
20 |
+
}
|
21 |
+
}
|
22 |
+
}
|
23 |
+
|
24 |
+
@media something {
|
25 |
+
@page {
|
26 |
+
@media else {
|
27 |
+
div {
|
28 |
+
height: 200px;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
|
35 |
+
div {
|
36 |
+
color: red;
|
37 |
+
@page yeah {
|
38 |
+
pre {
|
39 |
+
height: 20px;
|
40 |
+
}
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
@font-face {
|
45 |
+
color: red;
|
46 |
+
height: 20px;
|
47 |
+
}
|
48 |
+
|
49 |
+
|
50 |
+
@keyframes 'bounce' {
|
51 |
+
from {
|
52 |
+
top: 100px;
|
53 |
+
animation-timing-function: ease-out;
|
54 |
+
}
|
55 |
+
|
56 |
+
25% {
|
57 |
+
top: 50px;
|
58 |
+
animation-timing-function: ease-in;
|
59 |
+
}
|
60 |
+
|
61 |
+
50% {
|
62 |
+
top: 100px;
|
63 |
+
animation-timing-function: ease-out;
|
64 |
+
}
|
65 |
+
|
66 |
+
75% {
|
67 |
+
top: 75px;
|
68 |
+
animation-timing-function: ease-in;
|
69 |
+
}
|
70 |
+
|
71 |
+
to {
|
72 |
+
top: 100px;
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
@-webkit-keyframes flowouttoleft {
|
77 |
+
0% { -webkit-transform: translateX(0) scale(1); }
|
78 |
+
60%, 70% { -webkit-transform: translateX(0) scale(.7); }
|
79 |
+
100% { -webkit-transform: translateX(-100%) scale(.7); }
|
80 |
+
}
|
81 |
+
|
82 |
+
div {
|
83 |
+
animation-name: 'diagonal-slide';
|
84 |
+
animation-duration: 5s;
|
85 |
+
animation-iteration-count: 10;
|
86 |
+
}
|
87 |
+
|
88 |
+
@keyframes 'diagonal-slide' {
|
89 |
+
|
90 |
+
from {
|
91 |
+
left: 0;
|
92 |
+
top: 0;
|
93 |
+
}
|
94 |
+
|
95 |
+
to {
|
96 |
+
left: 100px;
|
97 |
+
top: 100px;
|
98 |
+
}
|
99 |
+
|
100 |
+
}
|
101 |
+
|
102 |
+
@document url(http://www.w3.org/),
|
103 |
+
url-prefix(http://www.w3.org/Style/),
|
104 |
+
domain(mozilla.org),
|
105 |
+
regexp("https:.*")
|
106 |
+
{
|
107 |
+
body { color: purple; background: yellow; }
|
108 |
+
}
|
src/app/Mappers/scssphp/tests/inputs/extends.scss
ADDED
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
error, other {
|
3 |
+
border: 1px #f00;
|
4 |
+
background-color: #fdd;
|
5 |
+
}
|
6 |
+
|
7 |
+
pre, span {
|
8 |
+
seriousError {
|
9 |
+
@extend error;
|
10 |
+
font-size: 20px;
|
11 |
+
}
|
12 |
+
}
|
13 |
+
|
14 |
+
hello {
|
15 |
+
@extend other;
|
16 |
+
color: green;
|
17 |
+
div {
|
18 |
+
margin: 10px;
|
19 |
+
}
|
20 |
+
}
|
21 |
+
|
22 |
+
.cool {
|
23 |
+
color: red;
|
24 |
+
}
|
25 |
+
|
26 |
+
.blue {
|
27 |
+
color: purple;
|
28 |
+
}
|
29 |
+
|
30 |
+
.me {
|
31 |
+
@extend .cool, .blue;
|
32 |
+
}
|
33 |
+
|
34 |
+
.hoverlink { @extend a:hover }
|
35 |
+
a:hover { text-decoration: underline }
|
36 |
+
|
37 |
+
|
38 |
+
// partial matching and selector merging:
|
39 |
+
|
40 |
+
div.hello.world.hmm {
|
41 |
+
color: blue;
|
42 |
+
}
|
43 |
+
|
44 |
+
pre, code {
|
45 |
+
.okay.span {
|
46 |
+
@extend .hello;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
// multiple matches per selector
|
51 |
+
.xxxxx .xxxxx .xxxxx {
|
52 |
+
color: green;
|
53 |
+
}
|
54 |
+
|
55 |
+
code {
|
56 |
+
@extend .xxxxx;
|
57 |
+
color: red;
|
58 |
+
}
|
59 |
+
|
60 |
+
|
61 |
+
// chained
|
62 |
+
|
63 |
+
.alpha {
|
64 |
+
color: red;
|
65 |
+
}
|
66 |
+
|
67 |
+
.beta {
|
68 |
+
@extend .alpha;
|
69 |
+
color: white;
|
70 |
+
}
|
71 |
+
|
72 |
+
.gama {
|
73 |
+
@extend .beta;
|
74 |
+
color: blue;
|
75 |
+
}
|
76 |
+
|
77 |
+
// merging selector sequences
|
78 |
+
|
79 |
+
#admin .tabbar a {font-weight: bold}
|
80 |
+
#demo .overview .fakelink {@extend a}
|
81 |
+
|
82 |
+
a1 b1 c1 d1 { color: red; }
|
83 |
+
x1 y1 z1 w1 { @extend a1; }
|
84 |
+
|
85 |
+
a2 b2 c2 d2 { color: red; }
|
86 |
+
x2 y2 z2 w2 { @extend b2; }
|
87 |
+
|
88 |
+
|
89 |
+
a3 b3 c3 d3 { color: red; }
|
90 |
+
x3 y3 z3 w3 { @extend c3; }
|
91 |
+
|
92 |
+
|
93 |
+
a4 b4 c4 d4 { color: red; }
|
94 |
+
x4 y4 z4 w4 { @extend d4; }
|
95 |
+
|
96 |
+
// removing common prefix
|
97 |
+
|
98 |
+
#butt .yeah .okay { font-weight: bold }
|
99 |
+
#butt .umm .sure { @extend .okay }
|
100 |
+
|
101 |
+
a9 b9 s9 t9 v9 { color: red; }
|
102 |
+
|
103 |
+
a9 b9 x9 y9 z9 {
|
104 |
+
@extend v9;
|
105 |
+
}
|
106 |
+
|
107 |
+
// extends & media
|
108 |
+
|
109 |
+
@media print {
|
110 |
+
horse {
|
111 |
+
color: blue;
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
man {
|
116 |
+
color: red;
|
117 |
+
@extend horse;
|
118 |
+
}
|
119 |
+
|
120 |
+
|
121 |
+
// result == match
|
122 |
+
|
123 |
+
wassup {
|
124 |
+
color: blue;
|
125 |
+
@extend wassup;
|
126 |
+
}
|
127 |
+
|
128 |
+
.foo {
|
129 |
+
.wassup {
|
130 |
+
@extend .wassup;
|
131 |
+
color: blue;
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
// multi-extend
|
136 |
+
|
137 |
+
#something {
|
138 |
+
color: red;
|
139 |
+
}
|
140 |
+
|
141 |
+
.x {
|
142 |
+
@extend #something;
|
143 |
+
}
|
144 |
+
|
145 |
+
.y {
|
146 |
+
@extend #something;
|
147 |
+
}
|
148 |
+
|
149 |
+
// twitter-sass-bootstrap infinite loop
|
150 |
+
|
151 |
+
.nav-tabs {
|
152 |
+
&.nav-justified {
|
153 |
+
@extend .nav-justified;
|
154 |
+
}
|
155 |
+
}
|
156 |
+
.nav-justified {
|
157 |
+
text-align: justify;
|
158 |
+
}
|
159 |
+
|
160 |
+
// multi-extend with nesting
|
161 |
+
|
162 |
+
.btn:hover,
|
163 |
+
.btn:active,
|
164 |
+
.btn.active,
|
165 |
+
.btn.disabled,
|
166 |
+
.btn[disabled] {
|
167 |
+
color: red;
|
168 |
+
}
|
169 |
+
.edit .actions {
|
170 |
+
button {
|
171 |
+
float: right;
|
172 |
+
@extend .btn;
|
173 |
+
}
|
174 |
+
}
|
175 |
+
.edit {
|
176 |
+
.new {
|
177 |
+
.actions {
|
178 |
+
padding: 0;
|
179 |
+
}
|
180 |
+
.actions button {
|
181 |
+
@extend .btn;
|
182 |
+
}
|
183 |
+
}
|
184 |
+
}
|
src/app/Mappers/scssphp/tests/inputs/filter_effects.scss
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#number {
|
2 |
+
-webkit-filter: grayscale(1)
|
3 |
+
sepia(0.5)
|
4 |
+
saturate(0.1)
|
5 |
+
invert(1)
|
6 |
+
opacity(0.5)
|
7 |
+
brightness(0.5)
|
8 |
+
contrast(0.5);
|
9 |
+
}
|
10 |
+
|
11 |
+
#percentage {
|
12 |
+
-webkit-filter: grayscale(100%)
|
13 |
+
sepia(50%)
|
14 |
+
saturate(10%)
|
15 |
+
invert(100%)
|
16 |
+
opacity(50%)
|
17 |
+
brightness(50%)
|
18 |
+
contrast(50%);
|
19 |
+
}
|
20 |
+
|
21 |
+
#misc {
|
22 |
+
-webkit-filter: hue-rotate(90deg)
|
23 |
+
blur(10px)
|
24 |
+
drop-shadow(10px -16px 30px purple);
|
25 |
+
}
|
26 |
+
|
27 |
+
@mixin opacity($opacity, $style: 0) {
|
28 |
+
@if ($opacity < 1) {
|
29 |
+
opacity: $opacity;
|
30 |
+
filter: alpha(opacity=$opacity * 100, style=$style);
|
31 |
+
} @else {
|
32 |
+
opacity: $opacity / 100;
|
33 |
+
filter: alpha(opacity=$opacity);
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
#decimal {
|
38 |
+
@include opacity(.5, 1);
|
39 |
+
}
|
40 |
+
|
41 |
+
#percent {
|
42 |
+
@include opacity(50);
|
43 |
+
}
|
44 |
+
|
45 |
+
.row {
|
46 |
+
background-color: darken(#2ba6cb, 40%);
|
47 |
+
color: darken(#2ba6cb, 10%);
|
48 |
+
}
|
src/app/Mappers/scssphp/tests/inputs/functions.scss
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
@function hello($x) {
|
3 |
+
@return $x + 4;
|
4 |
+
}
|
5 |
+
|
6 |
+
@function add($a, $b) {
|
7 |
+
@return $a + $b;
|
8 |
+
}
|
9 |
+
|
10 |
+
div {
|
11 |
+
color: hello(10px);
|
12 |
+
sum: add(11, 12);
|
13 |
+
}
|
14 |
+
|
15 |
+
// make sure values are being reduced before being passed up to previous scope
|
16 |
+
|
17 |
+
@function one($a, $b) {
|
18 |
+
@return $a $b;
|
19 |
+
}
|
20 |
+
|
21 |
+
@function two($a, $b) {
|
22 |
+
@return $a#{$a} $b;
|
23 |
+
}
|
24 |
+
|
25 |
+
@function three($a, $b: default) {
|
26 |
+
@return "hello #{$a} and #{$b}"
|
27 |
+
}
|
28 |
+
|
29 |
+
@function all($a...) {
|
30 |
+
@return "hello #{$a}"
|
31 |
+
}
|
32 |
+
|
33 |
+
div {
|
34 |
+
hello: one(10, 55);
|
35 |
+
hello: two(10, 55);
|
36 |
+
hello: three(10, 55);
|
37 |
+
}
|
38 |
+
|
39 |
+
|
40 |
+
@function hello_world() {
|
41 |
+
@return 1000;
|
42 |
+
}
|
43 |
+
|
44 |
+
del {
|
45 |
+
color: hello-world();
|
46 |
+
}
|
47 |
+
|
48 |
+
div {
|
49 |
+
$args: foo bar;
|
50 |
+
hello: three($args...);
|
51 |
+
hello: three(bar...);
|
52 |
+
hello: all(Alice, Bob, Tom);
|
53 |
+
}
|
54 |
+
|
55 |
+
@function stringConcatCompassStyle($start,$last)
|
56 |
+
{
|
57 |
+
// Compass still uses it like this
|
58 |
+
@return #{$start}-#{$last};
|
59 |
+
}
|
60 |
+
|
61 |
+
.foo
|
62 |
+
{
|
63 |
+
test2: stringConcatCompassStyle(-moz,art);
|
64 |
+
}
|
65 |
+
|
66 |
+
@mixin content_test {
|
67 |
+
span {
|
68 |
+
$color: green;
|
69 |
+
@content;
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
@function func_test($c) {
|
74 |
+
@return $c + 1;
|
75 |
+
}
|
76 |
+
|
77 |
+
div {
|
78 |
+
@include content_test {
|
79 |
+
height: func_test(2px);
|
80 |
+
}
|
81 |
+
}
|
src/app/Mappers/scssphp/tests/inputs/ie7.scss
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// http://jes.st/2013/ie7s-css-breaking-content-counter-bug/
|
2 |
+
#foo:before {
|
3 |
+
content: counter(item, ".") ": ";
|
4 |
+
}
|
5 |
+
|
6 |
+
#bar:before {
|
7 |
+
content: counter(item,".");
|
8 |
+
}
|
9 |
+
|
10 |
+
#fu:before {
|
11 |
+
content: counter(item);
|
12 |
+
}
|
src/app/Mappers/scssphp/tests/inputs/if.scss
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
@function conds($val) {
|
3 |
+
@if $val {
|
4 |
+
@return "red";
|
5 |
+
}
|
6 |
+
|
7 |
+
@return "blue";
|
8 |
+
}
|
9 |
+
|
10 |
+
div {
|
11 |
+
@if something {
|
12 |
+
color: blue;
|
13 |
+
}
|
14 |
+
}
|
15 |
+
|
16 |
+
pre {
|
17 |
+
val-1: conds(true);
|
18 |
+
val-2: conds(false);
|
19 |
+
val-3: conds(null);
|
20 |
+
val-4: conds(1);
|
21 |
+
val-5: conds(0);
|
22 |
+
}
|
23 |
+
|
24 |
+
|
25 |
+
span {
|
26 |
+
@if false {
|
27 |
+
color: red;
|
28 |
+
} @else {
|
29 |
+
color: blue;
|
30 |
+
}
|
31 |
+
|
32 |
+
@if true {
|
33 |
+
height: 10px;
|
34 |
+
} @else {
|
35 |
+
color: 20px;
|
36 |
+
}
|
37 |
+
|
38 |
+
@if false {
|
39 |
+
height: 10px;
|
40 |
+
} @elseif false {
|
41 |
+
color: 20px;
|
42 |
+
} @else {
|
43 |
+
width: 20px;
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
div {
|
48 |
+
@if false {
|
49 |
+
color: red;
|
50 |
+
} @else if false {
|
51 |
+
color: green;
|
52 |
+
} @else {
|
53 |
+
color: blue;
|
54 |
+
}
|
55 |
+
|
56 |
+
@if false {
|
57 |
+
border-color: red;
|
58 |
+
} @else if true {
|
59 |
+
border-color: green;
|
60 |
+
} @else {
|
61 |
+
border-color: blue;
|
62 |
+
}
|
63 |
+
|
64 |
+
}
|
65 |
+
|
66 |
+
// doesn't work in scss, thing loses scope
|
67 |
+
del {
|
68 |
+
@if false {
|
69 |
+
$thing: yes;
|
70 |
+
} @else {
|
71 |
+
$thing: no;
|
72 |
+
}
|
73 |
+
|
74 |
+
thing: $thing;
|
75 |
+
}
|
76 |
+
|
src/app/Mappers/scssphp/tests/inputs/if_on_null.scss
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@function testfunc($pseudo: null) {
|
2 |
+
$output: if($pseudo, "green", "red");
|
3 |
+
@return $output;
|
4 |
+
}
|
5 |
+
|
6 |
+
body {
|
7 |
+
background-color: testfunc();
|
8 |
+
}
|
src/app/Mappers/scssphp/tests/inputs/import.scss
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
@import "foo.css";
|
3 |
+
@import "foo" screen;
|
4 |
+
@import "http://foo.com/bar";
|
5 |
+
@import url(foo);
|
6 |
+
|
7 |
+
@import "imports/simple";
|
8 |
+
|
9 |
+
pre {
|
10 |
+
color: red;
|
11 |
+
@import "imports/simple.scss";
|
12 |
+
}
|
13 |
+
|
14 |
+
code {
|
15 |
+
@import "imports/simple", "imports/simple";
|
16 |
+
}
|
17 |
+
|
18 |
+
@import "imports/partial";
|
19 |
+
|
20 |
+
body {
|
21 |
+
color: $variable;
|
22 |
+
@include partial-mixin();
|
23 |
+
}
|
src/app/Mappers/scssphp/tests/inputs/imports/_partial.scss
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
#partial {
|
3 |
+
color: blue;
|
4 |
+
}
|
5 |
+
|
6 |
+
$variable: #7C2;
|
7 |
+
|
8 |
+
@mixin partial-mixin() {
|
9 |
+
background: gray;
|
10 |
+
}
|
src/app/Mappers/scssphp/tests/inputs/imports/simple.scss
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
div {
|
2 |
+
height: 200px;
|
3 |
+
color: red;
|
4 |
+
}
|
src/app/Mappers/scssphp/tests/inputs/interpolation.scss
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
div {
|
3 |
+
color: red#{white} blue;
|
4 |
+
color: red #{white} blue;
|
5 |
+
color: red #{white}blue;
|
6 |
+
color: red#{white}blue;
|
7 |
+
color: #{umm}#{yeah}#{what};
|
8 |
+
color: #{stacked};
|
9 |
+
|
10 |
+
font-size: 10px/#{something};
|
11 |
+
font-size: 10px / #{something};
|
12 |
+
|
13 |
+
test: "what#{"world"}wrong";
|
14 |
+
test: "what#{'world'}wrong";
|
15 |
+
test: "what#{world}wrong";
|
16 |
+
test: "what"#{world}"wrong";
|
17 |
+
|
18 |
+
hi: "what is #{4 + 12} end"
|
19 |
+
}
|
20 |
+
|
21 |
+
|
22 |
+
// interpolation in selectors
|
23 |
+
|
24 |
+
pre {
|
25 |
+
$var: cool;
|
26 |
+
|
27 |
+
#{var} {
|
28 |
+
color: red;
|
29 |
+
}
|
30 |
+
|
31 |
+
#{var} dad {
|
32 |
+
color: red;
|
33 |
+
}
|
34 |
+
|
35 |
+
bed#{var}dad {
|
36 |
+
color: red;
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
cool {
|
41 |
+
@for $x from 1 through 5 {
|
42 |
+
.thing-#{$x} {
|
43 |
+
color: red;
|
44 |
+
}
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
a#{b}c#{d}e {
|
49 |
+
color: red;
|
50 |
+
}
|
51 |
+
|
52 |
+
##{hello}, .#{world}{
|
53 |
+
color: red;
|
54 |
+
}
|
55 |
+
|
56 |
+
#abc#{hello}yeah, .cool#{world}yes{
|
57 |
+
color: red;
|
58 |
+
}
|
59 |
+
|
60 |
+
$scope: 2;
|
61 |
+
|
62 |
+
div.element:nth-child(#{$scope}n)
|
63 |
+
{
|
64 |
+
display: none;
|
65 |
+
}
|
66 |
+
|
67 |
+
// property interpolation
|
68 |
+
|
69 |
+
div {
|
70 |
+
$var: hello;
|
71 |
+
#{$var}: world;
|
72 |
+
cool#{$var}:world;
|
73 |
+
#{$var}one:world;
|
74 |
+
two#{$var}one:world;
|
75 |
+
|
76 |
+
one#{a + b}two: cool;
|
77 |
+
|
78 |
+
#{hello}: {
|
79 |
+
#{world}: red;
|
80 |
+
#{mold}: white;
|
81 |
+
#{$var}: blue;
|
82 |
+
}
|
83 |
+
|
84 |
+
}
|
85 |
+
|
86 |
+
|
src/app/Mappers/scssphp/tests/inputs/keyword_args.scss
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
// mixins
|
3 |
+
|
4 |
+
@mixin hello($a: one, $b:two, $c:three, $d: four) {
|
5 |
+
out: $a $b $c $d;
|
6 |
+
}
|
7 |
+
|
8 |
+
pre {
|
9 |
+
@include hello(alpha, $d: palace, $b: fort);
|
10 |
+
}
|
11 |
+
|
12 |
+
|
13 |
+
// functions
|
14 |
+
|
15 |
+
@function cool($a, $b) {
|
16 |
+
@return $a - $b;
|
17 |
+
}
|
18 |
+
|
19 |
+
div {
|
20 |
+
hello: cool($b: 5, $a: 10);
|
21 |
+
world: cool(5, 10);
|
22 |
+
}
|
23 |
+
|
24 |
+
|
src/app/Mappers/scssphp/tests/inputs/list.scss
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
$list: (black);
|
2 |
+
$list: join($list, white, comma);
|
3 |
+
|
4 |
+
div {
|
5 |
+
padding: join(10px 20px, 30px 40px);
|
6 |
+
margin: join((0, 10px), (10px, 10px), space);
|
7 |
+
background: linear-gradient($list);
|
8 |
+
}
|
9 |
+
|
10 |
+
$list: ();
|
11 |
+
$list: join($list, (red, blue), comma);
|
12 |
+
|
13 |
+
p {
|
14 |
+
background: linear-gradient($list);
|
15 |
+
}
|
src/app/Mappers/scssphp/tests/inputs/looping.scss
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
div {
|
3 |
+
@each $var in what is this {
|
4 |
+
color: $var;
|
5 |
+
}
|
6 |
+
|
7 |
+
@each $var in what, is, this {
|
8 |
+
font: $var;
|
9 |
+
}
|
10 |
+
|
11 |
+
$list: what is this;
|
12 |
+
@each $var in $list {
|
13 |
+
background: $var;
|
14 |
+
}
|
15 |
+
|
16 |
+
$list: what, is, this;
|
17 |
+
@each $var in $list {
|
18 |
+
border: $var;
|
19 |
+
}
|
20 |
+
}
|
21 |
+
|
22 |
+
|
23 |
+
span {
|
24 |
+
$i: 0;
|
25 |
+
@while $i <= 10 {
|
26 |
+
color: $i;
|
27 |
+
$i: $i + 1;
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
pre {
|
32 |
+
@for $x from 1 to 5 {
|
33 |
+
color: $x;
|
34 |
+
}
|
35 |
+
|
36 |
+
@for $x from 1 through 5 {
|
37 |
+
height: $x;
|
38 |
+
}
|
39 |
+
|
40 |
+
$y: 10;
|
41 |
+
@for $x from $y through 3 {
|
42 |
+
cool: $x;
|
43 |
+
}
|
44 |
+
|
45 |
+
}
|
46 |
+
|
47 |
+
$j: null;
|
48 |
+
@while $j {
|
49 |
+
.item { width: 2em; }
|
50 |
+
$j: false;
|
51 |
+
}
|
src/app/Mappers/scssphp/tests/inputs/media.scss
ADDED
@@ -0,0 +1,208 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
// media syntax
|
3 |
+
@media {
|
4 |
+
div { color: blue; }
|
5 |
+
}
|
6 |
+
@media what {
|
7 |
+
div { color: blue; }
|
8 |
+
}
|
9 |
+
|
10 |
+
@media (cool) {
|
11 |
+
div { color: blue; }
|
12 |
+
}
|
13 |
+
@media (cool: blue) {
|
14 |
+
div { color: blue; }
|
15 |
+
}
|
16 |
+
|
17 |
+
@media hello and (world) and (butt: man) {
|
18 |
+
div { color: blue; }
|
19 |
+
}
|
20 |
+
|
21 |
+
$navbarCollapseWidth: 940px;
|
22 |
+
|
23 |
+
@media (max-width: $navbarCollapseWidth) {
|
24 |
+
color: red;
|
25 |
+
}
|
26 |
+
|
27 |
+
// media bubbling
|
28 |
+
@media not hello and (world) {
|
29 |
+
color: blue;
|
30 |
+
pre {
|
31 |
+
color: blue;
|
32 |
+
}
|
33 |
+
|
34 |
+
@media butt {
|
35 |
+
color: red;
|
36 |
+
div {
|
37 |
+
color: red;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
@media a, b {
|
43 |
+
@media c {
|
44 |
+
color: blue;
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
@media a{
|
49 |
+
@media b, c {
|
50 |
+
color: blue;
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
@media a, b{
|
55 |
+
@media c, d {
|
56 |
+
color: blue;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
$media: cree;
|
61 |
+
$feature: -webkit-min-device-pixel-ratio;
|
62 |
+
$value: 1.5;
|
63 |
+
|
64 |
+
div {
|
65 |
+
color: blue;
|
66 |
+
@media s#{$media}n and ($feature: $value) {
|
67 |
+
.sidebar {
|
68 |
+
width: 500px;
|
69 |
+
}
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
// @media + @mixin
|
74 |
+
@mixin color {
|
75 |
+
color: red;
|
76 |
+
.success {
|
77 |
+
color: green;
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
div {
|
82 |
+
position: absolute;
|
83 |
+
$y: 2em;
|
84 |
+
@media screen {
|
85 |
+
top: 0;
|
86 |
+
$x: 5px;
|
87 |
+
p {
|
88 |
+
margin: $x;
|
89 |
+
}
|
90 |
+
bottom: 6em + $y;
|
91 |
+
@include color;
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
.button {
|
96 |
+
width: 300px;
|
97 |
+
height: 100px;
|
98 |
+
background: #eee;
|
99 |
+
|
100 |
+
:hover {
|
101 |
+
background: #aaa;
|
102 |
+
}
|
103 |
+
|
104 |
+
@media only screen and (max-width : 300px){
|
105 |
+
width: 100px;
|
106 |
+
height: 100px;
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
code {
|
111 |
+
position: absolute;
|
112 |
+
@media screen {
|
113 |
+
pre {
|
114 |
+
height: 20px;
|
115 |
+
}
|
116 |
+
height: 10px;
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
+
dt {
|
121 |
+
@media screen {
|
122 |
+
@media (color: blue) {
|
123 |
+
height: 10px;
|
124 |
+
}
|
125 |
+
}
|
126 |
+
}
|
127 |
+
|
128 |
+
// nesting media queries
|
129 |
+
@media screen {
|
130 |
+
.screen {
|
131 |
+
width: 12px;
|
132 |
+
}
|
133 |
+
@media only screen {
|
134 |
+
.only-screen {
|
135 |
+
height: 11px;
|
136 |
+
}
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
@media only screen {
|
141 |
+
.only-screen {
|
142 |
+
width: 14px;
|
143 |
+
}
|
144 |
+
@media only screen {
|
145 |
+
.only-screen {
|
146 |
+
height: 16px;
|
147 |
+
}
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
@media not screen {
|
152 |
+
@media screen {
|
153 |
+
.invalid {
|
154 |
+
height: 12px;
|
155 |
+
}
|
156 |
+
}
|
157 |
+
}
|
158 |
+
|
159 |
+
@media not screen {
|
160 |
+
@media print {
|
161 |
+
.only-print {
|
162 |
+
height: 12px;
|
163 |
+
}
|
164 |
+
}
|
165 |
+
}
|
166 |
+
|
167 |
+
@media screen {
|
168 |
+
@media not print {
|
169 |
+
.only-print {
|
170 |
+
height: 12px;
|
171 |
+
}
|
172 |
+
}
|
173 |
+
}
|
174 |
+
|
175 |
+
@media not screen {
|
176 |
+
@media not print {
|
177 |
+
.invalid {
|
178 |
+
height: 12px;
|
179 |
+
}
|
180 |
+
}
|
181 |
+
}
|
182 |
+
|
183 |
+
@media not screen {
|
184 |
+
@media not screen {
|
185 |
+
.not-screen {
|
186 |
+
height: 15px;
|
187 |
+
}
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
@media only screen {
|
192 |
+
@media print {
|
193 |
+
.invalid {
|
194 |
+
height: 15px;
|
195 |
+
}
|
196 |
+
}
|
197 |
+
}
|
198 |
+
|
199 |
+
@media only screen {
|
200 |
+
@media screen and (color: blue) {
|
201 |
+
@media screen and (width: 13) {
|
202 |
+
.only-screen {
|
203 |
+
height: 15px;
|
204 |
+
}
|
205 |
+
}
|
206 |
+
}
|
207 |
+
}
|
208 |
+
|
src/app/Mappers/scssphp/tests/inputs/mixins.scss
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
@mixin something {
|
3 |
+
color: red;
|
4 |
+
pre {
|
5 |
+
height: 200px;
|
6 |
+
}
|
7 |
+
}
|
8 |
+
|
9 |
+
div {
|
10 |
+
color: blue;
|
11 |
+
@include something;
|
12 |
+
}
|
13 |
+
|
14 |
+
@mixin something($color) {
|
15 |
+
color: $color;
|
16 |
+
|
17 |
+
div {
|
18 |
+
height: 20px;
|
19 |
+
}
|
20 |
+
}
|
21 |
+
|
22 |
+
@mixin cool($a, $b, $c) {
|
23 |
+
height: $a + $b + $c;
|
24 |
+
}
|
25 |
+
|
26 |
+
span {
|
27 |
+
@include something(blue);
|
28 |
+
}
|
29 |
+
|
30 |
+
html {
|
31 |
+
@include cool(10px, 12px, 21px);
|
32 |
+
}
|
33 |
+
|
34 |
+
|
35 |
+
@mixin hello_world {
|
36 |
+
height: 20px;
|
37 |
+
}
|
38 |
+
|
39 |
+
del {
|
40 |
+
@include hello-world;
|
41 |
+
}
|
42 |
+
|
43 |
+
|
44 |
+
// variable shadowing
|
45 |
+
|
46 |
+
|
47 |
+
$color: white;
|
48 |
+
@mixin colors($color: blue) {
|
49 |
+
color: $color;
|
50 |
+
}
|
51 |
+
|
52 |
+
div {
|
53 |
+
color: $color;
|
54 |
+
@include colors();
|
55 |
+
color: $color;
|
56 |
+
}
|
57 |
+
|
58 |
+
@mixin linear-gradient($from, $to, $pos: left top) {
|
59 |
+
background-image: linear-gradient($pos, $from, $to);
|
60 |
+
}
|
61 |
+
|
62 |
+
div {
|
63 |
+
@include linear-gradient(red, green);
|
64 |
+
}
|
65 |
+
|
66 |
+
@mixin box-shadow($shadows...) {
|
67 |
+
-moz-box-shadow: $shadows;
|
68 |
+
-webkit-box-shadow: $shadows;
|
69 |
+
box-shadow: $shadows;
|
70 |
+
}
|
71 |
+
|
72 |
+
div {
|
73 |
+
@include box-shadow(10px 10px 5px #888);
|
74 |
+
@include box-shadow(inset 10px 10px #888, -10px -10px #f4f4f4);
|
75 |
+
}
|
76 |
+
|
77 |
+
@mixin nested {
|
78 |
+
@include something(red);
|
79 |
+
}
|
80 |
+
|
81 |
+
div {
|
82 |
+
p {
|
83 |
+
.class {
|
84 |
+
@include nested;
|
85 |
+
}
|
86 |
+
|
87 |
+
@include nested;
|
88 |
+
|
89 |
+
.top {
|
90 |
+
top: 0;
|
91 |
+
|
92 |
+
div {
|
93 |
+
color: red;
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
color: blue;
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
// mixin content (http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#mixin-content)
|
102 |
+
@mixin content-simple {
|
103 |
+
div.mixin-content-simple {
|
104 |
+
@content;
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
@mixin content-with-arg ( $background ) {
|
109 |
+
div.mixin-content-with-arg {
|
110 |
+
background: $background;
|
111 |
+
@content;
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
@include content-simple {
|
116 |
+
color: red;
|
117 |
+
}
|
118 |
+
|
119 |
+
@include content-with-arg($background: blue) {
|
120 |
+
color: red;
|
121 |
+
}
|
122 |
+
|
123 |
+
@include content-with-arg($background: purple) {
|
124 |
+
@include hello_world;
|
125 |
+
}
|
126 |
+
|
127 |
+
@include content-simple {
|
128 |
+
@include cool(10px, 12px, 21px);
|
129 |
+
}
|
130 |
+
|
131 |
+
@include content-simple {
|
132 |
+
@include something(orange);
|
133 |
+
}
|
134 |
+
|
135 |
+
@include content-with-arg($background: purple) {
|
136 |
+
@include cool(10px, 12px, 21px);
|
137 |
+
}
|
138 |
+
|
139 |
+
@include content-with-arg($background: purple) {
|
140 |
+
@include something(orange);
|
141 |
+
}
|
142 |
+
|
143 |
+
@mixin wallpaper($image, $top: 0, $right: 0, $bottom: 0, $left: 0) {
|
144 |
+
background: $image;
|
145 |
+
position: absolute;
|
146 |
+
top: $top;
|
147 |
+
right: $right;
|
148 |
+
bottom: $bottom;
|
149 |
+
left: $left;
|
150 |
+
}
|
151 |
+
|
152 |
+
@mixin logo($offsets...) {
|
153 |
+
@include wallpaper(url(/images/logo.png), $offsets...);
|
154 |
+
}
|
155 |
+
|
156 |
+
#please-wait {
|
157 |
+
@include logo(1em, $left: 4em, $bottom: 3em);
|
158 |
+
}
|
src/app/Mappers/scssphp/tests/inputs/nesting.scss
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
body {
|
4 |
+
color: red;
|
5 |
+
}
|
6 |
+
|
7 |
+
|
8 |
+
div {
|
9 |
+
color: red;
|
10 |
+
height: yes;
|
11 |
+
|
12 |
+
pre {
|
13 |
+
color: blue;
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
17 |
+
|
18 |
+
div: blue;
|
19 |
+
|
20 |
+
|
21 |
+
div {
|
22 |
+
font: 10px hello world {
|
23 |
+
size: 10px;
|
24 |
+
color: blue;
|
25 |
+
}
|
26 |
+
|
27 |
+
border: {
|
28 |
+
left: 1px solid blue;
|
29 |
+
right: 2px dashed green;
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
|
34 |
+
#nested-nesting {
|
35 |
+
bar: baz;
|
36 |
+
bang: {
|
37 |
+
bop: bar;
|
38 |
+
bip: 1px;
|
39 |
+
blat: {
|
40 |
+
baf: bort
|
41 |
+
}
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
|
src/app/Mappers/scssphp/tests/inputs/null.scss
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
$list: null;
|
2 |
+
.div {
|
3 |
+
one: null;
|
4 |
+
one: null world;
|
5 |
+
one: NULL world;
|
6 |
+
one: a null, b;
|
7 |
+
two: a $list $list, $list, b;
|
8 |
+
three: $list;
|
9 |
+
}
|
10 |
+
|
11 |
+
$value: null;
|
12 |
+
p:before {
|
13 |
+
content: "I ate #{$value} pies!";
|
14 |
+
}
|
15 |
+
|
16 |
+
@mixin Rounded($radius1, $direction: null, $radius2: false) {
|
17 |
+
$corner: null;
|
18 |
+
@if $direction == TL { $corner: top-left-; }
|
19 |
+
@if $direction == TR { $corner: top-right-; }
|
20 |
+
@if $direction == BL { $corner: bottom-left-; }
|
21 |
+
@if $direction == BR { $corner: bottom-right-; }
|
22 |
+
@if $radius2 {
|
23 |
+
-webkit-border-#{$corner}radius: $radius1 $radius2;
|
24 |
+
border-#{$corner}radius: $radius1 $radius2;
|
25 |
+
} @else {
|
26 |
+
-webkit-border-#{$corner}radius: $radius1;
|
27 |
+
border-#{$corner}radius: $radius1;
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
.foo {
|
32 |
+
@include Rounded(10);
|
33 |
+
}
|
34 |
+
|
35 |
+
.fu {
|
36 |
+
@include Rounded(20, null);
|
37 |
+
}
|
38 |
+
|
39 |
+
.bar {
|
40 |
+
@include Rounded(30, TL);
|
41 |
+
}
|
src/app/Mappers/scssphp/tests/inputs/operators.scss
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
body {
|
4 |
+
color: 1 + 2 + 5;
|
5 |
+
color: 1 + 2 * 5 + 5;
|
6 |
+
height: 10px/10px;
|
7 |
+
color: 10px/2 + 1;
|
8 |
+
color: (10px/2);
|
9 |
+
bottom: (4/2px);
|
10 |
+
top: 1em * (1 * 24px - 0) / 16px;
|
11 |
+
left: 1 - 2cm;
|
12 |
+
top: (2cm/12px);
|
13 |
+
}
|
14 |
+
|
15 |
+
div {
|
16 |
+
color: 4 == 3;
|
17 |
+
color: hello == hello;
|
18 |
+
|
19 |
+
color: 4 > 3;
|
20 |
+
color: 4 < 3;
|
21 |
+
color: what > 3;
|
22 |
+
}
|
23 |
+
|
24 |
+
|
25 |
+
#units {
|
26 |
+
test: 1in + 4cm;
|
27 |
+
test: 12mm + 1;
|
28 |
+
test: 1 + 3em;
|
29 |
+
test: 1mm + 1cm;
|
30 |
+
test: 1cm + 1mm;
|
31 |
+
}
|
32 |
+
|
33 |
+
#modulo {
|
34 |
+
test: 3 % 2;
|
35 |
+
test: 4cm % 3;
|
36 |
+
}
|
37 |
+
|
38 |
+
#colors {
|
39 |
+
color: red + rgb(1,2,3);
|
40 |
+
color: red - rgb(1,2,3);
|
41 |
+
color: rgba(1,2,3, 0.5) * rgba(3,4,5, 0.5);
|
42 |
+
color: rgba(10,15,20, 0.5) / rgba(2,2,2, 0.5);
|
43 |
+
|
44 |
+
color: rgba(1,2,3, 0.5) * 2;
|
45 |
+
color: rgba(1,2,3, 0.5) / 2;
|
46 |
+
color: rgba(1,2,3, 0.5) + 2;
|
47 |
+
color: rgba(1,2,3, 0.5) - 2;
|
48 |
+
|
49 |
+
color: blue + 34;
|
50 |
+
|
51 |
+
color: #fff == #000;
|
52 |
+
color: #fff == #fff;
|
53 |
+
|
54 |
+
color: #fff != #000;
|
55 |
+
color: #fff != #fff;
|
56 |
+
}
|
57 |
+
|
58 |
+
|
59 |
+
#preserve {
|
60 |
+
hello: what -going;
|
61 |
+
hello: what - going;
|
62 |
+
}
|
63 |
+
|
64 |
+
#strings {
|
65 |
+
hello: what -going;
|
66 |
+
|
67 |
+
hello: what +going;
|
68 |
+
hello: what+going;
|
69 |
+
hello: what+ going;
|
70 |
+
hello: what + going;
|
71 |
+
|
72 |
+
hello: "what" + going;
|
73 |
+
hello: going + "what";
|
74 |
+
hello: "what" + "what";
|
75 |
+
}
|
76 |
+
|
77 |
+
#negation {
|
78 |
+
$num: 100;
|
79 |
+
a: -$num + 40;
|
80 |
+
b: 10 -$num;
|
81 |
+
b: 10 - $num;
|
82 |
+
}
|
83 |
+
|
84 |
+
#bools-fail {
|
85 |
+
and: false and two;
|
86 |
+
and: one and two;
|
87 |
+
and: one and false;
|
88 |
+
|
89 |
+
or: false or two;
|
90 |
+
or: one or two;
|
91 |
+
or: one or false;
|
92 |
+
}
|
93 |
+
|
94 |
+
#bools {
|
95 |
+
and: (false and two);
|
96 |
+
and: (one and two);
|
97 |
+
and: (one and false);
|
98 |
+
|
99 |
+
or: (false or two);
|
100 |
+
or: (one or two);
|
101 |
+
or: (one or false);
|
102 |
+
}
|
103 |
+
|
104 |
+
|
105 |
+
#nots-fail {
|
106 |
+
not: not true + 2;
|
107 |
+
not: not false;
|
108 |
+
not: not 0;
|
109 |
+
not: not 1;
|
110 |
+
not: not "";
|
111 |
+
not: not hello;
|
112 |
+
}
|
113 |
+
|
114 |
+
#nots {
|
115 |
+
not: (not true) + 2;
|
116 |
+
not: (not false);
|
117 |
+
not: (not 0);
|
118 |
+
not: (not 1);
|
119 |
+
not: (not "");
|
120 |
+
not: (not hello);
|
121 |
+
}
|
122 |
+
|
123 |
+
#string-test {
|
124 |
+
str: hi == "hi";
|
125 |
+
str: hi == "no";
|
126 |
+
str: 'yes' == 'yes';
|
127 |
+
|
128 |
+
$var1: "hello";
|
129 |
+
$var2: hello;
|
130 |
+
|
131 |
+
str: "#{$var1}" == '#{$var2}';
|
132 |
+
|
133 |
+
str: xhello#{$var1}x == "x#{$var2}hellox"; // xhellohellofalse
|
134 |
+
|
135 |
+
str: unit(10px) == px;
|
136 |
+
}
|
137 |
+
|
138 |
+
|
139 |
+
#special {
|
140 |
+
cancel-unit: (10px / 10px);
|
141 |
+
}
|
142 |
+
|
143 |
+
|
src/app/Mappers/scssphp/tests/inputs/placeholder_selector.scss
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#context a%extreme span {
|
2 |
+
color: blue;
|
3 |
+
font-weight: bold;
|
4 |
+
font-size: 2em;
|
5 |
+
}
|
6 |
+
|
7 |
+
.notice, .error { @extend %extreme; }
|
8 |
+
|
9 |
+
.hidden %placeholder {
|
10 |
+
margin: 0;
|
11 |
+
}
|
12 |
+
|
13 |
+
p {
|
14 |
+
@extend #context;
|
15 |
+
padding: 2em;
|
16 |
+
}
|
17 |
+
|
18 |
+
div { @extend .hidden; }
|
src/app/Mappers/scssphp/tests/inputs/scss_css.scss
ADDED
@@ -0,0 +1,986 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[foo~=bar] {
|
2 |
+
a: b; }
|
3 |
+
|
4 |
+
|
5 |
+
[foo^=bar] {
|
6 |
+
a: b; }
|
7 |
+
|
8 |
+
|
9 |
+
[foo$=bar] {
|
10 |
+
a: b; }
|
11 |
+
|
12 |
+
|
13 |
+
[foo*=bar] {
|
14 |
+
a: b; }
|
15 |
+
|
16 |
+
|
17 |
+
[foo|=en] {
|
18 |
+
a: b; }
|
19 |
+
|
20 |
+
|
21 |
+
foo {
|
22 |
+
a: 2;
|
23 |
+
b: 2.3em;
|
24 |
+
c: 50%;
|
25 |
+
d: "fraz bran";
|
26 |
+
e: flanny-blanny-blan;
|
27 |
+
f: url(http://sass-lang.com);
|
28 |
+
// g: U+ffa?;
|
29 |
+
h: #aabbcc; }
|
30 |
+
|
31 |
+
|
32 |
+
selector {
|
33 |
+
property: value;
|
34 |
+
property2: value; }
|
35 |
+
|
36 |
+
|
37 |
+
sel{p:v}
|
38 |
+
|
39 |
+
.foo {
|
40 |
+
/* Foo
|
41 |
+
Bar
|
42 |
+
Baz */
|
43 |
+
a: b; }
|
44 |
+
|
45 |
+
|
46 |
+
.foo {
|
47 |
+
/* Foo
|
48 |
+
Bar
|
49 |
+
Baz */
|
50 |
+
a: b; }
|
51 |
+
|
52 |
+
|
53 |
+
.foo {/* Foo
|
54 |
+
Bar */
|
55 |
+
a: b; }
|
56 |
+
|
57 |
+
|
58 |
+
.foo {/* Foo
|
59 |
+
Bar
|
60 |
+
Baz */
|
61 |
+
a: b; }
|
62 |
+
|
63 |
+
|
64 |
+
@foo {
|
65 |
+
rule {
|
66 |
+
a: b; }
|
67 |
+
|
68 |
+
a: b; }
|
69 |
+
|
70 |
+
|
71 |
+
@foo {a:b};
|
72 |
+
@bar {a:b};
|
73 |
+
|
74 |
+
|
75 |
+
@foo "bar"
|
76 |
+
|
77 |
+
foo {
|
78 |
+
a: 12px calc(100%/3 - 2*1em - 2*1px);
|
79 |
+
b: 12px -moz-calc(100%/3 - 2*1em - 2*1px);
|
80 |
+
b: 12px -webkit-calc(100%/3 - 2*1em - 2*1px);
|
81 |
+
b: 12px -foobar-calc(100%/3 - 2*1em - 2*1px); }
|
82 |
+
|
83 |
+
|
84 |
+
foo {bar: baz}
|
85 |
+
<!--
|
86 |
+
bar {bar: baz}
|
87 |
+
-->
|
88 |
+
baz {bar: baz}
|
89 |
+
|
90 |
+
|
91 |
+
/*
|
92 |
+
* foo
|
93 |
+
*/
|
94 |
+
bar {baz: bang}
|
95 |
+
|
96 |
+
|
97 |
+
E, F {
|
98 |
+
a: b; }
|
99 |
+
|
100 |
+
|
101 |
+
E F, G H {
|
102 |
+
a: b; }
|
103 |
+
|
104 |
+
|
105 |
+
E > F, G > H {
|
106 |
+
a: b; }
|
107 |
+
|
108 |
+
|
109 |
+
/* This is a CSS comment. */
|
110 |
+
.one {color: green;} /* Another comment */
|
111 |
+
/* The following should not be used:
|
112 |
+
.two {color: red;} */
|
113 |
+
.three {color: green; /* color: red; */}
|
114 |
+
/**
|
115 |
+
.four {color: red;} */
|
116 |
+
.five {color: green;}
|
117 |
+
/**/
|
118 |
+
.six {color: green;}
|
119 |
+
/*********/
|
120 |
+
.seven {color: green;}
|
121 |
+
/* a comment **/
|
122 |
+
.eight {color: green;}
|
123 |
+
|
124 |
+
|
125 |
+
foo {
|
126 |
+
a: \foo bar;
|
127 |
+
b: foo\ bar;
|
128 |
+
c: \2022 \0020;
|
129 |
+
d: foo\\bar;
|
130 |
+
e: foo\"\'bar; }
|
131 |
+
|
132 |
+
|
133 |
+
foo {
|
134 |
+
a: "\foo bar";
|
135 |
+
b: "foo\ bar";
|
136 |
+
c: "\2022 \0020";
|
137 |
+
d: "foo\\bar";
|
138 |
+
e: "foo\"'bar"; }
|
139 |
+
|
140 |
+
|
141 |
+
foo {
|
142 |
+
_name: val;
|
143 |
+
*name: val;
|
144 |
+
:name: val;
|
145 |
+
.name: val;
|
146 |
+
#name: val;
|
147 |
+
name/**/: val;
|
148 |
+
name/*\**/: val;
|
149 |
+
name: val; }
|
150 |
+
|
151 |
+
|
152 |
+
@foo "bar" ;
|
153 |
+
|
154 |
+
foo {
|
155 |
+
a: -moz-element(#foo);
|
156 |
+
b: -webkit-element(#foo);
|
157 |
+
b: -foobar-element(#foo); }
|
158 |
+
|
159 |
+
|
160 |
+
@foo {}
|
161 |
+
|
162 |
+
@foo {
|
163 |
+
}
|
164 |
+
|
165 |
+
|
166 |
+
@foo;
|
167 |
+
|
168 |
+
foo {;;;;
|
169 |
+
bar: baz;;;;
|
170 |
+
;;}
|
171 |
+
|
172 |
+
|
173 |
+
#foo .bar {}
|
174 |
+
|
175 |
+
#foo .bar {
|
176 |
+
}
|
177 |
+
|
178 |
+
|
179 |
+
0% {
|
180 |
+
a: b; }
|
181 |
+
|
182 |
+
|
183 |
+
60% {
|
184 |
+
a: b; }
|
185 |
+
|
186 |
+
|
187 |
+
100% {
|
188 |
+
a: b; }
|
189 |
+
|
190 |
+
|
191 |
+
12px {
|
192 |
+
a: b; }
|
193 |
+
|
194 |
+
|
195 |
+
"foo" {
|
196 |
+
a: b; }
|
197 |
+
|
198 |
+
|
199 |
+
foo {
|
200 |
+
a: 12px expression(1 + (3 / Foo.bar("baz" + "bang") + function() {return 12;}) % 12); }
|
201 |
+
|
202 |
+
|
203 |
+
:foo("bar") {
|
204 |
+
a: b; }
|
205 |
+
|
206 |
+
|
207 |
+
:foo(bar) {
|
208 |
+
a: b; }
|
209 |
+
|
210 |
+
|
211 |
+
:foo(12px) {
|
212 |
+
a: b; }
|
213 |
+
|
214 |
+
|
215 |
+
:foo(+) {
|
216 |
+
a: b; }
|
217 |
+
|
218 |
+
|
219 |
+
:foo(-) {
|
220 |
+
a: b; }
|
221 |
+
|
222 |
+
|
223 |
+
:foo(+"bar") {
|
224 |
+
a: b; }
|
225 |
+
|
226 |
+
|
227 |
+
:foo(-++--baz-"bar"12px) {
|
228 |
+
a: b; }
|
229 |
+
|
230 |
+
|
231 |
+
foo {
|
232 |
+
a: foo-bar(12);
|
233 |
+
b: -foo-bar-baz(13, 14 15); }
|
234 |
+
|
235 |
+
|
236 |
+
@import "foo.css";
|
237 |
+
|
238 |
+
@import 'foo.css';
|
239 |
+
|
240 |
+
@import url("foo.css");
|
241 |
+
|
242 |
+
@import url('foo.css');
|
243 |
+
|
244 |
+
@import url(foo.css);
|
245 |
+
|
246 |
+
@import "foo.css" screen;
|
247 |
+
|
248 |
+
@import "foo.css" screen, print;
|
249 |
+
|
250 |
+
@import "foo.css" screen, print and (foo: 0);
|
251 |
+
|
252 |
+
@import "foo.css" screen, only print, screen and (foo: 0);
|
253 |
+
|
254 |
+
foo {
|
255 |
+
a: foo !important;
|
256 |
+
b: foo bar !important;
|
257 |
+
b: foo, bar !important; }
|
258 |
+
|
259 |
+
|
260 |
+
foo {
|
261 |
+
a: -moz-bar-baz;
|
262 |
+
b: foo -o-bar-baz; }
|
263 |
+
|
264 |
+
|
265 |
+
foo {a: /* b; c: */ d}
|
266 |
+
|
267 |
+
|
268 |
+
foo {a /*: b; c */: d}
|
269 |
+
|
270 |
+
|
271 |
+
/* Foo
|
272 |
+
* Bar */
|
273 |
+
|
274 |
+
|
275 |
+
.foo {
|
276 |
+
/* Foo
|
277 |
+
* Bar */ }
|
278 |
+
|
279 |
+
|
280 |
+
[foo] {
|
281 |
+
a: b; }
|
282 |
+
|
283 |
+
|
284 |
+
[foo="bar"] {
|
285 |
+
a: b; }
|
286 |
+
|
287 |
+
|
288 |
+
[foo~="bar"] {
|
289 |
+
a: b; }
|
290 |
+
|
291 |
+
|
292 |
+
[foo^="bar"] {
|
293 |
+
a: b; }
|
294 |
+
|
295 |
+
|
296 |
+
[foo$="bar"] {
|
297 |
+
a: b; }
|
298 |
+
|
299 |
+
|
300 |
+
[foo*="bar"] {
|
301 |
+
a: b; }
|
302 |
+
|
303 |
+
|
304 |
+
[foo|="en"] {
|
305 |
+
a: b; }
|
306 |
+
|
307 |
+
|
308 |
+
:root {
|
309 |
+
a: b; }
|
310 |
+
|
311 |
+
|
312 |
+
:nth-child(n) {
|
313 |
+
a: b; }
|
314 |
+
|
315 |
+
|
316 |
+
:nth-last-child(n) {
|
317 |
+
a: b; }
|
318 |
+
|
319 |
+
|
320 |
+
:nth-of-type(n) {
|
321 |
+
a: b; }
|
322 |
+
|
323 |
+
|
324 |
+
:nth-last-of-type(n) {
|
325 |
+
a: b; }
|
326 |
+
|
327 |
+
|
328 |
+
:first-child {
|
329 |
+
a: b; }
|
330 |
+
|
331 |
+
|
332 |
+
:last-child {
|
333 |
+
a: b; }
|
334 |
+
|
335 |
+
|
336 |
+
:first-of-type {
|
337 |
+
a: b; }
|
338 |
+
|
339 |
+
|
340 |
+
:last-of-type {
|
341 |
+
a: b; }
|
342 |
+
|
343 |
+
|
344 |
+
:only-child {
|
345 |
+
a: b; }
|
346 |
+
|
347 |
+
|
348 |
+
:only-of-type {
|
349 |
+
a: b; }
|
350 |
+
|
351 |
+
|
352 |
+
:empty {
|
353 |
+
a: b; }
|
354 |
+
|
355 |
+
|
356 |
+
:link {
|
357 |
+
a: b; }
|
358 |
+
|
359 |
+
|
360 |
+
:visited {
|
361 |
+
a: b; }
|
362 |
+
|
363 |
+
|
364 |
+
:active {
|
365 |
+
a: b; }
|
366 |
+
|
367 |
+
|
368 |
+
:hover {
|
369 |
+
a: b; }
|
370 |
+
|
371 |
+
|
372 |
+
:focus {
|
373 |
+
a: b; }
|
374 |
+
|
375 |
+
|
376 |
+
:target {
|
377 |
+
a: b; }
|
378 |
+
|
379 |
+
|
380 |
+
:lang(fr) {
|
381 |
+
a: b; }
|
382 |
+
|
383 |
+
|
384 |
+
:enabled {
|
385 |
+
a: b; }
|
386 |
+
|
387 |
+
|
388 |
+
:disabled {
|
389 |
+
a: b; }
|
390 |
+
|
391 |
+
|
392 |
+
:checked {
|
393 |
+
a: b; }
|
394 |
+
|
395 |
+
|
396 |
+
::first-line {
|
397 |
+
a: b; }
|
398 |
+
|
399 |
+
|
400 |
+
::first-letter {
|
401 |
+
a: b; }
|
402 |
+
|
403 |
+
|
404 |
+
::before {
|
405 |
+
a: b; }
|
406 |
+
|
407 |
+
|
408 |
+
::after {
|
409 |
+
a: b; }
|
410 |
+
|
411 |
+
|
412 |
+
.warning {
|
413 |
+
a: b; }
|
414 |
+
|
415 |
+
|
416 |
+
#myid {
|
417 |
+
a: b; }
|
418 |
+
|
419 |
+
|
420 |
+
:not(s) {
|
421 |
+
a: b; }
|
422 |
+
|
423 |
+
|
424 |
+
@media all {
|
425 |
+
rule1 {
|
426 |
+
prop: val; }
|
427 |
+
|
428 |
+
rule2 {
|
429 |
+
prop: val; } }
|
430 |
+
|
431 |
+
|
432 |
+
@media screen, print {
|
433 |
+
rule1 {
|
434 |
+
prop: val; }
|
435 |
+
|
436 |
+
rule2 {
|
437 |
+
prop: val; } }
|
438 |
+
|
439 |
+
|
440 |
+
@media screen and (-webkit-min-device-pixel-ratio:0) {
|
441 |
+
a: b; }
|
442 |
+
|
443 |
+
|
444 |
+
@media only screen, print and (foo: 0px) and (bar: flam(12px solid)) {
|
445 |
+
a: b; }
|
446 |
+
|
447 |
+
|
448 |
+
:-moz-any(h1, h2, h3) {
|
449 |
+
a: b; }
|
450 |
+
|
451 |
+
|
452 |
+
:-moz-any(.foo) {
|
453 |
+
a: b; }
|
454 |
+
|
455 |
+
|
456 |
+
:-moz-any(foo bar, .baz > .bang) {
|
457 |
+
a: b; }
|
458 |
+
|
459 |
+
|
460 |
+
@-moz-document url(http://www.w3.org/),
|
461 |
+
url-prefix(http://www.w3.org/Style/),
|
462 |
+
domain(mozilla.org),
|
463 |
+
regexp("^https:.*") {
|
464 |
+
.foo {a: b}
|
465 |
+
}
|
466 |
+
|
467 |
+
|
468 |
+
foo {
|
469 |
+
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=1, startColorstr=#c0ff3300, endColorstr=#ff000000);
|
470 |
+
filter:progid:DXImageTransform.Microsoft.gradient(GradientType=1, startColorstr=#c0ff3300, endColorstr=#ff000000); }
|
471 |
+
|
472 |
+
|
473 |
+
foo {
|
474 |
+
filter: alpha(opacity=20);
|
475 |
+
filter: alpha(opacity=20, enabled=true);
|
476 |
+
filter: blaznicate(foo=bar, baz=bang bip, bart=#fa4600); }
|
477 |
+
|
478 |
+
|
479 |
+
@foo bar {
|
480 |
+
a: b; }
|
481 |
+
|
482 |
+
@bar baz {
|
483 |
+
c: d; }
|
484 |
+
|
485 |
+
|
486 |
+
@foo bar;
|
487 |
+
@bar baz;
|
488 |
+
|
489 |
+
|
490 |
+
/* Foo
|
491 |
+
* Bar */
|
492 |
+
/* Baz
|
493 |
+
* Bang */
|
494 |
+
|
495 |
+
|
496 |
+
.foo {
|
497 |
+
/* Foo
|
498 |
+
* Bar */
|
499 |
+
/* Baz
|
500 |
+
* Bang */ }
|
501 |
+
|
502 |
+
|
503 |
+
.foo {
|
504 |
+
/* Foo Bar *//* Baz Bang */ }
|
505 |
+
|
506 |
+
|
507 |
+
@namespace "http://www.w3.org/Profiles/xhtml1-strict";
|
508 |
+
|
509 |
+
@namespace url(http://www.w3.org/Profiles/xhtml1-strict);
|
510 |
+
|
511 |
+
@namespace html url("http://www.w3.org/Profiles/xhtml1-strict");
|
512 |
+
|
513 |
+
[foo|bar=baz] {
|
514 |
+
a: b; }
|
515 |
+
|
516 |
+
|
517 |
+
[*|bar=baz] {
|
518 |
+
a: b; }
|
519 |
+
|
520 |
+
|
521 |
+
[foo|bar|=baz] {
|
522 |
+
a: b; }
|
523 |
+
|
524 |
+
|
525 |
+
foo|E {
|
526 |
+
a: b; }
|
527 |
+
|
528 |
+
|
529 |
+
*|E {
|
530 |
+
a: b; }
|
531 |
+
|
532 |
+
|
533 |
+
foo|* {
|
534 |
+
a: b; }
|
535 |
+
|
536 |
+
|
537 |
+
*|* {
|
538 |
+
a: b; }
|
539 |
+
|
540 |
+
|
541 |
+
:not(foo|bar) {
|
542 |
+
a: b; }
|
543 |
+
|
544 |
+
|
545 |
+
:not(*|bar) {
|
546 |
+
a: b; }
|
547 |
+
|
548 |
+
|
549 |
+
:not(foo|*) {
|
550 |
+
a: b; }
|
551 |
+
|
552 |
+
|
553 |
+
:not(*|*) {
|
554 |
+
a: b; }
|
555 |
+
|
556 |
+
|
557 |
+
:not(#blah) {
|
558 |
+
a: b; }
|
559 |
+
|
560 |
+
|
561 |
+
:not(.blah) {
|
562 |
+
a: b; }
|
563 |
+
|
564 |
+
|
565 |
+
:not([foo]) {
|
566 |
+
a: b; }
|
567 |
+
|
568 |
+
|
569 |
+
:not([foo^="bar"]) {
|
570 |
+
a: b; }
|
571 |
+
|
572 |
+
|
573 |
+
:not([baz|foo~="bar"]) {
|
574 |
+
a: b; }
|
575 |
+
|
576 |
+
|
577 |
+
:not(:hover) {
|
578 |
+
a: b; }
|
579 |
+
|
580 |
+
|
581 |
+
:not(:nth-child(2n + 3)) {
|
582 |
+
a: b; }
|
583 |
+
|
584 |
+
|
585 |
+
:not(:not(#foo)) {
|
586 |
+
a: b; }
|
587 |
+
|
588 |
+
|
589 |
+
:not(a#foo.bar) {
|
590 |
+
a: b; }
|
591 |
+
|
592 |
+
|
593 |
+
:not(#foo .bar > baz) {
|
594 |
+
a: b; }
|
595 |
+
|
596 |
+
|
597 |
+
:not(h1, h2, h3) {
|
598 |
+
a: b; }
|
599 |
+
|
600 |
+
|
601 |
+
@mixin foo {
|
602 |
+
a: b; }
|
603 |
+
|
604 |
+
|
605 |
+
foo {
|
606 |
+
a: "bang #{1 + " bar "} bip"; }
|
607 |
+
|
608 |
+
|
609 |
+
:nth-child(-n) {
|
610 |
+
a: b; }
|
611 |
+
|
612 |
+
|
613 |
+
:nth-child(+n) {
|
614 |
+
a: b; }
|
615 |
+
|
616 |
+
|
617 |
+
:nth-child(even) {
|
618 |
+
a: b; }
|
619 |
+
|
620 |
+
|
621 |
+
:nth-child(odd) {
|
622 |
+
a: b; }
|
623 |
+
|
624 |
+
|
625 |
+
:nth-child(50) {
|
626 |
+
a: b; }
|
627 |
+
|
628 |
+
|
629 |
+
:nth-child(-50) {
|
630 |
+
a: b; }
|
631 |
+
|
632 |
+
|
633 |
+
:nth-child(+50) {
|
634 |
+
a: b; }
|
635 |
+
|
636 |
+
|
637 |
+
:nth-child(2n+3) {
|
638 |
+
a: b; }
|
639 |
+
|
640 |
+
|
641 |
+
:nth-child(2n-3) {
|
642 |
+
a: b; }
|
643 |
+
|
644 |
+
|
645 |
+
:nth-child(+2n-3) {
|
646 |
+
a: b; }
|
647 |
+
|
648 |
+
|
649 |
+
:nth-child(-2n+3) {
|
650 |
+
a: b; }
|
651 |
+
|
652 |
+
|
653 |
+
:nth-child(-2n+ 3) {
|
654 |
+
a: b; }
|
655 |
+
|
656 |
+
|
657 |
+
:nth-child( 2n + 3 ) {
|
658 |
+
a: b; }
|
659 |
+
|
660 |
+
|
661 |
+
foo {
|
662 |
+
a: foo bar baz;
|
663 |
+
b: foo, #aabbcc, -12;
|
664 |
+
c: 1px/2px/-3px;
|
665 |
+
d: foo bar, baz/bang; }
|
666 |
+
|
667 |
+
|
668 |
+
@page {
|
669 |
+
prop1: val;
|
670 |
+
prop2: val; }
|
671 |
+
|
672 |
+
|
673 |
+
@page flap {
|
674 |
+
prop1: val;
|
675 |
+
prop2: val; }
|
676 |
+
|
677 |
+
|
678 |
+
@page :first {
|
679 |
+
prop1: val;
|
680 |
+
prop2: val; }
|
681 |
+
|
682 |
+
|
683 |
+
@page flap:first {
|
684 |
+
prop1: val;
|
685 |
+
prop2: val; }
|
686 |
+
|
687 |
+
|
688 |
+
.foo {
|
689 |
+
/* Foo */
|
690 |
+
a: b; }
|
691 |
+
|
692 |
+
|
693 |
+
.foo {
|
694 |
+
/* Foo
|
695 |
+
* Bar */a: b; }
|
696 |
+
|
697 |
+
|
698 |
+
/* Foo */
|
699 |
+
.foo {
|
700 |
+
a: b; }
|
701 |
+
|
702 |
+
|
703 |
+
/* Foo
|
704 |
+
* Bar */.foo {
|
705 |
+
a: b; }
|
706 |
+
|
707 |
+
|
708 |
+
.foo /* .a #foo */ #bar:baz(/* bang )*/ bip) {
|
709 |
+
a: b; }
|
710 |
+
|
711 |
+
|
712 |
+
> E {
|
713 |
+
a: b; }
|
714 |
+
|
715 |
+
|
716 |
+
+ E {
|
717 |
+
a: b; }
|
718 |
+
|
719 |
+
|
720 |
+
~ E {
|
721 |
+
a: b; }
|
722 |
+
|
723 |
+
|
724 |
+
> > E {
|
725 |
+
a: b; }
|
726 |
+
|
727 |
+
|
728 |
+
>> E {
|
729 |
+
a: b; }
|
730 |
+
|
731 |
+
|
732 |
+
E* {
|
733 |
+
a: b; }
|
734 |
+
|
735 |
+
|
736 |
+
E*.foo {
|
737 |
+
a: b; }
|
738 |
+
|
739 |
+
|
740 |
+
E*:hover {
|
741 |
+
a: b; }
|
742 |
+
|
743 |
+
|
744 |
+
E,
|
745 |
+
F {
|
746 |
+
a: b; }
|
747 |
+
|
748 |
+
|
749 |
+
E
|
750 |
+
F {
|
751 |
+
a: b; }
|
752 |
+
|
753 |
+
|
754 |
+
E, F
|
755 |
+
G, H {
|
756 |
+
a: b; }
|
757 |
+
|
758 |
+
|
759 |
+
body {
|
760 |
+
/*
|
761 |
+
//comment here
|
762 |
+
*/
|
763 |
+
}
|
764 |
+
|
765 |
+
|
766 |
+
E>F { a: b;}
|
767 |
+
|
768 |
+
E~F { a: b;}
|
769 |
+
|
770 |
+
E+F { a: b;}
|
771 |
+
|
772 |
+
* {
|
773 |
+
a: b; }
|
774 |
+
|
775 |
+
|
776 |
+
E {
|
777 |
+
a: b; }
|
778 |
+
|
779 |
+
|
780 |
+
E[foo] {
|
781 |
+
a: b; }
|
782 |
+
|
783 |
+
|
784 |
+
E[foo="bar"] {
|
785 |
+
a: b; }
|
786 |
+
|
787 |
+
|
788 |
+
E[foo~="bar"] {
|
789 |
+
a: b; }
|
790 |
+
|
791 |
+
|
792 |
+
E[foo^="bar"] {
|
793 |
+
a: b; }
|
794 |
+
|
795 |
+
|
796 |
+
E[foo$="bar"] {
|
797 |
+
a: b; }
|
798 |
+
|
799 |
+
|
800 |
+
E[foo*="bar"] {
|
801 |
+
a: b; }
|
802 |
+
|
803 |
+
|
804 |
+
E[foo|="en"] {
|
805 |
+
a: b; }
|
806 |
+
|
807 |
+
|
808 |
+
E:root {
|
809 |
+
a: b; }
|
810 |
+
|
811 |
+
|
812 |
+
E:nth-child(n) {
|
813 |
+
a: b; }
|
814 |
+
|
815 |
+
|
816 |
+
E:nth-last-child(n) {
|
817 |
+
a: b; }
|
818 |
+
|
819 |
+
|
820 |
+
E:nth-of-type(n) {
|
821 |
+
a: b; }
|
822 |
+
|
823 |
+
|
824 |
+
E:nth-last-of-type(n) {
|
825 |
+
a: b; }
|
826 |
+
|
827 |
+
|
828 |
+
E:first-child {
|
829 |
+
a: b; }
|
830 |
+
|
831 |
+
|
832 |
+
E:last-child {
|
833 |
+
a: b; }
|
834 |
+
|
835 |
+
|
836 |
+
E:first-of-type {
|
837 |
+
a: b; }
|
838 |
+
|
839 |
+
|
840 |
+
E:last-of-type {
|
841 |
+
a: b; }
|
842 |
+
|
843 |
+
|
844 |
+
E:only-child {
|
845 |
+
a: b; }
|
846 |
+
|
847 |
+
|
848 |
+
E:only-of-type {
|
849 |
+
a: b; }
|
850 |
+
|
851 |
+
|
852 |
+
E:empty {
|
853 |
+
a: b; }
|
854 |
+
|
855 |
+
|
856 |
+
E:link {
|
857 |
+
a: b; }
|
858 |
+
|
859 |
+
|
860 |
+
E:visited {
|
861 |
+
a: b; }
|
862 |
+
|
863 |
+
|
864 |
+
E:active {
|
865 |
+
a: b; }
|
866 |
+
|
867 |
+
|
868 |
+
E:hover {
|
869 |
+
a: b; }
|
870 |
+
|
871 |
+
|
872 |
+
E:focus {
|
873 |
+
a: b; }
|
874 |
+
|
875 |
+
|
876 |
+
E:target {
|
877 |
+
a: b; }
|
878 |
+
|
879 |
+
|
880 |
+
E:lang(fr) {
|
881 |
+
a: b; }
|
882 |
+
|
883 |
+
|
884 |
+
E:enabled {
|
885 |
+
a: b; }
|
886 |
+
|
887 |
+
|
888 |
+
E:disabled {
|
889 |
+
a: b; }
|
890 |
+
|
891 |
+
|
892 |
+
E:checked {
|
893 |
+
a: b; }
|
894 |
+
|
895 |
+
|
896 |
+
E::first-line {
|
897 |
+
a: b; }
|
898 |
+
|
899 |
+
|
900 |
+
E::first-letter {
|
901 |
+
a: b; }
|
902 |
+
|
903 |
+
|
904 |
+
E::before {
|
905 |
+
a: b; }
|
906 |
+
|
907 |
+
|
908 |
+
E::after {
|
909 |
+
a: b; }
|
910 |
+
|
911 |
+
|
912 |
+
E.warning {
|
913 |
+
a: b; }
|
914 |
+
|
915 |
+
|
916 |
+
E#myid {
|
917 |
+
a: b; }
|
918 |
+
|
919 |
+
|
920 |
+
E:not(s) {
|
921 |
+
a: b; }
|
922 |
+
|
923 |
+
|
924 |
+
E F {
|
925 |
+
a: b; }
|
926 |
+
|
927 |
+
|
928 |
+
E > F {
|
929 |
+
a: b; }
|
930 |
+
|
931 |
+
|
932 |
+
E + F {
|
933 |
+
a: b; }
|
934 |
+
|
935 |
+
|
936 |
+
E ~ F {
|
937 |
+
a: b; }
|
938 |
+
|
939 |
+
|
940 |
+
@supports (a: b) and (c: d) or (not (d: e)) and ((not (f: g)) or (not ((h: i) and (j: k)))) {
|
941 |
+
.foo {
|
942 |
+
a: b;
|
943 |
+
}
|
944 |
+
}
|
945 |
+
|
946 |
+
|
947 |
+
@-prefix-supports (a: b) and (c: d) or (not (d: e)) and ((not (f: g)) or (not ((h: i) and (j: k)))) {
|
948 |
+
.foo {
|
949 |
+
a: b;
|
950 |
+
}
|
951 |
+
}
|
952 |
+
|
953 |
+
|
954 |
+
foo {
|
955 |
+
foo: bar;
|
956 |
+
#baz: bang;
|
957 |
+
#bip: bop; }
|
958 |
+
|
959 |
+
|
960 |
+
foo {
|
961 |
+
a: -2;
|
962 |
+
b: -2.3em;
|
963 |
+
c: -50%;
|
964 |
+
d: -foo(bar baz); }
|
965 |
+
|
966 |
+
|
967 |
+
foo {
|
968 |
+
a: -0.5em;
|
969 |
+
b: +0.5em;
|
970 |
+
c: -foo(12px);
|
971 |
+
d: +foo(12px);
|
972 |
+
}
|
973 |
+
|
974 |
+
|
975 |
+
@charset "UTF-8";
|
976 |
+
|
977 |
+
foo {
|
978 |
+
-moz-foo-bar: blat;
|
979 |
+
-o-flat-blang: wibble; }
|
980 |
+
|
981 |
+
|
982 |
+
foo {
|
983 |
+
a: foo();
|
984 |
+
b: bar baz-bang() bip; }
|
985 |
+
|
986 |
+
|
src/app/Mappers/scssphp/tests/inputs/selectors.scss
ADDED
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
* { color: blue; }
|
2 |
+
E { color: blue; }
|
3 |
+
|
4 |
+
E:not(:link) { color: blue; }
|
5 |
+
E:not(:link):not(:visited) { color: blue; }
|
6 |
+
E:not(:link, :visited) { color: blue; }
|
7 |
+
E:matches(:hover, :focus) { color: blue; }
|
8 |
+
|
9 |
+
E.warning { color: blue; }
|
10 |
+
E#id { color: blue; }
|
11 |
+
E[foo] { color: blue; }
|
12 |
+
E[foo="barbar"] { color: blue; }
|
13 |
+
E[foo="barbar" i] { color: blue; }
|
14 |
+
E[foo~="hello#$@%@$#^"] { color: blue; }
|
15 |
+
E[foo^="color: green;"] { color: blue; }
|
16 |
+
E[foo$="239023"] { color: blue; }
|
17 |
+
E[foo*="29302"] { color: blue; }
|
18 |
+
E[foo|="239032"] { color: blue; }
|
19 |
+
|
20 |
+
[foo] { color: blue; }
|
21 |
+
[foo] .helloWorld { color: blue; }
|
22 |
+
[foo].helloWorld { color: blue; }
|
23 |
+
[foo="barbar"] { color: blue; }
|
24 |
+
[foo~="hello#$@%@$#^"] { color: blue; }
|
25 |
+
[foo^="color: green;"] { color: blue; }
|
26 |
+
[foo$="239023"] { color: blue; }
|
27 |
+
[foo*="29302"] { color: blue; }
|
28 |
+
[foo|="239032"] { color: blue; }
|
29 |
+
|
30 |
+
E:dir(ltr) { color: blue; }
|
31 |
+
E:lang(en) { color: blue; }
|
32 |
+
E:lang(en, fr) { color: blue; }
|
33 |
+
|
34 |
+
E:any-link { color: blue; }
|
35 |
+
E:link { color: blue; }
|
36 |
+
E:visited { color: blue; }
|
37 |
+
E:local-link { color: blue; }
|
38 |
+
E:local-link(0) { color: red; }
|
39 |
+
E:local-link(1) { color: white; }
|
40 |
+
E:local-link(2) { color: red; }
|
41 |
+
E:target { color: blue; }
|
42 |
+
E:scope { color: blue; }
|
43 |
+
|
44 |
+
E:current { color: blue; }
|
45 |
+
E:current(:link) { color: blue; }
|
46 |
+
E:past { color: blue; }
|
47 |
+
E:future { color: blue; }
|
48 |
+
|
49 |
+
E:active { color: blue; }
|
50 |
+
E:hover { color: blue; }
|
51 |
+
E:focus { color: blue; }
|
52 |
+
E:enabled { color: blue; }
|
53 |
+
E:disabled { color: blue; }
|
54 |
+
E:indeterminate { color: blue; }
|
55 |
+
E:default { color: blue; }
|
56 |
+
E:in-range { color: blue; }
|
57 |
+
E:out-of-range { color: blue; }
|
58 |
+
E:required { color: blue; }
|
59 |
+
E:optional { color: blue; }
|
60 |
+
E:read-only { color: blue; }
|
61 |
+
E:read-write { color: blue; }
|
62 |
+
|
63 |
+
E:root { color: blue; }
|
64 |
+
E:empty { color: blue; }
|
65 |
+
E:first-child { color: blue; }
|
66 |
+
E:nth-child(odd) { color: blue; }
|
67 |
+
E:nth-child(2n+1) { color: blue; }
|
68 |
+
E:nth-child(5) { color: blue; }
|
69 |
+
E:last-child { color: blue; }
|
70 |
+
E:nth-last-child(-n+2) { color: blue; }
|
71 |
+
E:only-child { color: blue; }
|
72 |
+
E:first-of-type { color: blue; }
|
73 |
+
E:nth-of-type(2n) { color: blue; }
|
74 |
+
E:last-of-type { color: blue; }
|
75 |
+
E:nth-last-of-type(n) { color: blue; }
|
76 |
+
E:only-of-type { color: blue; }
|
77 |
+
E:nth-match(odd) { color: blue; }
|
78 |
+
E:nth-last-match(odd) { color: blue; }
|
79 |
+
|
80 |
+
E:column(n) { color: blue; }
|
81 |
+
E:nth-column(n) { color: blue; }
|
82 |
+
E:nth-last-column(n) { color: blue; }
|
83 |
+
|
84 |
+
E F { color: blue; }
|
85 |
+
E > F { color: blue; }
|
86 |
+
E + F { color: blue; }
|
87 |
+
E ~ F { color: blue; }
|
88 |
+
E /foo/ F { color: blue; }
|
89 |
+
E! > F { color: blue; }
|
90 |
+
|
91 |
+
// namespaces
|
92 |
+
[foo|att=val] { color: blue }
|
93 |
+
[*|att] { color: yellow }
|
94 |
+
[|att] { color: green }
|
95 |
+
[att] { color: green }
|
96 |
+
|
97 |
+
// CSS2.1
|
98 |
+
E::first-line { color: blue; }
|
99 |
+
E::first-letter { color: blue; }
|
100 |
+
E::before { color: blue; }
|
101 |
+
E::after { color: blue; }
|
102 |
+
|
103 |
+
// CSS3 UI (at risk)
|
104 |
+
E::choices { color: blue; }
|
105 |
+
E::value { color: blue; }
|
106 |
+
E::repeat-index { color: blue; }
|
107 |
+
E::repeat-item { color: blue; }
|
108 |
+
|
109 |
+
E:first { color: blue; }
|
110 |
+
E:first-line { color: blue; }
|
111 |
+
E:first-letter { color: blue; }
|
112 |
+
E:before{ color: blue; }
|
113 |
+
E:after { color: blue; }
|
114 |
+
E:checked { color: blue; }
|
115 |
+
E:invalid { color: blue; }
|
116 |
+
E:valid { color: blue; }
|
117 |
+
E:left { color: blue; }
|
118 |
+
E:right { color: blue; }
|
119 |
+
|
120 |
+
// -moz experimental
|
121 |
+
E:any(ol) { color: blue; }
|
122 |
+
E::selection { color: blue; }
|
123 |
+
|
124 |
+
// one of these is nested property,
|
125 |
+
// the other is a css block.
|
126 |
+
div {
|
127 |
+
font:something {
|
128 |
+
size: 30em;
|
129 |
+
}
|
130 |
+
|
131 |
+
font: something {
|
132 |
+
size: 30em;
|
133 |
+
}
|
134 |
+
|
135 |
+
}
|
136 |
+
|
137 |
+
// self selector
|
138 |
+
|
139 |
+
.something {
|
140 |
+
&.world {
|
141 |
+
color: blue;
|
142 |
+
}
|
143 |
+
|
144 |
+
& .mold {
|
145 |
+
height: 200px;
|
146 |
+
}
|
147 |
+
|
148 |
+
.dog & {
|
149 |
+
color: blue;
|
150 |
+
}
|
151 |
+
}
|
152 |
+
|
153 |
+
.simple {
|
154 |
+
.dad & .wolf {
|
155 |
+
color: blue;
|
156 |
+
}
|
157 |
+
|
158 |
+
.rad&.bad {
|
159 |
+
color: blue;
|
160 |
+
}
|
161 |
+
|
162 |
+
}
|
163 |
+
|
164 |
+
div {
|
165 |
+
.something & .what {
|
166 |
+
&.world {
|
167 |
+
color: blue;
|
168 |
+
}
|
169 |
+
}
|
170 |
+
}
|
171 |
+
|
172 |
+
div {
|
173 |
+
&.foo & {
|
174 |
+
color: blue;
|
175 |
+
}
|
176 |
+
}
|
177 |
+
|
178 |
+
.main, div {
|
179 |
+
.message div {
|
180 |
+
.title {
|
181 |
+
.nice-fonts & {
|
182 |
+
font-size: 24px;
|
183 |
+
}
|
184 |
+
}
|
185 |
+
}
|
186 |
+
}
|
187 |
+
|
src/app/Mappers/scssphp/tests/inputs/values.scss
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
#values {
|
3 |
+
color: #eee;
|
4 |
+
color: #eeeeee;
|
5 |
+
height: 20px;
|
6 |
+
width: 80%;
|
7 |
+
color: "hello world";
|
8 |
+
height: url("http://google.com");
|
9 |
+
dads: url(http://leafo.net);
|
10 |
+
padding: 10px 10px 10px 10px, 3px 3px 3px;
|
11 |
+
textblock: "This is a \
|
12 |
+
multiline block \
|
13 |
+
#not { color: #eee;}";
|
14 |
+
margin: 4,3,1;
|
15 |
+
content: "This is a \
|
16 |
+
multiline string.";
|
17 |
+
border-radius: -1px -1px -1px black;
|
18 |
+
}
|
19 |
+
|
20 |
+
#subtraction {
|
21 |
+
lit: 10 -11;
|
22 |
+
lit: 10 - 11;
|
23 |
+
lit: 10- 11;
|
24 |
+
lit: 10-11;
|
25 |
+
|
26 |
+
$num: 100;
|
27 |
+
var: 10 -$num;
|
28 |
+
var: 10 - $num;
|
29 |
+
var: 10- $num;
|
30 |
+
var: 10-$num;
|
31 |
+
}
|
32 |
+
|
33 |
+
|
34 |
+
#special {
|
35 |
+
a: 12px expression(1 + (3 / Foo.bar("baz" + "bang") + function() {return 12;}) % 12);
|
36 |
+
}
|
37 |
+
|
38 |
+
#unary {
|
39 |
+
b: +0.5em;
|
40 |
+
c: -foo(12px);
|
41 |
+
d: +foo(12px);
|
42 |
+
}
|
43 |
+
|
src/app/Mappers/scssphp/tests/inputs/variables.scss
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
$color: red, two, three;
|
3 |
+
|
4 |
+
div {
|
5 |
+
height: $color;
|
6 |
+
}
|
7 |
+
|
8 |
+
$a: 1000;
|
9 |
+
|
10 |
+
div {
|
11 |
+
$a: 2000 !default;
|
12 |
+
num: $a;
|
13 |
+
}
|
14 |
+
|
15 |
+
div {
|
16 |
+
$b: 2000 !default;
|
17 |
+
num: $b;
|
18 |
+
}
|
19 |
+
|
20 |
+
$cool_color: null;
|
21 |
+
$cool_color: blue !default;
|
22 |
+
|
23 |
+
pre {
|
24 |
+
color: $cool_color;
|
25 |
+
}
|
26 |
+
|
27 |
+
$something_man: 100px;
|
28 |
+
cool: $something_man;
|
29 |
+
|
30 |
+
|
31 |
+
del {
|
32 |
+
$something: blue;
|
33 |
+
|
34 |
+
div {
|
35 |
+
$something: red;
|
36 |
+
pre {
|
37 |
+
color: $something;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
color: $something;
|
42 |
+
}
|
43 |
+
|
44 |
+
$font-family-simple: Arial !default;
|
45 |
+
$font-family-spaces: Helvetica Neue !default;
|
46 |
+
$font-family-quotes: "Helvetica Neue" !default;
|
47 |
+
$font-family-commas: Helvetica, Arial, sans-serif !default;
|
48 |
+
$font-family-sans: "Helvetica Neue", Helvetica, Arial, sans-serif !default;
|
49 |
+
|
50 |
+
body {
|
51 |
+
font-family: $font-family-simple;
|
52 |
+
font-family: $font-family-spaces;
|
53 |
+
font-family: $font-family-quotes;
|
54 |
+
font-family: $font-family-commas;
|
55 |
+
font-family: $font-family-sans;
|
56 |
+
}
|
src/app/Mappers/scssphp/tests/outputs/builtins.css
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#color {
|
2 |
+
color: #22ea18;
|
3 |
+
red: 34;
|
4 |
+
green: 234;
|
5 |
+
blue: 24;
|
6 |
+
color: rgba(1, 2, 4, 0.5);
|
7 |
+
a1: 1;
|
8 |
+
a2: 0.5;
|
9 |
+
mix: #020304;
|
10 |
+
rgba: rgba(170, 119, 204, 0.4);
|
11 |
+
rgba: rgba(170, 119, 204, 0.4); }
|
12 |
+
|
13 |
+
#hsl {
|
14 |
+
color: #79c653;
|
15 |
+
color: rgba(121, 198, 83, 0.5);
|
16 |
+
hue: 100deg;
|
17 |
+
sat: 50%;
|
18 |
+
lig: 55%; }
|
19 |
+
|
20 |
+
#more-color {
|
21 |
+
light: #7e3d9e;
|
22 |
+
dark: #432154;
|
23 |
+
sat: #632782;
|
24 |
+
desat: #5e3871;
|
25 |
+
gray: #545454;
|
26 |
+
comp: #48792f;
|
27 |
+
inv: #9fd086; }
|
28 |
+
|
29 |
+
#more-more-color {
|
30 |
+
op: 0.5;
|
31 |
+
opacify: rgba(1, 2, 3, 0.6);
|
32 |
+
opacify: rgba(1, 2, 3, 0.6);
|
33 |
+
transparentize: rgba(1, 2, 3, 0.4);
|
34 |
+
transparentize: rgba(1, 2, 3, 0.4);
|
35 |
+
transparentize: rgba(52, 130, 3, 0.9); }
|
36 |
+
|
37 |
+
#more-more-more-color {
|
38 |
+
color: rgba(65, 110, 79, 0.4);
|
39 |
+
color: rgba(20, 255, 216, 0);
|
40 |
+
color: rgba(55, 100, 69, 0.4);
|
41 |
+
color: rgba(0, 255, 213, 0);
|
42 |
+
color: rgba(145, 10, 10, 0);
|
43 |
+
color: rgba(5, 10, 10, 0);
|
44 |
+
color: rgba(145, 145, 145, 0);
|
45 |
+
color: rgba(5, 5, 5, 0);
|
46 |
+
color: #000A0A0A;
|
47 |
+
color: #FFAABBCC; }
|
48 |
+
|
49 |
+
#string {
|
50 |
+
color: hello what is going on;
|
51 |
+
color: "yeah";
|
52 |
+
color: "I do?"; }
|
53 |
+
|
54 |
+
#number {
|
55 |
+
color: 250%;
|
56 |
+
color: 3;
|
57 |
+
color: 3;
|
58 |
+
color: 4;
|
59 |
+
top: 10px;
|
60 |
+
top: 1ex;
|
61 |
+
width: 200%;
|
62 |
+
bottom: 10px;
|
63 |
+
padding: 3em 1in 96px 72pt; }
|
64 |
+
|
65 |
+
#list {
|
66 |
+
len: 3;
|
67 |
+
len: 1;
|
68 |
+
n: hello;
|
69 |
+
hello: one, two, three, hello;
|
70 |
+
hello: one, two, three, hello, world, what, is, going;
|
71 |
+
hello: one, two, three, hello;
|
72 |
+
index: 2;
|
73 |
+
index: false;
|
74 |
+
index: 3;
|
75 |
+
index: 1;
|
76 |
+
index: false;
|
77 |
+
index: 1;
|
78 |
+
index: false;
|
79 |
+
index: 2;
|
80 |
+
index: 2;
|
81 |
+
index: 1;
|
82 |
+
world: one, two, three, great, job;
|
83 |
+
world: one, two, three, great job;
|
84 |
+
cool: one two three great job;
|
85 |
+
cool: great job one two three;
|
86 |
+
zip: 1px solid, 2px dashed;
|
87 |
+
zip: 1px solid red, 2px dashed green; }
|
88 |
+
|
89 |
+
#introspection {
|
90 |
+
t: number;
|
91 |
+
t: string;
|
92 |
+
t: string;
|
93 |
+
t: bool;
|
94 |
+
t: color;
|
95 |
+
t: color;
|
96 |
+
t: list;
|
97 |
+
u: "";
|
98 |
+
u: "px";
|
99 |
+
u: "em";
|
100 |
+
l: true;
|
101 |
+
l: false;
|
102 |
+
c: true;
|
103 |
+
c: false;
|
104 |
+
c: true;
|
105 |
+
c: true;
|
106 |
+
c: false;
|
107 |
+
c: true; }
|
108 |
+
|
109 |
+
#if {
|
110 |
+
color: yes;
|
111 |
+
color: no;
|
112 |
+
color: yes;
|
113 |
+
color: yes; }
|
114 |
+
|
115 |
+
.transparent {
|
116 |
+
r: 0;
|
117 |
+
g: 0;
|
118 |
+
b: 0;
|
119 |
+
a: 0; }
|
120 |
+
|
121 |
+
.alpha {
|
122 |
+
a: 1;
|
123 |
+
a: 1;
|
124 |
+
a: 1;
|
125 |
+
a: 0.5;
|
126 |
+
a: alpha(currentColor); }
|
src/app/Mappers/scssphp/tests/outputs/comments.css
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/** what the heck **/
|
2 |
+
/**
|
3 |
+
|
4 |
+
Here is a block comment
|
5 |
+
|
6 |
+
**/
|
7 |
+
/*hello*/
|
8 |
+
div {
|
9 |
+
/* another property */
|
10 |
+
border: 1px solid red;
|
11 |
+
color: url('http://mage-page.com');
|
12 |
+
string: "hello /* this is not a comment */";
|
13 |
+
world: "// neither is this";
|
14 |
+
/*what if this is a comment */
|
15 |
+
string: 'hello /* this is not a comment */';
|
16 |
+
world: '// neither is this';
|
17 |
+
what-ever: 100px;
|
18 |
+
/*this is not a comment?*/
|
19 |
+
background: url(); }
|
src/app/Mappers/scssphp/tests/outputs/compass_extract.css
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#test-0 {
|
2 |
+
unit: false;
|
3 |
+
unit: true;
|
4 |
+
rhythm: 1.5em;
|
5 |
+
size: 1;
|
6 |
+
size: 1;
|
7 |
+
size: 1;
|
8 |
+
size: 2;
|
9 |
+
size: 2; }
|
10 |
+
|
11 |
+
#test-1 {
|
12 |
+
margin-top: 7.5em;
|
13 |
+
padding-top: 9em;
|
14 |
+
padding-bottom: 10.5em;
|
15 |
+
margin-bottom: 0em; }
|
16 |
+
|
17 |
+
#test-2 {
|
18 |
+
border-style: solid;
|
19 |
+
border-width: 0.0625em;
|
20 |
+
padding: 1.4375em; }
|
21 |
+
|
22 |
+
#test-3 {
|
23 |
+
border-top-style: solid;
|
24 |
+
border-top-width: 0.0625em;
|
25 |
+
padding-top: 1.4375em;
|
26 |
+
border-bottom-style: solid;
|
27 |
+
border-bottom-width: 0.0625em;
|
28 |
+
padding-bottom: 1.4375em; }
|
src/app/Mappers/scssphp/tests/outputs/content.css
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
* html #logo {
|
2 |
+
background-image: url(/logo.gif); }
|
3 |
+
|
4 |
+
.colors {
|
5 |
+
background-color: blue;
|
6 |
+
color: white;
|
7 |
+
border-color: blue; }
|
8 |
+
|
9 |
+
@media only screen and (max-width: 480px) {
|
10 |
+
body {
|
11 |
+
color: red; } }
|
12 |
+
|
13 |
+
#sidebar {
|
14 |
+
width: 300px; }
|
15 |
+
@media only screen and (max-width: 480px) {
|
16 |
+
#sidebar {
|
17 |
+
width: 100px; } }
|
18 |
+
|
19 |
+
@media only screen and (min-width: 40em) {
|
20 |
+
.grid-1 {
|
21 |
+
width: 100%; }
|
22 |
+
.grid-2 {
|
23 |
+
width: 100%; } }
|
24 |
+
|
25 |
+
@media only screen and (min-width: 40em) {
|
26 |
+
.grid-1 {
|
27 |
+
width: 100%; }
|
28 |
+
.grid-2 {
|
29 |
+
width: 100%; } }
|
src/app/Mappers/scssphp/tests/outputs/content_with_function.css
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
body {
|
2 |
+
padding: 1 px; }
|
src/app/Mappers/scssphp/tests/outputs/default_args.css
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
div {
|
2 |
+
height: red;
|
3 |
+
margin: 100px; }
|
src/app/Mappers/scssphp/tests/outputs/directives.css
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@charset "hello-world";
|
2 |
+
@page :left {
|
3 |
+
div {
|
4 |
+
color: red; } }
|
5 |
+
|
6 |
+
@page test {
|
7 |
+
@media yes {
|
8 |
+
div {
|
9 |
+
color: red; } } }
|
10 |
+
|
11 |
+
@media something {
|
12 |
+
@page {
|
13 |
+
@media else {
|
14 |
+
div {
|
15 |
+
height: 200px; } } } }
|
16 |
+
|
17 |
+
div {
|
18 |
+
color: red; }
|
19 |
+
@page yeah {
|
20 |
+
div pre {
|
21 |
+
height: 20px; } }
|
22 |
+
|
23 |
+
@font-face {
|
24 |
+
color: red;
|
25 |
+
height: 20px; }
|
26 |
+
|
27 |
+
@keyframes 'bounce' {
|
28 |
+
from {
|
29 |
+
top: 100px;
|
30 |
+
animation-timing-function: ease-out; }
|
31 |
+
|
32 |
+
25% {
|
33 |
+
top: 50px;
|
34 |
+
animation-timing-function: ease-in; }
|
35 |
+
|
36 |
+
50% {
|
37 |
+
top: 100px;
|
38 |
+
animation-timing-function: ease-out; }
|
39 |
+
|
40 |
+
75% {
|
41 |
+
top: 75px;
|
42 |
+
animation-timing-function: ease-in; }
|
43 |
+
|
44 |
+
to {
|
45 |
+
top: 100px; } }
|
46 |
+
|
47 |
+
@-webkit-keyframes flowouttoleft {
|
48 |
+
0% {
|
49 |
+
-webkit-transform: translateX(0) scale(1); }
|
50 |
+
|
51 |
+
60%, 70% {
|
52 |
+
-webkit-transform: translateX(0) scale(0.7); }
|
53 |
+
|
54 |
+
100% {
|
55 |
+
-webkit-transform: translateX(-100%) scale(0.7); } }
|
56 |
+
|
57 |
+
div {
|
58 |
+
animation-name: 'diagonal-slide';
|
59 |
+
animation-duration: 5s;
|
60 |
+
animation-iteration-count: 10; }
|
61 |
+
|
62 |
+
@keyframes 'diagonal-slide' {
|
63 |
+
from {
|
64 |
+
left: 0;
|
65 |
+
top: 0; }
|
66 |
+
|
67 |
+
to {
|
68 |
+
left: 100px;
|
69 |
+
top: 100px; } }
|
70 |
+
|
71 |
+
@document url(http://www.w3.org/),
|
72 |
+
url-prefix(http://www.w3.org/Style/),
|
73 |
+
domain(mozilla.org),
|
74 |
+
regexp("https:.*") {
|
75 |
+
body {
|
76 |
+
color: purple;
|
77 |
+
background: yellow; } }
|
src/app/Mappers/scssphp/tests/outputs/extends.css
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
error, pre seriousError, span seriousError, other, hello {
|
2 |
+
border: 1px #f00;
|
3 |
+
background-color: #fdd; }
|
4 |
+
|
5 |
+
pre seriousError, span seriousError {
|
6 |
+
font-size: 20px; }
|
7 |
+
|
8 |
+
hello {
|
9 |
+
color: green; }
|
10 |
+
hello div {
|
11 |
+
margin: 10px; }
|
12 |
+
|
13 |
+
.cool, .me {
|
14 |
+
color: red; }
|
15 |
+
|
16 |
+
.blue, .me {
|
17 |
+
color: purple; }
|
18 |
+
|
19 |
+
a:hover, .hoverlink, #demo .overview .fakelink:hover {
|
20 |
+
text-decoration: underline; }
|
21 |
+
|
22 |
+
div.hello.world.hmm, pre div.okay.span.world.hmm, pre #butt .umm div.sure.span.world.hmm, #butt .umm pre div.sure.span.world.hmm, code div.okay.span.world.hmm, code #butt .umm div.sure.span.world.hmm, #butt .umm code div.sure.span.world.hmm {
|
23 |
+
color: blue; }
|
24 |
+
|
25 |
+
.xxxxx .xxxxx .xxxxx, code .xxxxx .xxxxx, code code .xxxxx, code code code, code .xxxxx code, .xxxxx code .xxxxx, .xxxxx code code, .xxxxx .xxxxx code {
|
26 |
+
color: green; }
|
27 |
+
|
28 |
+
code {
|
29 |
+
color: red; }
|
30 |
+
|
31 |
+
.alpha, .beta, .gama {
|
32 |
+
color: red; }
|
33 |
+
|
34 |
+
.beta, .gama {
|
35 |
+
color: white; }
|
36 |
+
|
37 |
+
.gama {
|
38 |
+
color: blue; }
|
39 |
+
|
40 |
+
#admin .tabbar a, #admin .tabbar #demo .overview .fakelink, #demo .overview #admin .tabbar .fakelink {
|
41 |
+
font-weight: bold; }
|
42 |
+
|
43 |
+
a1 b1 c1 d1, x1 y1 z1 w1 b1 c1 d1 {
|
44 |
+
color: red; }
|
45 |
+
|
46 |
+
a2 b2 c2 d2, a2 x2 y2 z2 w2 c2 d2, x2 y2 z2 a2 w2 c2 d2 {
|
47 |
+
color: red; }
|
48 |
+
|
49 |
+
a3 b3 c3 d3, a3 b3 x3 y3 z3 w3 d3, x3 y3 z3 a3 b3 w3 d3 {
|
50 |
+
color: red; }
|
51 |
+
|
52 |
+
a4 b4 c4 d4, a4 b4 c4 x4 y4 z4 w4, x4 y4 z4 a4 b4 c4 w4 {
|
53 |
+
color: red; }
|
54 |
+
|
55 |
+
#butt .yeah .okay, #butt .yeah .umm .sure, #butt .umm .yeah .sure {
|
56 |
+
font-weight: bold; }
|
57 |
+
|
58 |
+
a9 b9 s9 t9 v9, a9 b9 s9 t9 x9 y9 z9, a9 b9 x9 y9 s9 t9 z9 {
|
59 |
+
color: red; }
|
60 |
+
|
61 |
+
@media print {
|
62 |
+
horse, man {
|
63 |
+
color: blue; } }
|
64 |
+
|
65 |
+
man {
|
66 |
+
color: red; }
|
67 |
+
|
68 |
+
wassup {
|
69 |
+
color: blue; }
|
70 |
+
|
71 |
+
.foo .wassup {
|
72 |
+
color: blue; }
|
73 |
+
|
74 |
+
#something, .x, .y {
|
75 |
+
color: red; }
|
76 |
+
|
77 |
+
.nav-justified, .nav-tabs.nav-justified {
|
78 |
+
text-align: justify; }
|
79 |
+
|
80 |
+
.btn:hover, .edit .actions button:hover, .edit .new .actions button:hover, .btn:active, .edit .actions button:active, .edit .new .actions button:active, .btn.active, .edit .actions button.active, .edit .new .actions button.active, .btn.disabled, .edit .actions button.disabled, .edit .new .actions button.disabled, .btn[disabled], .edit .actions button[disabled], .edit .new .actions button[disabled] {
|
81 |
+
color: red; }
|
82 |
+
|
83 |
+
.edit .actions button {
|
84 |
+
float: right; }
|
85 |
+
|
86 |
+
.edit .new .actions {
|
87 |
+
padding: 0; }
|
src/app/Mappers/scssphp/tests/outputs/filter_effects.css
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#number {
|
2 |
+
-webkit-filter: grayscale(1) sepia(0.5) saturate(0.1) invert(1) opacity(0.5) brightness(0.5) contrast(0.5); }
|
3 |
+
|
4 |
+
#percentage {
|
5 |
+
-webkit-filter: grayscale(100%) sepia(50%) saturate(10%) invert(100%) opacity(50%) brightness(50%) contrast(50%); }
|
6 |
+
|
7 |
+
#misc {
|
8 |
+
-webkit-filter: hue-rotate(90deg) blur(10px) drop-shadow(10px -16px 30px purple); }
|
9 |
+
|
10 |
+
#decimal {
|
11 |
+
opacity: 0.5;
|
12 |
+
filter: alpha(opacity=50, style=1); }
|
13 |
+
|
14 |
+
#percent {
|
15 |
+
opacity: 0.5;
|
16 |
+
filter: alpha(opacity=50); }
|
17 |
+
|
18 |
+
.row {
|
19 |
+
background-color: #071c23;
|
20 |
+
color: #2284a1; }
|
src/app/Mappers/scssphp/tests/outputs/functions.css
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
div {
|
2 |
+
color: 14px;
|
3 |
+
sum: 23; }
|
4 |
+
|
5 |
+
div {
|
6 |
+
hello: 10 55;
|
7 |
+
hello: 1010 55;
|
8 |
+
hello: "hello 10 and 55"; }
|
9 |
+
|
10 |
+
del {
|
11 |
+
color: 1000; }
|
12 |
+
|
13 |
+
div {
|
14 |
+
hello: "hello foo and bar";
|
15 |
+
hello: "hello bar and default";
|
16 |
+
hello: "hello Alice, Bob, Tom"; }
|
17 |
+
|
18 |
+
.foo {
|
19 |
+
test2: -moz-art; }
|
20 |
+
|
21 |
+
div span {
|
22 |
+
height: 3px; }
|
src/app/Mappers/scssphp/tests/outputs/ie7.css
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#foo:before {
|
2 |
+
content: counter(item,".") ": "; }
|
3 |
+
|
4 |
+
#bar:before {
|
5 |
+
content: counter(item,"."); }
|
6 |
+
|
7 |
+
#fu:before {
|
8 |
+
content: counter(item); }
|
src/app/Mappers/scssphp/tests/outputs/if.css
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
div {
|
2 |
+
color: blue; }
|
3 |
+
|
4 |
+
pre {
|
5 |
+
val-1: "red";
|
6 |
+
val-2: "blue";
|
7 |
+
val-3: "blue";
|
8 |
+
val-4: "red";
|
9 |
+
val-5: "red"; }
|
10 |
+
|
11 |
+
span {
|
12 |
+
color: blue;
|
13 |
+
height: 10px;
|
14 |
+
width: 20px; }
|
15 |
+
|
16 |
+
div {
|
17 |
+
color: blue;
|
18 |
+
border-color: green; }
|
19 |
+
|
20 |
+
del {
|
21 |
+
thing: no; }
|
src/app/Mappers/scssphp/tests/outputs/if_on_null.css
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
body {
|
2 |
+
background-color: "red"; }
|
src/app/Mappers/scssphp/tests/outputs/import.css
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import "foo.css";
|
2 |
+
@import "foo" screen;
|
3 |
+
@import "http://foo.com/bar";
|
4 |
+
@import url(foo);
|
5 |
+
div {
|
6 |
+
height: 200px;
|
7 |
+
color: red; }
|
8 |
+
|
9 |
+
pre {
|
10 |
+
color: red; }
|
11 |
+
pre div {
|
12 |
+
height: 200px;
|
13 |
+
color: red; }
|
14 |
+
|
15 |
+
code div {
|
16 |
+
height: 200px;
|
17 |
+
color: red; }
|
18 |
+
code div {
|
19 |
+
height: 200px;
|
20 |
+
color: red; }
|
21 |
+
|
22 |
+
#partial {
|
23 |
+
color: blue; }
|
24 |
+
|
25 |
+
body {
|
26 |
+
color: #7c2;
|
27 |
+
background: gray; }
|
src/app/Mappers/scssphp/tests/outputs/interpolation.css
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
div {
|
2 |
+
color: redwhite blue;
|
3 |
+
color: red white blue;
|
4 |
+
color: red whiteblue;
|
5 |
+
color: redwhiteblue;
|
6 |
+
color: ummyeahwhat;
|
7 |
+
color: stacked;
|
8 |
+
font-size: 10px/something;
|
9 |
+
font-size: 10px / something;
|
10 |
+
test: "whatworldwrong";
|
11 |
+
test: "whatworldwrong";
|
12 |
+
test: "whatworldwrong";
|
13 |
+
test: "what"world"wrong";
|
14 |
+
hi: "what is 16 end"; }
|
15 |
+
|
16 |
+
pre var {
|
17 |
+
color: red; }
|
18 |
+
pre var dad {
|
19 |
+
color: red; }
|
20 |
+
pre bedvardad {
|
21 |
+
color: red; }
|
22 |
+
|
23 |
+
cool .thing-1 {
|
24 |
+
color: red; }
|
25 |
+
cool .thing-2 {
|
26 |
+
color: red; }
|
27 |
+
cool .thing-3 {
|
28 |
+
color: red; }
|
29 |
+
cool .thing-4 {
|
30 |
+
color: red; }
|
31 |
+
cool .thing-5 {
|
32 |
+
color: red; }
|
33 |
+
|
34 |
+
abcde {
|
35 |
+
color: red; }
|
36 |
+
|
37 |
+
#hello, .world {
|
38 |
+
color: red; }
|
39 |
+
|
40 |
+
#abchelloyeah, .coolworldyes {
|
41 |
+
color: red; }
|
42 |
+
|
43 |
+
div.element:nth-child(2n) {
|
44 |
+
display: none; }
|
45 |
+
|
46 |
+
div {
|
47 |
+
hello: world;
|
48 |
+
coolhello: world;
|
49 |
+
helloone: world;
|
50 |
+
twohelloone: world;
|
51 |
+
oneabtwo: cool;
|
52 |
+
hello-world: red;
|
53 |
+
hello-mold: white;
|
54 |
+
hello-hello: blue; }
|
src/app/Mappers/scssphp/tests/outputs/keyword_args.css
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
pre {
|
2 |
+
out: alpha fort three palace; }
|
3 |
+
|
4 |
+
div {
|
5 |
+
hello: 5;
|
6 |
+
world: -5; }
|
src/app/Mappers/scssphp/tests/outputs/list.css
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
div {
|
2 |
+
padding: 10px 20px 30px 40px;
|
3 |
+
margin: 0 10px 10px 10px;
|
4 |
+
background: linear-gradient(black, white); }
|
5 |
+
|
6 |
+
p {
|
7 |
+
background: linear-gradient(red, blue); }
|
src/app/Mappers/scssphp/tests/outputs/looping.css
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
div {
|
2 |
+
color: what;
|
3 |
+
color: is;
|
4 |
+
color: this;
|
5 |
+
font: what;
|
6 |
+
font: is;
|
7 |
+
font: this;
|
8 |
+
background: what;
|
9 |
+
background: is;
|
10 |
+
background: this;
|
11 |
+
border: what;
|
12 |
+
border: is;
|
13 |
+
border: this; }
|
14 |
+
|
15 |
+
span {
|
16 |
+
color: 0;
|
17 |
+
color: 1;
|
18 |
+
color: 2;
|
19 |
+
color: 3;
|
20 |
+
color: 4;
|
21 |
+
color: 5;
|
22 |
+
color: 6;
|
23 |
+
color: 7;
|
24 |
+
color: 8;
|
25 |
+
color: 9;
|
26 |
+
color: 10; }
|
27 |
+
|
28 |
+
pre {
|
29 |
+
color: 1;
|
30 |
+
color: 2;
|
31 |
+
color: 3;
|
32 |
+
color: 4;
|
33 |
+
height: 1;
|
34 |
+
height: 2;
|
35 |
+
height: 3;
|
36 |
+
height: 4;
|
37 |
+
height: 5;
|
38 |
+
cool: 10;
|
39 |
+
cool: 9;
|
40 |
+
cool: 8;
|
41 |
+
cool: 7;
|
42 |
+
cool: 6;
|
43 |
+
cool: 5;
|
44 |
+
cool: 4;
|
45 |
+
cool: 3; }
|
src/app/Mappers/scssphp/tests/outputs/media.css
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@media {
|
2 |
+
div {
|
3 |
+
color: blue; } }
|
4 |
+
|
5 |
+
@media what {
|
6 |
+
div {
|
7 |
+
color: blue; } }
|
8 |
+
|
9 |
+
@media (cool) {
|
10 |
+
div {
|
11 |
+
color: blue; } }
|
12 |
+
|
13 |
+
@media (cool: blue) {
|
14 |
+
div {
|
15 |
+
color: blue; } }
|
16 |
+
|
17 |
+
@media hello and (world) and (butt: man) {
|
18 |
+
div {
|
19 |
+
color: blue; } }
|
20 |
+
|
21 |
+
@media (max-width: 940px) {
|
22 |
+
color: red; }
|
23 |
+
|
24 |
+
@media not hello and (world) {
|
25 |
+
color: blue;
|
26 |
+
pre {
|
27 |
+
color: blue; } }
|
28 |
+
@media butt and (world) {
|
29 |
+
color: red;
|
30 |
+
div {
|
31 |
+
color: red; } }
|
32 |
+
|
33 |
+
div {
|
34 |
+
color: blue; }
|
35 |
+
@media screen and (-webkit-min-device-pixel-ratio: 1.5) {
|
36 |
+
div .sidebar {
|
37 |
+
width: 500px; } }
|
38 |
+
|
39 |
+
div {
|
40 |
+
position: absolute; }
|
41 |
+
@media screen {
|
42 |
+
div {
|
43 |
+
top: 0;
|
44 |
+
bottom: 8em;
|
45 |
+
color: red; }
|
46 |
+
div p {
|
47 |
+
margin: 5px; }
|
48 |
+
|
49 |
+
div .success {
|
50 |
+
color: green; } }
|
51 |
+
|
52 |
+
.button {
|
53 |
+
width: 300px;
|
54 |
+
height: 100px;
|
55 |
+
background: #eee; }
|
56 |
+
.button :hover {
|
57 |
+
background: #aaa; }
|
58 |
+
@media only screen and (max-width: 300px) {
|
59 |
+
.button {
|
60 |
+
width: 100px;
|
61 |
+
height: 100px; } }
|
62 |
+
|
63 |
+
code {
|
64 |
+
position: absolute; }
|
65 |
+
@media screen {
|
66 |
+
code {
|
67 |
+
height: 10px; }
|
68 |
+
code pre {
|
69 |
+
height: 20px; } }
|
70 |
+
|
71 |
+
@media screen and (color: blue) {
|
72 |
+
dt {
|
73 |
+
height: 10px; } }
|
74 |
+
|
75 |
+
@media screen {
|
76 |
+
.screen {
|
77 |
+
width: 12px; } }
|
78 |
+
@media only screen {
|
79 |
+
.only-screen {
|
80 |
+
height: 11px; } }
|
81 |
+
|
82 |
+
@media only screen {
|
83 |
+
.only-screen {
|
84 |
+
width: 14px; } }
|
85 |
+
@media only screen {
|
86 |
+
.only-screen {
|
87 |
+
height: 16px; } }
|
88 |
+
|
89 |
+
@media print {
|
90 |
+
.only-print {
|
91 |
+
height: 12px; } }
|
92 |
+
|
93 |
+
@media screen {
|
94 |
+
.only-print {
|
95 |
+
height: 12px; } }
|
96 |
+
|
97 |
+
@media not screen {
|
98 |
+
.not-screen {
|
99 |
+
height: 15px; } }
|
100 |
+
|
101 |
+
@media only screen and (color: blue) and (width: 13) {
|
102 |
+
.only-screen {
|
103 |
+
height: 15px; } }
|
src/app/Mappers/scssphp/tests/outputs/mixins.css
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
div {
|
2 |
+
color: blue;
|
3 |
+
color: red; }
|
4 |
+
div pre {
|
5 |
+
height: 200px; }
|
6 |
+
|
7 |
+
span {
|
8 |
+
color: blue; }
|
9 |
+
span div {
|
10 |
+
height: 20px; }
|
11 |
+
|
12 |
+
html {
|
13 |
+
height: 43px; }
|
14 |
+
|
15 |
+
del {
|
16 |
+
height: 20px; }
|
17 |
+
|
18 |
+
div {
|
19 |
+
color: white;
|
20 |
+
color: blue;
|
21 |
+
color: white; }
|
22 |
+
|
23 |
+
div {
|
24 |
+
background-image: linear-gradient(left top, red, green); }
|
25 |
+
|
26 |
+
div {
|
27 |
+
-moz-box-shadow: 10px 10px 5px #888;
|
28 |
+
-webkit-box-shadow: 10px 10px 5px #888;
|
29 |
+
box-shadow: 10px 10px 5px #888;
|
30 |
+
-moz-box-shadow: inset 10px 10px #888, -10px -10px #f4f4f4;
|
31 |
+
-webkit-box-shadow: inset 10px 10px #888, -10px -10px #f4f4f4;
|
32 |
+
box-shadow: inset 10px 10px #888, -10px -10px #f4f4f4; }
|
33 |
+
|
34 |
+
div p {
|
35 |
+
color: red;
|
36 |
+
color: blue; }
|
37 |
+
div p .class {
|
38 |
+
color: red; }
|
39 |
+
div p .class div {
|
40 |
+
height: 20px; }
|
41 |
+
div p div {
|
42 |
+
height: 20px; }
|
43 |
+
div p .top {
|
44 |
+
top: 0; }
|
45 |
+
div p .top div {
|
46 |
+
color: red; }
|
47 |
+
|
48 |
+
div.mixin-content-simple {
|
49 |
+
color: red; }
|
50 |
+
|
51 |
+
div.mixin-content-with-arg {
|
52 |
+
background: blue;
|
53 |
+
color: red; }
|
54 |
+
|
55 |
+
div.mixin-content-with-arg {
|
56 |
+
background: purple;
|
57 |
+
height: 20px; }
|
58 |
+
|
59 |
+
div.mixin-content-simple {
|
60 |
+
height: 43px; }
|
61 |
+
|
62 |
+
div.mixin-content-simple {
|
63 |
+
color: orange; }
|
64 |
+
div.mixin-content-simple div {
|
65 |
+
height: 20px; }
|
66 |
+
|
67 |
+
div.mixin-content-with-arg {
|
68 |
+
background: purple;
|
69 |
+
height: 43px; }
|
70 |
+
|
71 |
+
div.mixin-content-with-arg {
|
72 |
+
background: purple;
|
73 |
+
color: orange; }
|
74 |
+
div.mixin-content-with-arg div {
|
75 |
+
height: 20px; }
|
76 |
+
|
77 |
+
#please-wait {
|
78 |
+
background: url(/images/logo.png);
|
79 |
+
position: absolute;
|
80 |
+
top: 1em;
|
81 |
+
right: 0;
|
82 |
+
bottom: 3em;
|
83 |
+
left: 4em; }
|
src/app/Mappers/scssphp/tests/outputs/nesting.css
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
div: blue;
|
2 |
+
body {
|
3 |
+
color: red; }
|
4 |
+
|
5 |
+
div {
|
6 |
+
color: red;
|
7 |
+
height: yes; }
|
8 |
+
div pre {
|
9 |
+
color: blue; }
|
10 |
+
|
11 |
+
div {
|
12 |
+
font: 10px hello world;
|
13 |
+
font-size: 10px;
|
14 |
+
font-color: blue;
|
15 |
+
border-left: 1px solid blue;
|
16 |
+
border-right: 2px dashed green; }
|
17 |
+
|
18 |
+
#nested-nesting {
|
19 |
+
bar: baz;
|
20 |
+
bang-bop: bar;
|
21 |
+
bang-bip: 1px;
|
22 |
+
bang-blat-baf: bort; }
|
src/app/Mappers/scssphp/tests/outputs/null.css
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.div {
|
2 |
+
one: null;
|
3 |
+
one: world;
|
4 |
+
one: NULL world;
|
5 |
+
one: a, b;
|
6 |
+
two: a, b; }
|
7 |
+
|
8 |
+
p:before {
|
9 |
+
content: "I ate pies!"; }
|
10 |
+
|
11 |
+
.foo {
|
12 |
+
-webkit-border-radius: 10;
|
13 |
+
border-radius: 10; }
|
14 |
+
|
15 |
+
.fu {
|
16 |
+
-webkit-border-radius: 20;
|
17 |
+
border-radius: 20; }
|
18 |
+
|
19 |
+
.bar {
|
20 |
+
-webkit-border-top-left-radius: 30;
|
21 |
+
border-top-left-radius: 30; }
|
src/app/Mappers/scssphp/tests/outputs/operators.css
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
body {
|
2 |
+
color: 8;
|
3 |
+
color: 16;
|
4 |
+
height: 10px/10px;
|
5 |
+
color: 6px;
|
6 |
+
color: 5px;
|
7 |
+
bottom: 2px;
|
8 |
+
top: 1.5em;
|
9 |
+
left: -1cm;
|
10 |
+
top: 6.29921; }
|
11 |
+
|
12 |
+
div {
|
13 |
+
color: false;
|
14 |
+
color: true;
|
15 |
+
color: true;
|
16 |
+
color: false;
|
17 |
+
color: what > 3; }
|
18 |
+
|
19 |
+
#units {
|
20 |
+
test: 2.5748in;
|
21 |
+
test: 13mm;
|
22 |
+
test: 4em;
|
23 |
+
test: 11mm;
|
24 |
+
test: 1.1cm; }
|
25 |
+
|
26 |
+
#modulo {
|
27 |
+
test: 1;
|
28 |
+
test: 1cm; }
|
29 |
+
|
30 |
+
#colors {
|
31 |
+
color: #ff0203;
|
32 |
+
color: #fe0000;
|
33 |
+
color: rgba(3, 8, 15, 0.5);
|
34 |
+
color: rgba(5, 8, 10, 0.5);
|
35 |
+
color: rgba(2, 4, 6, 0.5);
|
36 |
+
color: rgba(1, 1, 2, 0.5);
|
37 |
+
color: rgba(3, 4, 5, 0.5);
|
38 |
+
color: rgba(0, 0, 1, 0.5);
|
39 |
+
color: #22f;
|
40 |
+
color: false;
|
41 |
+
color: true;
|
42 |
+
color: true;
|
43 |
+
color: false; }
|
44 |
+
|
45 |
+
#preserve {
|
46 |
+
hello: what -going;
|
47 |
+
hello: what - going; }
|
48 |
+
|
49 |
+
#strings {
|
50 |
+
hello: what -going;
|
51 |
+
hello: whatgoing;
|
52 |
+
hello: whatgoing;
|
53 |
+
hello: whatgoing;
|
54 |
+
hello: whatgoing;
|
55 |
+
hello: "whatgoing";
|
56 |
+
hello: goingwhat;
|
57 |
+
hello: "whatwhat"; }
|
58 |
+
|
59 |
+
#negation {
|
60 |
+
a: -60;
|
61 |
+
b: 10 -100;
|
62 |
+
b: -90; }
|
63 |
+
|
64 |
+
#bools-fail {
|
65 |
+
and: false and two;
|
66 |
+
and: one and two;
|
67 |
+
and: one and false;
|
68 |
+
or: false or two;
|
69 |
+
or: one or two;
|
70 |
+
or: one or false; }
|
71 |
+
|
72 |
+
#bools {
|
73 |
+
and: false;
|
74 |
+
and: two;
|
75 |
+
and: false;
|
76 |
+
or: two;
|
77 |
+
or: one;
|
78 |
+
or: one; }
|
79 |
+
|
80 |
+
#nots-fail {
|
81 |
+
not: false2;
|
82 |
+
not: not false;
|
83 |
+
not: not 0;
|
84 |
+
not: not 1;
|
85 |
+
not: not "";
|
86 |
+
not: not hello; }
|
87 |
+
|
88 |
+
#nots {
|
89 |
+
not: false2;
|
90 |
+
not: true;
|
91 |
+
not: false;
|
92 |
+
not: false;
|
93 |
+
not: false;
|
94 |
+
not: false; }
|
95 |
+
|
96 |
+
#string-test {
|
97 |
+
str: true;
|
98 |
+
str: false;
|
99 |
+
str: true;
|
100 |
+
str: true;
|
101 |
+
str: xhellohellofalse;
|
102 |
+
str: true; }
|
103 |
+
|
104 |
+
#special {
|
105 |
+
cancel-unit: 1; }
|
src/app/Mappers/scssphp/tests/outputs/placeholder_selector.css
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
p a.notice span, p a.error span, #context a.notice span, #context a.error span {
|
2 |
+
color: blue;
|
3 |
+
font-weight: bold;
|
4 |
+
font-size: 2em; }
|
5 |
+
|
6 |
+
p {
|
7 |
+
padding: 2em; }
|
src/app/Mappers/scssphp/tests/outputs/scss_css.css
ADDED
@@ -0,0 +1,741 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import "foo.css";
|
2 |
+
@import 'foo.css';
|
3 |
+
@import url("foo.css");
|
4 |
+
@import url('foo.css');
|
5 |
+
@import url(foo.css);
|
6 |
+
@import "foo.css" screen;
|
7 |
+
@import "foo.css" screen, print;
|
8 |
+
/* Foo
|
9 |
+
* Bar */
|
10 |
+
/* Baz
|
11 |
+
* Bang */
|
12 |
+
@charset "UTF-8";
|
13 |
+
[foo~=bar] {
|
14 |
+
a: b; }
|
15 |
+
|
16 |
+
[foo^=bar] {
|
17 |
+
a: b; }
|
18 |
+
|
19 |
+
[foo$=bar] {
|
20 |
+
a: b; }
|
21 |
+
|
22 |
+
[foo*=bar] {
|
23 |
+
a: b; }
|
24 |
+
|
25 |
+
[foo|=en] {
|
26 |
+
a: b; }
|
27 |
+
|
28 |
+
foo {
|
29 |
+
a: 2;
|
30 |
+
b: 2.3em;
|
31 |
+
c: 50%;
|
32 |
+
d: "fraz bran";
|
33 |
+
e: flanny-blanny-blan;
|
34 |
+
f: url(http://sass-lang.com);
|
35 |
+
h: #abc; }
|
36 |
+
|
37 |
+
selector {
|
38 |
+
property: value;
|
39 |
+
property2: value; }
|
40 |
+
|
41 |
+
sel {
|
42 |
+
p: v; }
|
43 |
+
|
44 |
+
.foo {
|
45 |
+
a: b; }
|
46 |
+
|
47 |
+
.foo {
|
48 |
+
a: b; }
|
49 |
+
|
50 |
+
.foo {
|
51 |
+
a: b; }
|
52 |
+
|
53 |
+
.foo {
|
54 |
+
a: b; }
|
55 |
+
|
56 |
+
@foo {
|
57 |
+
a: b;
|
58 |
+
rule {
|
59 |
+
a: b; } }
|
60 |
+
|
61 |
+
@foo {
|
62 |
+
a: b; }
|
63 |
+
|
64 |
+
@bar {
|
65 |
+
a: b; }
|
66 |
+
|
67 |
+
@foo "bar"
|
68 |
+
|
69 |
+
foo {
|
70 |
+
a: 12px calc(100%/3 - 2*1em - 2*1px);
|
71 |
+
b: 12px -moz-calc(100%/3 - 2*1em - 2*1px);
|
72 |
+
b: 12px -webkit-calc(100%/3 - 2*1em - 2*1px);
|
73 |
+
b: 12px -foobar-calc(100%/3 - 2*1em - 2*1px); }
|
74 |
+
|
75 |
+
foo {
|
76 |
+
bar: baz; }
|
77 |
+
|
78 |
+
bar {
|
79 |
+
bar: baz; }
|
80 |
+
|
81 |
+
baz {
|
82 |
+
bar: baz;
|
83 |
+
/*
|
84 |
+
* foo
|
85 |
+
*/ }
|
86 |
+
|
87 |
+
bar {
|
88 |
+
baz: bang; }
|
89 |
+
|
90 |
+
E, F {
|
91 |
+
a: b; }
|
92 |
+
|
93 |
+
E F, G H {
|
94 |
+
a: b; }
|
95 |
+
|
96 |
+
E > F, G > H {
|
97 |
+
a: b;
|
98 |
+
/* This is a CSS comment. */ }
|
99 |
+
|
100 |
+
.one {
|
101 |
+
color: green;
|
102 |
+
/* Another comment */
|
103 |
+
/* The following should not be used:
|
104 |
+
.two {color: red;} */ }
|
105 |
+
|
106 |
+
.three {
|
107 |
+
/* color: red; */
|
108 |
+
color: green;
|
109 |
+
/**
|
110 |
+
.four {color: red;} */ }
|
111 |
+
|
112 |
+
.five {
|
113 |
+
color: green;
|
114 |
+
/**/ }
|
115 |
+
|
116 |
+
.six {
|
117 |
+
color: green;
|
118 |
+
/*********/ }
|
119 |
+
|
120 |
+
.seven {
|
121 |
+
color: green;
|
122 |
+
/* a comment **/ }
|
123 |
+
|
124 |
+
.eight {
|
125 |
+
color: green; }
|
126 |
+
|
127 |
+
foo {
|
128 |
+
a: \foo bar;
|
129 |
+
b: foo\ bar;
|
130 |
+
c: \2022 \0020;
|
131 |
+
d: foo\\bar;
|
132 |
+
e: foo\"\'bar; }
|
133 |
+
|
134 |
+
foo {
|
135 |
+
a: "\foo bar";
|
136 |
+
b: "foo\ bar";
|
137 |
+
c: "\2022 \0020";
|
138 |
+
d: "foo\\bar";
|
139 |
+
e: "foo\"'bar"; }
|
140 |
+
|
141 |
+
foo {
|
142 |
+
_name: val;
|
143 |
+
*name: val;
|
144 |
+
:name: val;
|
145 |
+
.name: val;
|
146 |
+
#name: val;
|
147 |
+
name/**/: val;
|
148 |
+
name/*\**/: val;
|
149 |
+
name: val; }
|
150 |
+
|
151 |
+
@foo "bar" ;
|
152 |
+
|
153 |
+
foo {
|
154 |
+
a: -moz-element(#foo);
|
155 |
+
b: -webkit-element(#foo);
|
156 |
+
b: -foobar-element(#foo); }
|
157 |
+
|
158 |
+
@foo ;
|
159 |
+
|
160 |
+
foo {
|
161 |
+
bar: baz; }
|
162 |
+
|
163 |
+
0% {
|
164 |
+
a: b; }
|
165 |
+
|
166 |
+
60% {
|
167 |
+
a: b; }
|
168 |
+
|
169 |
+
100% {
|
170 |
+
a: b; }
|
171 |
+
|
172 |
+
12px {
|
173 |
+
a: b; }
|
174 |
+
|
175 |
+
"foo" {
|
176 |
+
a: b; }
|
177 |
+
|
178 |
+
foo {
|
179 |
+
a: 12px expression(1 + (3 / Foo.bar("baz" + "bang") + function() {return 12;}) % 12); }
|
180 |
+
|
181 |
+
:foo("bar") {
|
182 |
+
a: b; }
|
183 |
+
|
184 |
+
:foo(bar) {
|
185 |
+
a: b; }
|
186 |
+
|
187 |
+
:foo(12px) {
|
188 |
+
a: b; }
|
189 |
+
|
190 |
+
:foo(+) {
|
191 |
+
a: b; }
|
192 |
+
|
193 |
+
:foo(-) {
|
194 |
+
a: b; }
|
195 |
+
|
196 |
+
:foo(+"bar") {
|
197 |
+
a: b; }
|
198 |
+
|
199 |
+
:foo(-++--baz-"bar"12px) {
|
200 |
+
a: b; }
|
201 |
+
|
202 |
+
foo {
|
203 |
+
a: foo-bar(12);
|
204 |
+
b: -foo-bar-baz(13, 14 15); }
|
205 |
+
|
206 |
+
@import "foo.css" screen, print and (foo: 0);
|
207 |
+
|
208 |
+
@import "foo.css" screen, only print, screen and (foo: 0);
|
209 |
+
|
210 |
+
foo {
|
211 |
+
a: foo !important;
|
212 |
+
b: foo bar !important;
|
213 |
+
b: foo, bar !important; }
|
214 |
+
|
215 |
+
foo {
|
216 |
+
a: -moz-bar-baz;
|
217 |
+
b: foo -o-bar-baz; }
|
218 |
+
|
219 |
+
foo {
|
220 |
+
/* b; c: */
|
221 |
+
a: d; }
|
222 |
+
|
223 |
+
foo {
|
224 |
+
/*: b; c */
|
225 |
+
a : d;
|
226 |
+
/* Foo
|
227 |
+
* Bar */ }
|
228 |
+
|
229 |
+
[foo] {
|
230 |
+
a: b; }
|
231 |
+
|
232 |
+
[foo="bar"] {
|
233 |
+
a: b; }
|
234 |
+
|
235 |
+
[foo~="bar"] {
|
236 |
+
a: b; }
|
237 |
+
|
238 |
+
[foo^="bar"] {
|
239 |
+
a: b; }
|
240 |
+
|
241 |
+
[foo$="bar"] {
|
242 |
+
a: b; }
|
243 |
+
|
244 |
+
[foo*="bar"] {
|
245 |
+
a: b; }
|
246 |
+
|
247 |
+
[foo|="en"] {
|
248 |
+
a: b; }
|
249 |
+
|
250 |
+
:root {
|
251 |
+
a: b; }
|
252 |
+
|
253 |
+
:nth-child(n) {
|
254 |
+
a: b; }
|
255 |
+
|
256 |
+
:nth-last-child(n) {
|
257 |
+
a: b; }
|
258 |
+
|
259 |
+
:nth-of-type(n) {
|
260 |
+
a: b; }
|
261 |
+
|
262 |
+
:nth-last-of-type(n) {
|
263 |
+
a: b; }
|
264 |
+
|
265 |
+
:first-child {
|
266 |
+
a: b; }
|
267 |
+
|
268 |
+
:last-child {
|
269 |
+
a: b; }
|
270 |
+
|
271 |
+
:first-of-type {
|
272 |
+
a: b; }
|
273 |
+
|
274 |
+
:last-of-type {
|
275 |
+
a: b; }
|
276 |
+
|
277 |
+
:only-child {
|
278 |
+
a: b; }
|
279 |
+
|
280 |
+
:only-of-type {
|
281 |
+
a: b; }
|
282 |
+
|
283 |
+
:empty {
|
284 |
+
a: b; }
|
285 |
+
|
286 |
+
:link {
|
287 |
+
a: b; }
|
288 |
+
|
289 |
+
:visited {
|
290 |
+
a: b; }
|
291 |
+
|
292 |
+
:active {
|
293 |
+
a: b; }
|
294 |
+
|
295 |
+
:hover {
|
296 |
+
a: b; }
|
297 |
+
|
298 |
+
:focus {
|
299 |
+
a: b; }
|
300 |
+
|
301 |
+
:target {
|
302 |
+
a: b; }
|
303 |
+
|
304 |
+
:lang(fr) {
|
305 |
+
a: b; }
|
306 |
+
|
307 |
+
:enabled {
|
308 |
+
a: b; }
|
309 |
+
|
310 |
+
:disabled {
|
311 |
+
a: b; }
|
312 |
+
|
313 |
+
:checked {
|
314 |
+
a: b; }
|
315 |
+
|
316 |
+
::first-line {
|
317 |
+
a: b; }
|
318 |
+
|
319 |
+
::first-letter {
|
320 |
+
a: b; }
|
321 |
+
|
322 |
+
::before {
|
323 |
+
a: b; }
|
324 |
+
|
325 |
+
::after {
|
326 |
+
a: b; }
|
327 |
+
|
328 |
+
.warning {
|
329 |
+
a: b; }
|
330 |
+
|
331 |
+
#myid {
|
332 |
+
a: b; }
|
333 |
+
|
334 |
+
:not(s) {
|
335 |
+
a: b; }
|
336 |
+
|
337 |
+
@media all {
|
338 |
+
rule1 {
|
339 |
+
prop: val; }
|
340 |
+
|
341 |
+
rule2 {
|
342 |
+
prop: val; } }
|
343 |
+
|
344 |
+
@media screen, print {
|
345 |
+
rule1 {
|
346 |
+
prop: val; }
|
347 |
+
|
348 |
+
rule2 {
|
349 |
+
prop: val; } }
|
350 |
+
|
351 |
+
@media screen and (-webkit-min-device-pixel-ratio: 0) {
|
352 |
+
a: b; }
|
353 |
+
|
354 |
+
@media only screen, print and (foo: 0px) and (bar: flam(12px solid)) {
|
355 |
+
a: b; }
|
356 |
+
|
357 |
+
:-moz-any(h1, h2, h3) {
|
358 |
+
a: b; }
|
359 |
+
|
360 |
+
:-moz-any(.foo) {
|
361 |
+
a: b; }
|
362 |
+
|
363 |
+
:-moz-any(foo bar, .baz > .bang) {
|
364 |
+
a: b; }
|
365 |
+
|
366 |
+
@-moz-document url(http://www.w3.org/),
|
367 |
+
url-prefix(http://www.w3.org/Style/),
|
368 |
+
domain(mozilla.org),
|
369 |
+
regexp("^https:.*") {
|
370 |
+
.foo {
|
371 |
+
a: b; } }
|
372 |
+
|
373 |
+
foo {
|
374 |
+
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=1, startColorstr=#c0ff3300, endColorstr=#ff000000);
|
375 |
+
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=1, startColorstr=#c0ff3300, endColorstr=#ff000000); }
|
376 |
+
|
377 |
+
foo {
|
378 |
+
filter: alpha(opacity=20);
|
379 |
+
filter: alpha(opacity=20, enabled=true);
|
380 |
+
filter: blaznicate(foo=bar, baz=bang bip, bart=#fa4600); }
|
381 |
+
|
382 |
+
@foo bar {
|
383 |
+
a: b; }
|
384 |
+
|
385 |
+
@bar baz {
|
386 |
+
c: d; }
|
387 |
+
|
388 |
+
@namespace "http://www.w3.org/Profiles/xhtml1-strict";
|
389 |
+
|
390 |
+
@namespace url(http://www.w3.org/Profiles/xhtml1-strict);
|
391 |
+
|
392 |
+
@namespace html url("http://www.w3.org/Profiles/xhtml1-strict");
|
393 |
+
|
394 |
+
[foo|bar=baz] {
|
395 |
+
a: b; }
|
396 |
+
|
397 |
+
[*|bar=baz] {
|
398 |
+
a: b; }
|
399 |
+
|
400 |
+
[foo|bar|=baz] {
|
401 |
+
a: b; }
|
402 |
+
|
403 |
+
foo|E {
|
404 |
+
a: b; }
|
405 |
+
|
406 |
+
*|E {
|
407 |
+
a: b; }
|
408 |
+
|
409 |
+
foo|* {
|
410 |
+
a: b; }
|
411 |
+
|
412 |
+
*|* {
|
413 |
+
a: b; }
|
414 |
+
|
415 |
+
:not(foo|bar) {
|
416 |
+
a: b; }
|
417 |
+
|
418 |
+
:not(*|bar) {
|
419 |
+
a: b; }
|
420 |
+
|
421 |
+
:not(foo|*) {
|
422 |
+
a: b; }
|
423 |
+
|
424 |
+
:not(*|*) {
|
425 |
+
a: b; }
|
426 |
+
|
427 |
+
:not(#blah) {
|
428 |
+
a: b; }
|
429 |
+
|
430 |
+
:not(.blah) {
|
431 |
+
a: b; }
|
432 |
+
|
433 |
+
:not([foo]) {
|
434 |
+
a: b; }
|
435 |
+
|
436 |
+
:not([foo^="bar"]) {
|
437 |
+
a: b; }
|
438 |
+
|
439 |
+
:not([baz|foo~="bar"]) {
|
440 |
+
a: b; }
|
441 |
+
|
442 |
+
:not(:hover) {
|
443 |
+
a: b; }
|
444 |
+
|
445 |
+
:not(:nth-child(2n + 3)) {
|
446 |
+
a: b; }
|
447 |
+
|
448 |
+
:not(:not(#foo)) {
|
449 |
+
a: b; }
|
450 |
+
|
451 |
+
:not(a#foo.bar) {
|
452 |
+
a: b; }
|
453 |
+
|
454 |
+
:not(#foo .bar > baz) {
|
455 |
+
a: b; }
|
456 |
+
|
457 |
+
:not(h1, h2, h3) {
|
458 |
+
a: b; }
|
459 |
+
|
460 |
+
foo {
|
461 |
+
a: "bang 1 bar bip"; }
|
462 |
+
|
463 |
+
:nth-child(-n) {
|
464 |
+
a: b; }
|
465 |
+
|
466 |
+
:nth-child(+n) {
|
467 |
+
a: b; }
|
468 |
+
|
469 |
+
:nth-child(even) {
|
470 |
+
a: b; }
|
471 |
+
|
472 |
+
:nth-child(odd) {
|
473 |
+
a: b; }
|
474 |
+
|
475 |
+
:nth-child(50) {
|
476 |
+
a: b; }
|
477 |
+
|
478 |
+
:nth-child(-50) {
|
479 |
+
a: b; }
|
480 |
+
|
481 |
+
:nth-child(+50) {
|
482 |
+
a: b; }
|
483 |
+
|
484 |
+
:nth-child(2n+3) {
|
485 |
+
a: b; }
|
486 |
+
|
487 |
+
:nth-child(2n-3) {
|
488 |
+
a: b; }
|
489 |
+
|
490 |
+
:nth-child(+2n-3) {
|
491 |
+
a: b; }
|
492 |
+
|
493 |
+
:nth-child(-2n+3) {
|
494 |
+
a: b; }
|
495 |
+
|
496 |
+
:nth-child(-2n+ 3) {
|
497 |
+
a: b; }
|
498 |
+
|
499 |
+
:nth-child( 2n + 3) {
|
500 |
+
a: b; }
|
501 |
+
|
502 |
+
foo {
|
503 |
+
a: foo bar baz;
|
504 |
+
b: foo, #abc, -12;
|
505 |
+
c: 1px/2px/-3px;
|
506 |
+
d: foo bar, baz/bang; }
|
507 |
+
|
508 |
+
@page {
|
509 |
+
prop1: val;
|
510 |
+
prop2: val; }
|
511 |
+
|
512 |
+
@page flap {
|
513 |
+
prop1: val;
|
514 |
+
prop2: val; }
|
515 |
+
|
516 |
+
@page :first {
|
517 |
+
prop1: val;
|
518 |
+
prop2: val; }
|
519 |
+
|
520 |
+
@page flap:first {
|
521 |
+
prop1: val;
|
522 |
+
prop2: val; }
|
523 |
+
|
524 |
+
.foo {
|
525 |
+
a: b; }
|
526 |
+
|
527 |
+
.foo {
|
528 |
+
a: b;
|
529 |
+
/* Foo */ }
|
530 |
+
|
531 |
+
.foo {
|
532 |
+
a: b;
|
533 |
+
/* Foo
|
534 |
+
* Bar */ }
|
535 |
+
|
536 |
+
.foo {
|
537 |
+
a: b; }
|
538 |
+
|
539 |
+
.foo #bar:baz(/* bang )*/ bip) {
|
540 |
+
a: b; }
|
541 |
+
|
542 |
+
> E {
|
543 |
+
a: b; }
|
544 |
+
|
545 |
+
+ E {
|
546 |
+
a: b; }
|
547 |
+
|
548 |
+
~ E {
|
549 |
+
a: b; }
|
550 |
+
|
551 |
+
> > E {
|
552 |
+
a: b; }
|
553 |
+
|
554 |
+
>> E {
|
555 |
+
a: b; }
|
556 |
+
|
557 |
+
E* {
|
558 |
+
a: b; }
|
559 |
+
|
560 |
+
E*.foo {
|
561 |
+
a: b; }
|
562 |
+
|
563 |
+
E*:hover {
|
564 |
+
a: b; }
|
565 |
+
|
566 |
+
E, F {
|
567 |
+
a: b; }
|
568 |
+
|
569 |
+
E F {
|
570 |
+
a: b; }
|
571 |
+
|
572 |
+
E, F G, H {
|
573 |
+
a: b; }
|
574 |
+
|
575 |
+
E > F {
|
576 |
+
a: b; }
|
577 |
+
|
578 |
+
E ~ F {
|
579 |
+
a: b; }
|
580 |
+
|
581 |
+
E + F {
|
582 |
+
a: b; }
|
583 |
+
|
584 |
+
* {
|
585 |
+
a: b; }
|
586 |
+
|
587 |
+
E {
|
588 |
+
a: b; }
|
589 |
+
|
590 |
+
E[foo] {
|
591 |
+
a: b; }
|
592 |
+
|
593 |
+
E[foo="bar"] {
|
594 |
+
a: b; }
|
595 |
+
|
596 |
+
E[foo~="bar"] {
|
597 |
+
a: b; }
|
598 |
+
|
599 |
+
E[foo^="bar"] {
|
600 |
+
a: b; }
|
601 |
+
|
602 |
+
E[foo$="bar"] {
|
603 |
+
a: b; }
|
604 |
+
|
605 |
+
E[foo*="bar"] {
|
606 |
+
a: b; }
|
607 |
+
|
608 |
+
E[foo|="en"] {
|
609 |
+
a: b; }
|
610 |
+
|
611 |
+
E:root {
|
612 |
+
a: b; }
|
613 |
+
|
614 |
+
E:nth-child(n) {
|
615 |
+
a: b; }
|
616 |
+
|
617 |
+
E:nth-last-child(n) {
|
618 |
+
a: b; }
|
619 |
+
|
620 |
+
E:nth-of-type(n) {
|
621 |
+
a: b; }
|
622 |
+
|
623 |
+
E:nth-last-of-type(n) {
|
624 |
+
a: b; }
|
625 |
+
|
626 |
+
E:first-child {
|
627 |
+
a: b; }
|
628 |
+
|
629 |
+
E:last-child {
|
630 |
+
a: b; }
|
631 |
+
|
632 |
+
E:first-of-type {
|
633 |
+
a: b; }
|
634 |
+
|
635 |
+
E:last-of-type {
|
636 |
+
a: b; }
|
637 |
+
|
638 |
+
E:only-child {
|
639 |
+
a: b; }
|
640 |
+
|
641 |
+
E:only-of-type {
|
642 |
+
a: b; }
|
643 |
+
|
644 |
+
E:empty {
|
645 |
+
a: b; }
|
646 |
+
|
647 |
+
E:link {
|
648 |
+
a: b; }
|
649 |
+
|
650 |
+
E:visited {
|
651 |
+
a: b; }
|
652 |
+
|
653 |
+
E:active {
|
654 |
+
a: b; }
|
655 |
+
|
656 |
+
E:hover {
|
657 |
+
a: b; }
|
658 |
+
|
659 |
+
E:focus {
|
660 |
+
a: b; }
|
661 |
+
|
662 |
+
E:target {
|
663 |
+
a: b; }
|
664 |
+
|
665 |
+
E:lang(fr) {
|
666 |
+
a: b; }
|
667 |
+
|
668 |
+
E:enabled {
|
669 |
+
a: b; }
|
670 |
+
|
671 |
+
E:disabled {
|
672 |
+
a: b; }
|
673 |
+
|
674 |
+
E:checked {
|
675 |
+
a: b; }
|
676 |
+
|
677 |
+
E::first-line {
|
678 |
+
a: b; }
|
679 |
+
|
680 |
+
E::first-letter {
|
681 |
+
a: b; }
|
682 |
+
|
683 |
+
E::before {
|
684 |
+
a: b; }
|
685 |
+
|
686 |
+
E::after {
|
687 |
+
a: b; }
|
688 |
+
|
689 |
+
E.warning {
|
690 |
+
a: b; }
|
691 |
+
|
692 |
+
E#myid {
|
693 |
+
a: b; }
|
694 |
+
|
695 |
+
E:not(s) {
|
696 |
+
a: b; }
|
697 |
+
|
698 |
+
E F {
|
699 |
+
a: b; }
|
700 |
+
|
701 |
+
E > F {
|
702 |
+
a: b; }
|
703 |
+
|
704 |
+
E + F {
|
705 |
+
a: b; }
|
706 |
+
|
707 |
+
E ~ F {
|
708 |
+
a: b; }
|
709 |
+
|
710 |
+
@supports (a: b) and (c: d) or (not (d: e)) and ((not (f: g)) or (not ((h: i) and (j: k)))) {
|
711 |
+
.foo {
|
712 |
+
a: b; } }
|
713 |
+
|
714 |
+
@-prefix-supports (a: b) and (c: d) or (not (d: e)) and ((not (f: g)) or (not ((h: i) and (j: k)))) {
|
715 |
+
.foo {
|
716 |
+
a: b; } }
|
717 |
+
|
718 |
+
foo {
|
719 |
+
foo: bar;
|
720 |
+
#baz: bang;
|
721 |
+
#bip: bop; }
|
722 |
+
|
723 |
+
foo {
|
724 |
+
a: -2;
|
725 |
+
b: -2.3em;
|
726 |
+
c: -50%;
|
727 |
+
d: -foo(bar baz); }
|
728 |
+
|
729 |
+
foo {
|
730 |
+
a: -0.5em;
|
731 |
+
b: 0.5em;
|
732 |
+
c: -foo(12px);
|
733 |
+
d: +foo(12px); }
|
734 |
+
|
735 |
+
foo {
|
736 |
+
-moz-foo-bar: blat;
|
737 |
+
-o-flat-blang: wibble; }
|
738 |
+
|
739 |
+
foo {
|
740 |
+
a: foo();
|
741 |
+
b: bar baz-bang() bip; }
|
src/app/Mappers/scssphp/tests/outputs/selectors.css
ADDED
@@ -0,0 +1,335 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
* {
|
2 |
+
color: blue; }
|
3 |
+
|
4 |
+
E {
|
5 |
+
color: blue; }
|
6 |
+
|
7 |
+
E:not(:link) {
|
8 |
+
color: blue; }
|
9 |
+
|
10 |
+
E:not(:link):not(:visited) {
|
11 |
+
color: blue; }
|
12 |
+
|
13 |
+
E:not(:link, :visited) {
|
14 |
+
color: blue; }
|
15 |
+
|
16 |
+
E:matches(:hover, :focus) {
|
17 |
+
color: blue; }
|
18 |
+
|
19 |
+
E.warning {
|
20 |
+
color: blue; }
|
21 |
+
|
22 |
+
E#id {
|
23 |
+
color: blue; }
|
24 |
+
|
25 |
+
E[foo] {
|
26 |
+
color: blue; }
|
27 |
+
|
28 |
+
E[foo="barbar"] {
|
29 |
+
color: blue; }
|
30 |
+
|
31 |
+
E[foo="barbar" i] {
|
32 |
+
color: blue; }
|
33 |
+
|
34 |
+
E[foo~="hello#$@%@$#^"] {
|
35 |
+
color: blue; }
|
36 |
+
|
37 |
+
E[foo^="color: green;"] {
|
38 |
+
color: blue; }
|
39 |
+
|
40 |
+
E[foo$="239023"] {
|
41 |
+
color: blue; }
|
42 |
+
|
43 |
+
E[foo*="29302"] {
|
44 |
+
color: blue; }
|
45 |
+
|
46 |
+
E[foo|="239032"] {
|
47 |
+
color: blue; }
|
48 |
+
|
49 |
+
[foo] {
|
50 |
+
color: blue; }
|
51 |
+
|
52 |
+
[foo] .helloWorld {
|
53 |
+
color: blue; }
|
54 |
+
|
55 |
+
[foo].helloWorld {
|
56 |
+
color: blue; }
|
57 |
+
|
58 |
+
[foo="barbar"] {
|
59 |
+
color: blue; }
|
60 |
+
|
61 |
+
[foo~="hello#$@%@$#^"] {
|
62 |
+
color: blue; }
|
63 |
+
|
64 |
+
[foo^="color: green;"] {
|
65 |
+
color: blue; }
|
66 |
+
|
67 |
+
[foo$="239023"] {
|
68 |
+
color: blue; }
|
69 |
+
|
70 |
+
[foo*="29302"] {
|
71 |
+
color: blue; }
|
72 |
+
|
73 |
+
[foo|="239032"] {
|
74 |
+
color: blue; }
|
75 |
+
|
76 |
+
E:dir(ltr) {
|
77 |
+
color: blue; }
|
78 |
+
|
79 |
+
E:lang(en) {
|
80 |
+
color: blue; }
|
81 |
+
|
82 |
+
E:lang(en, fr) {
|
83 |
+
color: blue; }
|
84 |
+
|
85 |
+
E:any-link {
|
86 |
+
color: blue; }
|
87 |
+
|
88 |
+
E:link {
|
89 |
+
color: blue; }
|
90 |
+
|
91 |
+
E:visited {
|
92 |
+
color: blue; }
|
93 |
+
|
94 |
+
E:local-link {
|
95 |
+
color: blue; }
|
96 |
+
|
97 |
+
E:local-link(0) {
|
98 |
+
color: red; }
|
99 |
+
|
100 |
+
E:local-link(1) {
|
101 |
+
color: white; }
|
102 |
+
|
103 |
+
E:local-link(2) {
|
104 |
+
color: red; }
|
105 |
+
|
106 |
+
E:target {
|
107 |
+
color: blue; }
|
108 |
+
|
109 |
+
E:scope {
|
110 |
+
color: blue; }
|
111 |
+
|
112 |
+
E:current {
|
113 |
+
color: blue; }
|
114 |
+
|
115 |
+
E:current(:link) {
|
116 |
+
color: blue; }
|
117 |
+
|
118 |
+
E:past {
|
119 |
+
color: blue; }
|
120 |
+
|
121 |
+
E:future {
|
122 |
+
color: blue; }
|
123 |
+
|
124 |
+
E:active {
|
125 |
+
color: blue; }
|
126 |
+
|
127 |
+
E:hover {
|
128 |
+
color: blue; }
|
129 |
+
|
130 |
+
E:focus {
|
131 |
+
color: blue; }
|
132 |
+
|
133 |
+
E:enabled {
|
134 |
+
color: blue; }
|
135 |
+
|
136 |
+
E:disabled {
|
137 |
+
color: blue; }
|
138 |
+
|
139 |
+
E:indeterminate {
|
140 |
+
color: blue; }
|
141 |
+
|
142 |
+
E:default {
|
143 |
+
color: blue; }
|
144 |
+
|
145 |
+
E:in-range {
|
146 |
+
color: blue; }
|
147 |
+
|
148 |
+
E:out-of-range {
|
149 |
+
color: blue; }
|
150 |
+
|
151 |
+
E:required {
|
152 |
+
color: blue; }
|
153 |
+
|
154 |
+
E:optional {
|
155 |
+
color: blue; }
|
156 |
+
|
157 |
+
E:read-only {
|
158 |
+
color: blue; }
|
159 |
+
|
160 |
+
E:read-write {
|
161 |
+
color: blue; }
|
162 |
+
|
163 |
+
E:root {
|
164 |
+
color: blue; }
|
165 |
+
|
166 |
+
E:empty {
|
167 |
+
color: blue; }
|
168 |
+
|
169 |
+
E:first-child {
|
170 |
+
color: blue; }
|
171 |
+
|
172 |
+
E:nth-child(odd) {
|
173 |
+
color: blue; }
|
174 |
+
|
175 |
+
E:nth-child(2n+1) {
|
176 |
+
color: blue; }
|
177 |
+
|
178 |
+
E:nth-child(5) {
|
179 |
+
color: blue; }
|
180 |
+
|
181 |
+
E:last-child {
|
182 |
+
color: blue; }
|
183 |
+
|
184 |
+
E:nth-last-child(-n+2) {
|
185 |
+
color: blue; }
|
186 |
+
|
187 |
+
E:only-child {
|
188 |
+
color: blue; }
|
189 |
+
|
190 |
+
E:first-of-type {
|
191 |
+
color: blue; }
|
192 |
+
|
193 |
+
E:nth-of-type(2n) {
|
194 |
+
color: blue; }
|
195 |
+
|
196 |
+
E:last-of-type {
|
197 |
+
color: blue; }
|
198 |
+
|
199 |
+
E:nth-last-of-type(n) {
|
200 |
+
color: blue; }
|
201 |
+
|
202 |
+
E:only-of-type {
|
203 |
+
color: blue; }
|
204 |
+
|
205 |
+
E:nth-match(odd) {
|
206 |
+
color: blue; }
|
207 |
+
|
208 |
+
E:nth-last-match(odd) {
|
209 |
+
color: blue; }
|
210 |
+
|
211 |
+
E:column(n) {
|
212 |
+
color: blue; }
|
213 |
+
|
214 |
+
E:nth-column(n) {
|
215 |
+
color: blue; }
|
216 |
+
|
217 |
+
E:nth-last-column(n) {
|
218 |
+
color: blue; }
|
219 |
+
|
220 |
+
E F {
|
221 |
+
color: blue; }
|
222 |
+
|
223 |
+
E > F {
|
224 |
+
color: blue; }
|
225 |
+
|
226 |
+
E + F {
|
227 |
+
color: blue; }
|
228 |
+
|
229 |
+
E ~ F {
|
230 |
+
color: blue; }
|
231 |
+
|
232 |
+
E /foo/ F {
|
233 |
+
color: blue; }
|
234 |
+
|
235 |
+
E! > F {
|
236 |
+
color: blue; }
|
237 |
+
|
238 |
+
[foo|att=val] {
|
239 |
+
color: blue; }
|
240 |
+
|
241 |
+
[*|att] {
|
242 |
+
color: yellow; }
|
243 |
+
|
244 |
+
[|att] {
|
245 |
+
color: green; }
|
246 |
+
|
247 |
+
[att] {
|
248 |
+
color: green; }
|
249 |
+
|
250 |
+
E::first-line {
|
251 |
+
color: blue; }
|
252 |
+
|
253 |
+
E::first-letter {
|
254 |
+
color: blue; }
|
255 |
+
|
256 |
+
E::before {
|
257 |
+
color: blue; }
|
258 |
+
|
259 |
+
E::after {
|
260 |
+
color: blue; }
|
261 |
+
|
262 |
+
E::choices {
|
263 |
+
color: blue; }
|
264 |
+
|
265 |
+
E::value {
|
266 |
+
color: blue; }
|
267 |
+
|
268 |
+
E::repeat-index {
|
269 |
+
color: blue; }
|
270 |
+
|
271 |
+
E::repeat-item {
|
272 |
+
color: blue; }
|
273 |
+
|
274 |
+
E:first {
|
275 |
+
color: blue; }
|
276 |
+
|
277 |
+
E:first-line {
|
278 |
+
color: blue; }
|
279 |
+
|
280 |
+
E:first-letter {
|
281 |
+
color: blue; }
|
282 |
+
|
283 |
+
E:before {
|
284 |
+
color: blue; }
|
285 |
+
|
286 |
+
E:after {
|
287 |
+
color: blue; }
|
288 |
+
|
289 |
+
E:checked {
|
290 |
+
color: blue; }
|
291 |
+
|
292 |
+
E:invalid {
|
293 |
+
color: blue; }
|
294 |
+
|
295 |
+
E:valid {
|
296 |
+
color: blue; }
|
297 |
+
|
298 |
+
E:left {
|
299 |
+
color: blue; }
|
300 |
+
|
301 |
+
E:right {
|
302 |
+
color: blue; }
|
303 |
+
|
304 |
+
E:any(ol) {
|
305 |
+
color: blue; }
|
306 |
+
|
307 |
+
E::selection {
|
308 |
+
color: blue; }
|
309 |
+
|
310 |
+
div {
|
311 |
+
font: something;
|
312 |
+
font-size: 30em; }
|
313 |
+
div font:something {
|
314 |
+
size: 30em; }
|
315 |
+
|
316 |
+
.something.world {
|
317 |
+
color: blue; }
|
318 |
+
.something .mold {
|
319 |
+
height: 200px; }
|
320 |
+
.dog .something {
|
321 |
+
color: blue; }
|
322 |
+
|
323 |
+
.dad .simple .wolf {
|
324 |
+
color: blue; }
|
325 |
+
.rad.simple.bad {
|
326 |
+
color: blue; }
|
327 |
+
|
328 |
+
.something div .what.world {
|
329 |
+
color: blue; }
|
330 |
+
|
331 |
+
div.foo div {
|
332 |
+
color: blue; }
|
333 |
+
|
334 |
+
.nice-fonts .main .message div .title, .nice-fonts div .message div .title {
|
335 |
+
font-size: 24px; }
|
src/app/Mappers/scssphp/tests/outputs/values.css
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#values {
|
2 |
+
color: #eee;
|
3 |
+
color: #eee;
|
4 |
+
height: 20px;
|
5 |
+
width: 80%;
|
6 |
+
color: "hello world";
|
7 |
+
height: url("http://google.com");
|
8 |
+
dads: url(http://leafo.net);
|
9 |
+
padding: 10px 10px 10px 10px, 3px 3px 3px;
|
10 |
+
textblock: "This is a \
|
11 |
+
multiline block \
|
12 |
+
#not { color: #eee;}";
|
13 |
+
margin: 4, 3, 1;
|
14 |
+
content: "This is a \
|
15 |
+
multiline string.";
|
16 |
+
border-radius: -1px -1px -1px black; }
|
17 |
+
|
18 |
+
#subtraction {
|
19 |
+
lit: 10 -11;
|
20 |
+
lit: -1;
|
21 |
+
lit: -1;
|
22 |
+
lit: -1;
|
23 |
+
var: 10 -100;
|
24 |
+
var: -90;
|
25 |
+
var: -90;
|
26 |
+
var: -90; }
|
27 |
+
|
28 |
+
#special {
|
29 |
+
a: 12px expression(1 + (3 / Foo.bar("baz" + "bang") + function() {return 12;}) % 12); }
|
30 |
+
|
31 |
+
#unary {
|
32 |
+
b: 0.5em;
|
33 |
+
c: -foo(12px);
|
34 |
+
d: +foo(12px); }
|
src/app/Mappers/scssphp/tests/outputs/variables.css
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
cool: 100px;
|
2 |
+
div {
|
3 |
+
height: red, two, three; }
|
4 |
+
|
5 |
+
div {
|
6 |
+
num: 1000; }
|
7 |
+
|
8 |
+
div {
|
9 |
+
num: 2000; }
|
10 |
+
|
11 |
+
pre {
|
12 |
+
color: blue; }
|
13 |
+
|
14 |
+
del {
|
15 |
+
color: red; }
|
16 |
+
del div pre {
|
17 |
+
color: red; }
|
18 |
+
|
19 |
+
body {
|
20 |
+
font-family: Arial;
|
21 |
+
font-family: Helvetica Neue;
|
22 |
+
font-family: "Helvetica Neue";
|
23 |
+
font-family: Helvetica, Arial, sans-serif;
|
24 |
+
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; }
|
src/app/Models/ComplexOption.php
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Models;
|
4 |
+
use ResponsiveMenu\Filters\Filter as Filter;
|
5 |
+
use ResponsiveMenu\Form\FormComponent as FormComponent;
|
6 |
+
|
7 |
+
class ComplexOption implements Option {
|
8 |
+
|
9 |
+
private $value;
|
10 |
+
private $name;
|
11 |
+
private $filter;
|
12 |
+
private $form_component;
|
13 |
+
private $is_pro;
|
14 |
+
private $is_semi_pro;
|
15 |
+
private $position;
|
16 |
+
private $data;
|
17 |
+
private $label;
|
18 |
+
|
19 |
+
public function __construct($name, $value)
|
20 |
+
{
|
21 |
+
$this->name = $name;
|
22 |
+
$this->value = $value;
|
23 |
+
}
|
24 |
+
|
25 |
+
public function setFilter(Filter $filter)
|
26 |
+
{
|
27 |
+
$this->filter = $filter;
|
28 |
+
}
|
29 |
+
|
30 |
+
public function setFormComponent(FormComponent $form_component)
|
31 |
+
{
|
32 |
+
$this->form_component = $form_component;
|
33 |
+
}
|
34 |
+
|
35 |
+
public function getName()
|
36 |
+
{
|
37 |
+
return $this->name;
|
38 |
+
}
|
39 |
+
|
40 |
+
public function getValue()
|
41 |
+
{
|
42 |
+
return $this->value;
|
43 |
+
}
|
44 |
+
|
45 |
+
public function getFiltered() {
|
46 |
+
return $this->filter->filter($this->value);
|
47 |
+
}
|
48 |
+
|
49 |
+
public function setValue($value)
|
50 |
+
{
|
51 |
+
$this->value = $value;
|
52 |
+
}
|
53 |
+
|
54 |
+
public function setIsPro($is_pro = false)
|
55 |
+
{
|
56 |
+
$this->is_pro = $is_pro;
|
57 |
+
}
|
58 |
+
|
59 |
+
public function isPro()
|
60 |
+
{
|
61 |
+
return $this->is_pro;
|
62 |
+
}
|
63 |
+
|
64 |
+
public function setIsSemiPro($is_semi_pro = false)
|
65 |
+
{
|
66 |
+
$this->is_semi_pro = $is_semi_pro;
|
67 |
+
}
|
68 |
+
|
69 |
+
public function isSemiPro()
|
70 |
+
{
|
71 |
+
return $this->is_semi_pro;
|
72 |
+
}
|
73 |
+
|
74 |
+
public function getFormComponent()
|
75 |
+
{
|
76 |
+
return $this->form_component;
|
77 |
+
}
|
78 |
+
|
79 |
+
public function setPosition($position = null)
|
80 |
+
{
|
81 |
+
$this->position = $position;
|
82 |
+
}
|
83 |
+
|
84 |
+
public function getPosition()
|
85 |
+
{
|
86 |
+
return $this->position;
|
87 |
+
}
|
88 |
+
|
89 |
+
public function getFilter()
|
90 |
+
{
|
91 |
+
return $this->filter;
|
92 |
+
}
|
93 |
+
|
94 |
+
public function __toString()
|
95 |
+
{
|
96 |
+
return (string) $this->value;
|
97 |
+
}
|
98 |
+
|
99 |
+
public function getBasePosition()
|
100 |
+
{
|
101 |
+
$position = $this->position;
|
102 |
+
$positions = explode('.', $position);
|
103 |
+
return isset($positions[1]) ? $positions[1] : null;
|
104 |
+
}
|
105 |
+
|
106 |
+
public function getData($data)
|
107 |
+
{
|
108 |
+
return $this->data[$data];
|
109 |
+
}
|
110 |
+
|
111 |
+
public function setData($data = null) {
|
112 |
+
$this->data = $data;
|
113 |
+
}
|
114 |
+
|
115 |
+
public function hasLabel()
|
116 |
+
{
|
117 |
+
return $this->label ? true : false;
|
118 |
+
}
|
119 |
+
|
120 |
+
public function getLabel()
|
121 |
+
{
|
122 |
+
return $this->label;
|
123 |
+
}
|
124 |
+
|
125 |
+
public function setLabel($label = null)
|
126 |
+
{
|
127 |
+
$this->label = $label;
|
128 |
+
}
|
129 |
+
|
130 |
+
}
|
src/app/Models/Option.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Models;
|
4 |
+
|
5 |
+
interface Option {
|
6 |
+
|
7 |
+
public function __construct($name, $value);
|
8 |
+
public function getName();
|
9 |
+
public function getValue();
|
10 |
+
public function setValue($value);
|
11 |
+
public function __toString();
|
12 |
+
|
13 |
+
}
|
src/app/Models/SimpleOption.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Models;
|
4 |
+
|
5 |
+
class SimpleOption implements Option {
|
6 |
+
|
7 |
+
private $value;
|
8 |
+
private $name;
|
9 |
+
|
10 |
+
public function __construct($name, $value)
|
11 |
+
{
|
12 |
+
$this->name = $name;
|
13 |
+
$this->value = $value;
|
14 |
+
}
|
15 |
+
|
16 |
+
public function getName()
|
17 |
+
{
|
18 |
+
return $this->name;
|
19 |
+
}
|
20 |
+
|
21 |
+
public function getValue()
|
22 |
+
{
|
23 |
+
return $this->value;
|
24 |
+
}
|
25 |
+
|
26 |
+
public function setValue($value)
|
27 |
+
{
|
28 |
+
return $this->value = $value;
|
29 |
+
}
|
30 |
+
|
31 |
+
public function __toString()
|
32 |
+
{
|
33 |
+
return (string) $this->value;
|
34 |
+
}
|
35 |
+
|
36 |
+
}
|
src/app/Repositories/Options/BaseOptionRepository.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Repositories\Options;
|
4 |
+
use ResponsiveMenu\Database\Database as Database;
|
5 |
+
|
6 |
+
class BaseOptionRepository {
|
7 |
+
|
8 |
+
public function __construct(Database $db)
|
9 |
+
{
|
10 |
+
$this->db = $db;
|
11 |
+
}
|
12 |
+
|
13 |
+
}
|
src/app/Repositories/Options/ComplexOptionRepository.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Repositories\Options;
|
4 |
+
use ResponsiveMenu\Factories\OptionFactory as Factory;
|
5 |
+
use ResponsiveMenu\Models\ComplexOption as ComplexOption;
|
6 |
+
use ResponsiveMenu\Collections\OptionsCollection as OptionsCollection;
|
7 |
+
|
8 |
+
class ComplexOptionRepository extends BaseOptionRepository implements Repository {
|
9 |
+
|
10 |
+
public function update(ComplexOption $option)
|
11 |
+
{
|
12 |
+
$this->db->update(array('value' => $option->getFiltered()), array('name' => $option->getName()));
|
13 |
+
}
|
14 |
+
|
15 |
+
public function all()
|
16 |
+
{
|
17 |
+
$options = $this->db->all();
|
18 |
+
$collection = new OptionsCollection;
|
19 |
+
$factory = new Factory;
|
20 |
+
foreach($options as $option)
|
21 |
+
$collection->add($factory->build($option->name, $option->value));
|
22 |
+
return $collection;
|
23 |
+
}
|
24 |
+
|
25 |
+
}
|
src/app/Repositories/Options/ReadRepository.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Repositories\Options;
|
4 |
+
|
5 |
+
interface ReadRepository {
|
6 |
+
public function all();
|
7 |
+
}
|
src/app/Repositories/Options/Repository.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Repositories\Options;
|
4 |
+
use ResponsiveMenu\Models\ComplexOption as ComplexOption;
|
5 |
+
|
6 |
+
interface Repository {
|
7 |
+
public function all();
|
8 |
+
public function update(ComplexOption $option);
|
9 |
+
}
|
src/app/Repositories/Options/SimpleOptionReadRepository.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Repositories\Options;
|
4 |
+
use ResponsiveMenu\Models\SimpleOption as SimpleOption;
|
5 |
+
use ResponsiveMenu\Collections\OptionsCollection as OptionsCollection;
|
6 |
+
|
7 |
+
class SimpleOptionReadRepository extends BaseOptionRepository implements ReadRepository {
|
8 |
+
|
9 |
+
public function all()
|
10 |
+
{
|
11 |
+
$options = $this->db->all();
|
12 |
+
$collection = new OptionsCollection;
|
13 |
+
foreach($options as $option)
|
14 |
+
$collection->add(new SimpleOption($option->name, $option->value));
|
15 |
+
return $collection;
|
16 |
+
}
|
17 |
+
|
18 |
+
}
|
src/app/Routing/Container.php
ADDED
@@ -0,0 +1,282 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Pimple.
|
5 |
+
*
|
6 |
+
* Copyright (c) 2009 Fabien Potencier
|
7 |
+
*
|
8 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
9 |
+
* of this software and associated documentation files (the "Software"), to deal
|
10 |
+
* in the Software without restriction, including without limitation the rights
|
11 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12 |
+
* copies of the Software, and to permit persons to whom the Software is furnished
|
13 |
+
* to do so, subject to the following conditions:
|
14 |
+
*
|
15 |
+
* The above copyright notice and this permission notice shall be included in all
|
16 |
+
* copies or substantial portions of the Software.
|
17 |
+
*
|
18 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24 |
+
* THE SOFTWARE.
|
25 |
+
*/
|
26 |
+
|
27 |
+
namespace ResponsiveMenu\Routing;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Container main class.
|
31 |
+
*
|
32 |
+
* @author Fabien Potencier
|
33 |
+
*/
|
34 |
+
class Container implements \ArrayAccess
|
35 |
+
{
|
36 |
+
private $values = array();
|
37 |
+
private $factories;
|
38 |
+
private $protected;
|
39 |
+
private $frozen = array();
|
40 |
+
private $raw = array();
|
41 |
+
private $keys = array();
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Instantiate the container.
|
45 |
+
*
|
46 |
+
* Objects and parameters can be passed as argument to the constructor.
|
47 |
+
*
|
48 |
+
* @param array $values The parameters or objects.
|
49 |
+
*/
|
50 |
+
public function __construct(array $values = array())
|
51 |
+
{
|
52 |
+
$this->factories = new \SplObjectStorage();
|
53 |
+
$this->protected = new \SplObjectStorage();
|
54 |
+
|
55 |
+
foreach ($values as $key => $value) {
|
56 |
+
$this->offsetSet($key, $value);
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Sets a parameter or an object.
|
62 |
+
*
|
63 |
+
* Objects must be defined as Closures.
|
64 |
+
*
|
65 |
+
* Allowing any PHP callable leads to difficult to debug problems
|
66 |
+
* as function names (strings) are callable (creating a function with
|
67 |
+
* the same name as an existing parameter would break your container).
|
68 |
+
*
|
69 |
+
* @param string $id The unique identifier for the parameter or object
|
70 |
+
* @param mixed $value The value of the parameter or a closure to define an object
|
71 |
+
*
|
72 |
+
* @throws \RuntimeException Prevent override of a frozen service
|
73 |
+
*/
|
74 |
+
public function offsetSet($id, $value)
|
75 |
+
{
|
76 |
+
if (isset($this->frozen[$id])) {
|
77 |
+
throw new \RuntimeException(sprintf('Cannot override frozen service "%s".', $id));
|
78 |
+
}
|
79 |
+
|
80 |
+
$this->values[$id] = $value;
|
81 |
+
$this->keys[$id] = true;
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Gets a parameter or an object.
|
86 |
+
*
|
87 |
+
* @param string $id The unique identifier for the parameter or object
|
88 |
+
*
|
89 |
+
* @return mixed The value of the parameter or an object
|
90 |
+
*
|
91 |
+
* @throws \InvalidArgumentException if the identifier is not defined
|
92 |
+
*/
|
93 |
+
public function offsetGet($id)
|
94 |
+
{
|
95 |
+
if (!isset($this->keys[$id])) {
|
96 |
+
throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id));
|
97 |
+
}
|
98 |
+
|
99 |
+
if (
|
100 |
+
isset($this->raw[$id])
|
101 |
+
|| !is_object($this->values[$id])
|
102 |
+
|| isset($this->protected[$this->values[$id]])
|
103 |
+
|| !method_exists($this->values[$id], '__invoke')
|
104 |
+
) {
|
105 |
+
return $this->values[$id];
|
106 |
+
}
|
107 |
+
|
108 |
+
if (isset($this->factories[$this->values[$id]])) {
|
109 |
+
return $this->values[$id]($this);
|
110 |
+
}
|
111 |
+
|
112 |
+
$raw = $this->values[$id];
|
113 |
+
$val = $this->values[$id] = $raw($this);
|
114 |
+
$this->raw[$id] = $raw;
|
115 |
+
|
116 |
+
$this->frozen[$id] = true;
|
117 |
+
|
118 |
+
return $val;
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Checks if a parameter or an object is set.
|
123 |
+
*
|
124 |
+
* @param string $id The unique identifier for the parameter or object
|
125 |
+
*
|
126 |
+
* @return bool
|
127 |
+
*/
|
128 |
+
public function offsetExists($id)
|
129 |
+
{
|
130 |
+
return isset($this->keys[$id]);
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Unsets a parameter or an object.
|
135 |
+
*
|
136 |
+
* @param string $id The unique identifier for the parameter or object
|
137 |
+
*/
|
138 |
+
public function offsetUnset($id)
|
139 |
+
{
|
140 |
+
if (isset($this->keys[$id])) {
|
141 |
+
if (is_object($this->values[$id])) {
|
142 |
+
unset($this->factories[$this->values[$id]], $this->protected[$this->values[$id]]);
|
143 |
+
}
|
144 |
+
|
145 |
+
unset($this->values[$id], $this->frozen[$id], $this->raw[$id], $this->keys[$id]);
|
146 |
+
}
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Marks a callable as being a factory service.
|
151 |
+
*
|
152 |
+
* @param callable $callable A service definition to be used as a factory
|
153 |
+
*
|
154 |
+
* @return callable The passed callable
|
155 |
+
*
|
156 |
+
* @throws \InvalidArgumentException Service definition has to be a closure of an invokable object
|
157 |
+
*/
|
158 |
+
public function factory($callable)
|
159 |
+
{
|
160 |
+
if (!method_exists($callable, '__invoke')) {
|
161 |
+
throw new \InvalidArgumentException('Service definition is not a Closure or invokable object.');
|
162 |
+
}
|
163 |
+
|
164 |
+
$this->factories->attach($callable);
|
165 |
+
|
166 |
+
return $callable;
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Protects a callable from being interpreted as a service.
|
171 |
+
*
|
172 |
+
* This is useful when you want to store a callable as a parameter.
|
173 |
+
*
|
174 |
+
* @param callable $callable A callable to protect from being evaluated
|
175 |
+
*
|
176 |
+
* @return callable The passed callable
|
177 |
+
*
|
178 |
+
* @throws \InvalidArgumentException Service definition has to be a closure of an invokable object
|
179 |
+
*/
|
180 |
+
public function protect($callable)
|
181 |
+
{
|
182 |
+
if (!method_exists($callable, '__invoke')) {
|
183 |
+
throw new \InvalidArgumentException('Callable is not a Closure or invokable object.');
|
184 |
+
}
|
185 |
+
|
186 |
+
$this->protected->attach($callable);
|
187 |
+
|
188 |
+
return $callable;
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Gets a parameter or the closure defining an object.
|
193 |
+
*
|
194 |
+
* @param string $id The unique identifier for the parameter or object
|
195 |
+
*
|
196 |
+
* @return mixed The value of the parameter or the closure defining an object
|
197 |
+
*
|
198 |
+
* @throws \InvalidArgumentException if the identifier is not defined
|
199 |
+
*/
|
200 |
+
public function raw($id)
|
201 |
+
{
|
202 |
+
if (!isset($this->keys[$id])) {
|
203 |
+
throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id));
|
204 |
+
}
|
205 |
+
|
206 |
+
if (isset($this->raw[$id])) {
|
207 |
+
return $this->raw[$id];
|
208 |
+
}
|
209 |
+
|
210 |
+
return $this->values[$id];
|
211 |
+
}
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Extends an object definition.
|
215 |
+
*
|
216 |
+
* Useful when you want to extend an existing object definition,
|
217 |
+
* without necessarily loading that object.
|
218 |
+
*
|
219 |
+
* @param string $id The unique identifier for the object
|
220 |
+
* @param callable $callable A service definition to extend the original
|
221 |
+
*
|
222 |
+
* @return callable The wrapped callable
|
223 |
+
*
|
224 |
+
* @throws \InvalidArgumentException if the identifier is not defined or not a service definition
|
225 |
+
*/
|
226 |
+
public function extend($id, $callable)
|
227 |
+
{
|
228 |
+
if (!isset($this->keys[$id])) {
|
229 |
+
throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id));
|
230 |
+
}
|
231 |
+
|
232 |
+
if (!is_object($this->values[$id]) || !method_exists($this->values[$id], '__invoke')) {
|
233 |
+
throw new \InvalidArgumentException(sprintf('Identifier "%s" does not contain an object definition.', $id));
|
234 |
+
}
|
235 |
+
|
236 |
+
if (!is_object($callable) || !method_exists($callable, '__invoke')) {
|
237 |
+
throw new \InvalidArgumentException('Extension service definition is not a Closure or invokable object.');
|
238 |
+
}
|
239 |
+
|
240 |
+
$factory = $this->values[$id];
|
241 |
+
|
242 |
+
$extended = function ($c) use ($callable, $factory) {
|
243 |
+
return $callable($factory($c), $c);
|
244 |
+
};
|
245 |
+
|
246 |
+
if (isset($this->factories[$factory])) {
|
247 |
+
$this->factories->detach($factory);
|
248 |
+
$this->factories->attach($extended);
|
249 |
+
}
|
250 |
+
|
251 |
+
return $this[$id] = $extended;
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Returns all defined value names.
|
256 |
+
*
|
257 |
+
* @return array An array of value names
|
258 |
+
*/
|
259 |
+
public function keys()
|
260 |
+
{
|
261 |
+
return array_keys($this->values);
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Registers a service provider.
|
266 |
+
*
|
267 |
+
* @param ServiceProviderInterface $provider A ServiceProviderInterface instance
|
268 |
+
* @param array $values An array of values that customizes the provider
|
269 |
+
*
|
270 |
+
* @return static
|
271 |
+
*/
|
272 |
+
public function register(ServiceProviderInterface $provider, array $values = array())
|
273 |
+
{
|
274 |
+
$provider->register($this);
|
275 |
+
|
276 |
+
foreach ($values as $key => $value) {
|
277 |
+
$this[$key] = $value;
|
278 |
+
}
|
279 |
+
|
280 |
+
return $this;
|
281 |
+
}
|
282 |
+
}
|
src/app/Routing/Routing.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Routing;
|
4 |
+
|
5 |
+
interface Routing
|
6 |
+
{
|
7 |
+
public function route();
|
8 |
+
}
|
src/app/Routing/WpRouting.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Routing;
|
4 |
+
use ResponsiveMenu\Routing\Container as Container;
|
5 |
+
|
6 |
+
class WpRouting implements Routing
|
7 |
+
{
|
8 |
+
|
9 |
+
protected $container;
|
10 |
+
|
11 |
+
public function __construct(Container $container)
|
12 |
+
{
|
13 |
+
$this->container = $container;
|
14 |
+
}
|
15 |
+
|
16 |
+
public function route()
|
17 |
+
{
|
18 |
+
if(is_admin())
|
19 |
+
add_action('admin_menu', [$this, 'adminPage']);
|
20 |
+
else
|
21 |
+
add_action('template_redirect', [$this->container['front_controller'], 'index']);
|
22 |
+
}
|
23 |
+
|
24 |
+
public function adminPage()
|
25 |
+
{
|
26 |
+
/* Heavily reliant on WordPress so very hard coded */
|
27 |
+
if(isset($_POST['responsive_menu_submit'])):
|
28 |
+
$method = 'update';
|
29 |
+
elseif(isset($_POST['responsive_menu_reset'])):
|
30 |
+
$method = 'reset';
|
31 |
+
elseif(isset($_POST['responsive_menu_export'])):
|
32 |
+
$controller = $this->container['admin_controller'];
|
33 |
+
$controller->export();
|
34 |
+
elseif(isset($_POST['responsive_menu_import'])):
|
35 |
+
$method = 'import';
|
36 |
+
else:
|
37 |
+
$method = 'index';
|
38 |
+
endif;
|
39 |
+
|
40 |
+
add_menu_page(
|
41 |
+
'Responsive Menu',
|
42 |
+
'Responsive Menu',
|
43 |
+
'manage_options',
|
44 |
+
'responsive-menu',
|
45 |
+
function() use ($method) {
|
46 |
+
$controller = $this->container['admin_controller'];
|
47 |
+
if($method == 'update' || $method == 'reset'):
|
48 |
+
include dirname(dirname(dirname(__FILE__))) . '/config/default_options.php';
|
49 |
+
$controller->$method($default_options);
|
50 |
+
else:
|
51 |
+
$controller->$method();
|
52 |
+
endif;
|
53 |
+
},
|
54 |
+
'dashicons-menu');
|
55 |
+
}
|
56 |
+
|
57 |
+
}
|
src/app/View/AdminView.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\View;
|
4 |
+
|
5 |
+
class AdminView implements View
|
6 |
+
{
|
7 |
+
|
8 |
+
public function __construct()
|
9 |
+
{
|
10 |
+
if(is_admin() && isset($_GET['page']) && $_GET['page'] == 'responsive-menu'):
|
11 |
+
|
12 |
+
wp_enqueue_media();
|
13 |
+
|
14 |
+
wp_enqueue_style('wp-color-picker');
|
15 |
+
wp_enqueue_script('wp-color-picker');
|
16 |
+
|
17 |
+
wp_enqueue_script('responsive-menu-font-awesome', 'https://use.fontawesome.com/b6bedb3084.js', null, null);
|
18 |
+
|
19 |
+
wp_enqueue_script('postbox');
|
20 |
+
wp_enqueue_script('postbox-edit', plugin_dir_url(dirname(dirname(__FILE__))) . 'public/js/admin/postbox-edit.js', array('jquery', 'postbox'));
|
21 |
+
|
22 |
+
wp_enqueue_script('item-drag', '//code.jquery.com/ui/1.11.4/jquery-ui.js', 'jquery', 'null');
|
23 |
+
|
24 |
+
wp_register_style('admin-css', plugin_dir_url(dirname(dirname(__FILE__))) . 'public/css/admin/main.css', false, null );
|
25 |
+
wp_enqueue_style('admin-css');
|
26 |
+
|
27 |
+
wp_register_script('admin-js', plugin_dir_url(dirname(dirname(__FILE__))) . 'public/js/admin/main.js', 'jquery', null );
|
28 |
+
wp_enqueue_script('admin-js' );
|
29 |
+
|
30 |
+
wp_register_script('sticky-sidebar-js', plugin_dir_url(dirname(dirname(__FILE__))) . 'public/js/admin/sticky-sidebar.js', 'jquery', null );
|
31 |
+
wp_enqueue_script('sticky-sidebar-js');
|
32 |
+
endif;
|
33 |
+
}
|
34 |
+
|
35 |
+
public function render($location, $l = [])
|
36 |
+
{
|
37 |
+
include dirname(dirname(dirname(__FILE__))) . '/views/admin/' . $location . '.phtml';
|
38 |
+
}
|
39 |
+
|
40 |
+
}
|
src/app/View/FrontView.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\View;
|
4 |
+
|
5 |
+
class FrontView implements View
|
6 |
+
{
|
7 |
+
|
8 |
+
public function render($location, $l = [])
|
9 |
+
{
|
10 |
+
add_action('wp_footer', function() use ($location, $l) {
|
11 |
+
include dirname(dirname(dirname(__FILE__))) . '/views/' . $location . '.phtml';
|
12 |
+
});
|
13 |
+
}
|
14 |
+
|
15 |
+
public function make($location, $l = [])
|
16 |
+
{
|
17 |
+
ob_start();
|
18 |
+
include dirname(dirname(dirname(__FILE__))) . '/views/' . $location . '.phtml';
|
19 |
+
$output = ob_get_contents();
|
20 |
+
ob_end_clean();
|
21 |
+
return $output;
|
22 |
+
}
|
23 |
+
|
24 |
+
}
|
src/app/View/View.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\View;
|
4 |
+
|
5 |
+
interface View
|
6 |
+
{
|
7 |
+
public function render($location, $l = []);
|
8 |
+
}
|
src/app/ViewModels/Button.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\ViewModels;
|
4 |
+
|
5 |
+
use ResponsiveMenu\ViewModels\Components\Button\Button as ButtonComponent;
|
6 |
+
use ResponsiveMenu\Collections\OptionsCollection as OptionsCollection;
|
7 |
+
|
8 |
+
class Button {
|
9 |
+
|
10 |
+
public function __construct(OptionsCollection $options) {
|
11 |
+
$this->options = $options;
|
12 |
+
}
|
13 |
+
|
14 |
+
public function getHtml() {
|
15 |
+
$mapper = new ButtonComponent();
|
16 |
+
return $mapper->render($this->options);
|
17 |
+
}
|
18 |
+
|
19 |
+
}
|
src/app/ViewModels/Components/Admin/Boxes.php
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\ViewModels\Components\Admin;
|
4 |
+
use ResponsiveMenu\Collections\OptionsCollection as OptionsCollection;
|
5 |
+
use ResponsiveMenu\Form as Form;
|
6 |
+
|
7 |
+
class Boxes {
|
8 |
+
|
9 |
+
private $config;
|
10 |
+
|
11 |
+
public function __construct(array $config, OptionsCollection $options) {
|
12 |
+
$this->config = $config;
|
13 |
+
$this->options = $options;
|
14 |
+
}
|
15 |
+
|
16 |
+
public function render() {
|
17 |
+
|
18 |
+
foreach($this->config as $tab_name => $sub_menus):
|
19 |
+
echo '<div class="tab_container" id="tab_container_' . $this->i($tab_name) . '">';
|
20 |
+
foreach($sub_menus as $sub_menu_name => $options):
|
21 |
+
echo '
|
22 |
+
<div class="postbox" id="postbox_' . $this->i($sub_menu_name).'">
|
23 |
+
<div class="handlediv">
|
24 |
+
<button aria-expanded="true" class="button-link" type="button">
|
25 |
+
<span class="screen-reader-text">' . __('Toggle panel: Location', 'responsive-menu') . '</span>
|
26 |
+
<span aria-hidden="true" class="toggle-indicator"></span>
|
27 |
+
</button>
|
28 |
+
</div> <!-- .handlediv -->
|
29 |
+
<h2 class="ui-sortable-handle hndle">' . $tab_name . ' » ' . $sub_menu_name . '</h2>
|
30 |
+
<div class="inside">
|
31 |
+
<table class="widefat">';
|
32 |
+
foreach($options as $option):
|
33 |
+
$pro = isset($option['pro']) ? 'pro_option' : '';
|
34 |
+
$semi_pro = isset($option['semi_pro']) ? 'semi_pro_option' : '';
|
35 |
+
$type = isset($option['type']) ? $option['type'] : null;
|
36 |
+
$unit = isset($option['unit']) ? '<span class="units">' . $option['unit'] . '</span>' : null;
|
37 |
+
$select = isset($option['select']) ? $option['select'] : null;
|
38 |
+
echo '<tr class="' . $pro . ' ' . $semi_pro . '" id="' . $option['option'] . '_container">
|
39 |
+
<td>
|
40 |
+
<div class="label">' . $option['title'] . '</div>
|
41 |
+
<span class="description">' . $option['label'] . '</span>
|
42 |
+
</td>
|
43 |
+
<td>';
|
44 |
+
$this->f($type, $option['option'], $select);
|
45 |
+
echo $unit . '</td>
|
46 |
+
</tr>';
|
47 |
+
endforeach;
|
48 |
+
echo '</table>
|
49 |
+
</div> <!-- .inside -->
|
50 |
+
</div> <!-- .postbox -->';
|
51 |
+
endforeach;
|
52 |
+
echo '</div> <!-- .tab_container -->';
|
53 |
+
endforeach;
|
54 |
+
}
|
55 |
+
|
56 |
+
public function i($data) {
|
57 |
+
return strtolower(str_replace([' ', '/'], '_', $data));
|
58 |
+
}
|
59 |
+
|
60 |
+
public function f($type, $option_name, $select) {
|
61 |
+
switch($type):
|
62 |
+
case 'checkbox' : $comp = new Form\Checkbox;
|
63 |
+
$comp->render($this->options[$option_name]);
|
64 |
+
break;
|
65 |
+
case 'colour' : $comp = new Form\Colour;
|
66 |
+
$comp->render($this->options[$option_name]);
|
67 |
+
break;
|
68 |
+
case 'textarea' : $comp = new Form\TextArea;
|
69 |
+
$comp->render($this->options[$option_name]);
|
70 |
+
break;
|
71 |
+
case 'select' : $comp = new Form\Select;
|
72 |
+
$comp->render($this->options[$option_name], $select);
|
73 |
+
break;
|
74 |
+
case 'image' : $comp = new Form\Image;
|
75 |
+
$comp->render($this->options[$option_name]);
|
76 |
+
break;
|
77 |
+
case 'menu_ordering' : $comp = new Form\MenuOrdering;
|
78 |
+
$comp->render($this->options[$option_name]);
|
79 |
+
break;
|
80 |
+
case 'header_ordering' : $comp = new Form\HeaderBarOrdering;
|
81 |
+
$comp->render($this->options[$option_name]);
|
82 |
+
break;
|
83 |
+
case 'fonticons' : $comp = new Form\FontIconPageList;
|
84 |
+
$comp->render($this->options[$option_name]);
|
85 |
+
break;
|
86 |
+
case 'import' : $comp = new Form\Import;
|
87 |
+
$comp->render();
|
88 |
+
break;
|
89 |
+
case 'export' : $comp = new Form\Export;
|
90 |
+
$comp->render();
|
91 |
+
break;
|
92 |
+
case 'reset' : $comp = new Form\Reset;
|
93 |
+
$comp->render();
|
94 |
+
break;
|
95 |
+
default : $comp = new Form\Text;
|
96 |
+
$comp->render($this->options[$option_name]);
|
97 |
+
break;
|
98 |
+
endswitch;
|
99 |
+
|
100 |
+
}
|
101 |
+
|
102 |
+
}
|
src/app/ViewModels/Components/Admin/Tabs.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\ViewModels\Components\Admin;
|
4 |
+
|
5 |
+
class Tabs {
|
6 |
+
|
7 |
+
private $config;
|
8 |
+
|
9 |
+
public function __construct(array $config) {
|
10 |
+
$this->config = $config;
|
11 |
+
}
|
12 |
+
|
13 |
+
public function render() {
|
14 |
+
foreach(array_keys($this->config) as $tab_name) {
|
15 |
+
echo '<a id="tab_' . $this->i($tab_name) . '" class="tab page-title-action">' . $tab_name . '</a>';
|
16 |
+
}
|
17 |
+
}
|
18 |
+
|
19 |
+
public function i($data) {
|
20 |
+
return strtolower(str_replace([' ', '/'], '_', $data));
|
21 |
+
}
|
22 |
+
|
23 |
+
}
|
src/app/ViewModels/Components/Button/Button.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\ViewModels\Components\Button;
|
4 |
+
|
5 |
+
use ResponsiveMenu\ViewModels\Components\ViewComponent as ViewComponent;
|
6 |
+
use ResponsiveMenu\Collections\OptionsCollection as OptionsCollection;
|
7 |
+
|
8 |
+
class Button implements ViewComponent {
|
9 |
+
|
10 |
+
public function render(OptionsCollection $options) {
|
11 |
+
|
12 |
+
$button_title = apply_filters('wpml_translate_single_string', $options['button_title']->getValue(), 'Responsive Menu', 'button_title');
|
13 |
+
$button_title_pos = $options['button_title_position']->getValue();
|
14 |
+
$button_title_html = $button_title != '' ? '<span class="responsive-menu-label responsive-menu-label-'.$button_title_pos.'">'.$button_title.'</span>' : '';
|
15 |
+
$accessible = in_array($button_title_pos, array('left', 'right')) ? 'responsive-menu-accessible' : '';
|
16 |
+
$content = '';
|
17 |
+
|
18 |
+
$content .= $options['use_header_bar'] == 'on' ? '<div id="responsive-menu-header-bar-button" class="responsive-menu-header-box">' : '';
|
19 |
+
|
20 |
+
$content .= '<button id="responsive-menu-button"
|
21 |
+
class="responsive-menu-button ' . $accessible .
|
22 |
+
' responsive-menu-' . $options['button_click_animation'] . '"
|
23 |
+
type="button"
|
24 |
+
aria-label="Menu">';
|
25 |
+
$content .= in_array($button_title_pos, array('top', 'left')) ? $button_title_html : '';
|
26 |
+
$content .= '<span class="responsive-menu-box">' . $options->getButtonIcon() . $options->getButtonIconActive() . '</span>';
|
27 |
+
$content .= in_array($button_title_pos, array('bottom', 'right')) ? $button_title_html : '';
|
28 |
+
$content .= '</button>';
|
29 |
+
$content .= $options['use_header_bar'] == 'on' ? '</div>' : '';
|
30 |
+
|
31 |
+
return $content;
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
}
|
src/app/ViewModels/Components/Menu/AdditionalContent.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\ViewModels\Components\Menu;
|
4 |
+
|
5 |
+
use ResponsiveMenu\ViewModels\Components\ViewComponent as ViewComponent;
|
6 |
+
use ResponsiveMenu\Collections\OptionsCollection as OptionsCollection;
|
7 |
+
|
8 |
+
class AdditionalContent implements ViewComponent {
|
9 |
+
|
10 |
+
public function render(OptionsCollection $options) {
|
11 |
+
|
12 |
+
if($options['menu_additional_content']->getValue()):
|
13 |
+
return '<div id="responsive-menu-additional-content">'.
|
14 |
+
do_shortcode($options['menu_additional_content']) .
|
15 |
+
'</div>';
|
16 |
+
endif;
|
17 |
+
|
18 |
+
}
|
19 |
+
|
20 |
+
}
|
src/app/ViewModels/Components/Menu/Menu.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\ViewModels\Components\Menu;
|
4 |
+
|
5 |
+
use ResponsiveMenu\ViewModels\Components\ViewComponent as ViewComponent;
|
6 |
+
use ResponsiveMenu\Collections\OptionsCollection as OptionsCollection;
|
7 |
+
use ResponsiveMenu\Walkers\WpWalker as Walker;
|
8 |
+
|
9 |
+
class Menu implements ViewComponent {
|
10 |
+
|
11 |
+
public function render(OptionsCollection $options) {
|
12 |
+
|
13 |
+
$menu = apply_filters('wpml_translate_single_string', $options['menu_to_use']->getValue(), 'Responsive Menu', 'menu_to_use');
|
14 |
+
|
15 |
+
return wp_nav_menu(
|
16 |
+
[
|
17 |
+
'container' => '',
|
18 |
+
'menu_id' => 'responsive-menu',
|
19 |
+
'menu_class' => null,
|
20 |
+
'menu' => $menu && !$options['theme_location_menu']->getValue() ? $menu : null,
|
21 |
+
'depth' => $options['menu_depth']->getValue() ? $options['menu_depth']->getValue() : 0,
|
22 |
+
'theme_location' => $options['theme_location_menu']->getValue() ? $options['theme_location_menu']->getValue() : null,
|
23 |
+
'walker' => $options['custom_walker']->getValue() ? new $options['custom_walker']($options) : new Walker($options),
|
24 |
+
'echo' => false
|
25 |
+
]
|
26 |
+
);
|
27 |
+
|
28 |
+
}
|
29 |
+
|
30 |
+
}
|
src/app/ViewModels/Components/Menu/Search.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\ViewModels\Components\Menu;
|
4 |
+
|
5 |
+
use ResponsiveMenu\ViewModels\Components\ViewComponent as ViewComponent;
|
6 |
+
use ResponsiveMenu\Collections\OptionsCollection as OptionsCollection;
|
7 |
+
|
8 |
+
class Search implements ViewComponent {
|
9 |
+
|
10 |
+
public function render(OptionsCollection $options) {
|
11 |
+
|
12 |
+
$action = function_exists( 'icl_get_home_url' ) ? icl_get_home_url() : get_home_url();
|
13 |
+
return '<div id="responsive-menu-search-box">
|
14 |
+
<form action="'.$action.'" class="responsive-menu-search-form" role="search">
|
15 |
+
<input type="search" name="s" placeholder="Search" class="responsive-menu-search-box">
|
16 |
+
</form>
|
17 |
+
</div>';
|
18 |
+
|
19 |
+
}
|
20 |
+
|
21 |
+
}
|
src/app/ViewModels/Components/Menu/Title.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\ViewModels\Components\Menu;
|
4 |
+
|
5 |
+
use ResponsiveMenu\ViewModels\Components\ViewComponent as ViewComponent;
|
6 |
+
use ResponsiveMenu\Collections\OptionsCollection as OptionsCollection;
|
7 |
+
|
8 |
+
class Title implements ViewComponent {
|
9 |
+
|
10 |
+
public function render(OptionsCollection $options) {
|
11 |
+
|
12 |
+
if($options['menu_title']->getValue() || $options->getTitleImage()):
|
13 |
+
$content = '<div id="responsive-menu-title">';
|
14 |
+
if($options->getTitleImage())
|
15 |
+
$content .= '<div id="responsive-menu-title-image">' . $options->getTitleImage() . '</div>';
|
16 |
+
if($options['menu_title_link']->getValue()):
|
17 |
+
$link = apply_filters('wpml_translate_single_string', $options['menu_title_link']->getValue(), 'Responsive Menu', 'menu_title_link');
|
18 |
+
$content .= '<a href="'.$link.'" target="'.$options['menu_title_link_location'].'">';
|
19 |
+
endif;
|
20 |
+
$content .= apply_filters('wpml_translate_single_string', $options['menu_title']->getValue(), 'Responsive Menu', 'menu_title');
|
21 |
+
if($options['menu_title_link']->getValue())
|
22 |
+
$content .= '</a>';
|
23 |
+
$content .= '</div>';
|
24 |
+
return $content;
|
25 |
+
endif;
|
26 |
+
|
27 |
+
}
|
28 |
+
|
29 |
+
}
|
src/app/ViewModels/Components/ViewComponent.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\ViewModels\Components;
|
4 |
+
|
5 |
+
use ResponsiveMenu\Collections\OptionsCollection as OptionsCollection;
|
6 |
+
|
7 |
+
interface ViewComponent {
|
8 |
+
|
9 |
+
public function render(OptionsCollection $collection);
|
10 |
+
|
11 |
+
}
|
src/app/ViewModels/Menu.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\ViewModels;
|
4 |
+
|
5 |
+
use ResponsiveMenu\Collections\OptionsCollection as OptionsCollection;
|
6 |
+
|
7 |
+
class Menu {
|
8 |
+
|
9 |
+
public function __construct(OptionsCollection $options) {
|
10 |
+
$this->options = $options;
|
11 |
+
}
|
12 |
+
|
13 |
+
public function getHtml() {
|
14 |
+
$mapping = [
|
15 |
+
'title' => 'ResponsiveMenu\ViewModels\Components\Menu\Title',
|
16 |
+
'menu' => 'ResponsiveMenu\ViewModels\Components\Menu\Menu',
|
17 |
+
'search' => 'ResponsiveMenu\ViewModels\Components\Menu\Search',
|
18 |
+
'additional content' => 'ResponsiveMenu\ViewModels\Components\Menu\AdditionalContent'
|
19 |
+
];
|
20 |
+
$content = '';
|
21 |
+
|
22 |
+
foreach(json_decode($this->options['items_order']) as $key => $val):
|
23 |
+
if($val == 'on'):
|
24 |
+
$mapper = new $mapping[$key];
|
25 |
+
$content .= $mapper->render($this->options);
|
26 |
+
endif;
|
27 |
+
endforeach;
|
28 |
+
|
29 |
+
return $content;
|
30 |
+
}
|
31 |
+
|
32 |
+
}
|
src/app/WPML/WPML.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\WPML;
|
4 |
+
use ResponsiveMenu\Collections\OptionsCollection as OptionsCollection;
|
5 |
+
|
6 |
+
class WPML {
|
7 |
+
|
8 |
+
public function saveFromOptions(OptionsCollection $options) {
|
9 |
+
do_action('wpml_register_single_string', 'Responsive Menu', 'menu_to_use', $options['menu_to_use']->getValue());
|
10 |
+
do_action('wpml_register_single_string', 'Responsive Menu', 'button_title', $options['button_title']->getValue());
|
11 |
+
do_action('wpml_register_single_string', 'Responsive Menu', 'menu_title', $options['menu_title']->getValue());
|
12 |
+
do_action('wpml_register_single_string', 'Responsive Menu', 'menu_title_link', $options['menu_title_link']->getValue());
|
13 |
+
}
|
14 |
+
|
15 |
+
}
|
src/app/Walkers/WpWalker.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ResponsiveMenu\Walkers;
|
4 |
+
use ResponsiveMenu\Collections\OptionsCollection as OptionsCollection;
|
5 |
+
|
6 |
+
class WpWalker extends \Walker_Nav_Menu
|
7 |
+
{
|
8 |
+
|
9 |
+
private $curItem;
|
10 |
+
|
11 |
+
public function __construct(OptionsCollection $options)
|
12 |
+
{
|
13 |
+
$this->options = $options;
|
14 |
+
}
|
15 |
+
|
16 |
+
public function start_lvl( &$output, $depth = 0, $args = array())
|
17 |
+
{
|
18 |
+
if($this->options['auto_expand_all_submenus'] == 'on'):
|
19 |
+
$class = 'responsive-menu-submenu-open';
|
20 |
+
elseif(
|
21 |
+
($this->options['auto_expand_current_submenus'] == 'on')
|
22 |
+
&& ($this->curItem->current_item_ancestor || $this->curItem->current_item_parent)
|
23 |
+
):
|
24 |
+
$class = 'responsive-menu-submenu-open';
|
25 |
+
else:
|
26 |
+
$class = '';
|
27 |
+
endif;
|
28 |
+
$output .= "<ul class='responsive-menu-submenu responsive-menu-submenu-depth-" . ($depth + 1) . " {$class}'>";
|
29 |
+
}
|
30 |
+
|
31 |
+
public function end_lvl( &$output, $depth = 0, $args = array() )
|
32 |
+
{
|
33 |
+
$output .= "</ul>";
|
34 |
+
}
|
35 |
+
|
36 |
+
public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 )
|
37 |
+
{
|
38 |
+
$this->curItem = $item;
|
39 |
+
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
|
40 |
+
$responsive_menu_classes = [];
|
41 |
+
|
42 |
+
# Turn into our Responsive Menu Classes
|
43 |
+
foreach($classes as $class):
|
44 |
+
switch($class):
|
45 |
+
case 'menu-item': $responsive_menu_classes[] = 'responsive-menu-item'; break;
|
46 |
+
case 'current-menu-item': $responsive_menu_classes[] = 'responsive-menu-current-item'; break;
|
47 |
+
case 'menu-item-has-children': $responsive_menu_classes[] = 'responsive-menu-item-has-children'; break;
|
48 |
+
case 'current-menu-parent': $responsive_menu_classes[] = 'responsive-menu-item-current-parent'; break;
|
49 |
+
case 'current-menu-ancestor': $responsive_menu_classes[] = 'responsive-menu-item-current-ancestor'; break;
|
50 |
+
endswitch;
|
51 |
+
endforeach;
|
52 |
+
|
53 |
+
$class_names = join(' ', array_unique($responsive_menu_classes));
|
54 |
+
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
|
55 |
+
|
56 |
+
$id = ' id="responsive-menu-item-' . esc_attr( $item->ID ) . '"';
|
57 |
+
|
58 |
+
$output .= '<li' . $id . $class_names .'>';
|
59 |
+
|
60 |
+
$atts = array();
|
61 |
+
$atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : '';
|
62 |
+
$atts['target'] = ! empty( $item->target ) ? $item->target : '';
|
63 |
+
$atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';
|
64 |
+
$atts['href'] = ! empty( $item->url ) ? $item->url : '';
|
65 |
+
$atts['class'] = 'responsive-menu-item-link';
|
66 |
+
|
67 |
+
|
68 |
+
$atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args, $depth );
|
69 |
+
|
70 |
+
$attributes = '';
|
71 |
+
foreach ( $atts as $attr => $value ) {
|
72 |
+
if ( ! empty( $value ) ) {
|
73 |
+
$value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
|
74 |
+
$attributes .= ' ' . $attr . '="' . $value . '"';
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
/** This filter is documented in wp-includes/post-template.php */
|
79 |
+
$title = apply_filters( 'the_title', $item->title, $item->ID );
|
80 |
+
|
81 |
+
$title = apply_filters( 'nav_menu_item_title', $title, $item, $args, $depth );
|
82 |
+
|
83 |
+
/* Calculate which arrow to show */
|
84 |
+
if(in_array('responsive-menu-item-has-children', $responsive_menu_classes)):
|
85 |
+
$inactive_arrow = '<div class="responsive-menu-subarrow">' . $this->options->getInActiveArrow() . '</div>';
|
86 |
+
$active_arrow = '<div class="responsive-menu-subarrow responsive-menu-subarrow-active">' . $this->options->getActiveArrow() . '</div>';
|
87 |
+
if($this->options['auto_expand_all_submenus'] == 'on'):
|
88 |
+
$initial_arrow = $active_arrow;
|
89 |
+
elseif(
|
90 |
+
$this->options['auto_expand_current_submenus'] == 'on' && (in_array('responsive-menu-item-current-parent', $responsive_menu_classes)
|
91 |
+
|| in_array('responsive-menu-item-current-ancestor', $responsive_menu_classes))):
|
92 |
+
$initial_arrow = $active_arrow;
|
93 |
+
else:
|
94 |
+
$initial_arrow = $inactive_arrow;
|
95 |
+
endif;
|
96 |
+
else:
|
97 |
+
$initial_arrow = '';
|
98 |
+
endif;
|
99 |
+
|
100 |
+
/* Clear Arrow if we are at the final depth level */
|
101 |
+
if($depth + 1 == $this->options['menu_depth']->getValue())
|
102 |
+
$initial_arrow = '';
|
103 |
+
|
104 |
+
$item_output = '<a'. $attributes .'>';
|
105 |
+
$item_output .= $title;
|
106 |
+
$item_output .= $initial_arrow;
|
107 |
+
$item_output .= '</a>';
|
108 |
+
|
109 |
+
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
|
110 |
+
|
111 |
+
}
|
112 |
+
|
113 |
+
public function end_el( &$output, $item, $depth = 0, $args = array() )
|
114 |
+
{
|
115 |
+
$output .= "</li>";
|
116 |
+
}
|
117 |
+
|
118 |
+
}
|
src/config/admin_ordering.php
ADDED
@@ -0,0 +1,1127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$menus_array = [];
|
4 |
+
foreach(get_terms('nav_menu') as $menu) $menus_array[] = [ 'value' => $menu->slug, 'display' => $menu->name];
|
5 |
+
foreach(get_registered_nav_menus() as $location => $menu) $location_menus[] = ['value' => $location, 'display' => $menu];
|
6 |
+
$location_menus[] = ['value' => '', 'display' => 'None'];
|
7 |
+
|
8 |
+
$order_mapping = [
|
9 |
+
|
10 |
+
/*
|
11 |
+
*
|
12 |
+
* INITIAL SETUP
|
13 |
+
*
|
14 |
+
*/
|
15 |
+
|
16 |
+
__('Initial Setup', 'responsive-menu') => [
|
17 |
+
__('Menu', 'responsive-menu') =>
|
18 |
+
[
|
19 |
+
[
|
20 |
+
'option' => 'breakpoint',
|
21 |
+
'title' => __('Breakpoint', 'responsive-menu'),
|
22 |
+
'label' => __('This is the width of the screen at which point you would like the menu to start showing', 'responsive-menu'),
|
23 |
+
'unit' => 'px'
|
24 |
+
],
|
25 |
+
[
|
26 |
+
'option' => 'menu_to_use',
|
27 |
+
'title' => __('Menu to Use', 'responsive-menu'),
|
28 |
+
'label' => __('', 'responsive-menu'),
|
29 |
+
'type' => 'select',
|
30 |
+
'select' => $menus_array
|
31 |
+
],
|
32 |
+
[
|
33 |
+
'option' => 'menu_to_hide',
|
34 |
+
'title' => __('CSS of Menu to Hide', 'responsive-menu'),
|
35 |
+
'label' => __('', 'responsive-menu')
|
36 |
+
]
|
37 |
+
]
|
38 |
+
],
|
39 |
+
|
40 |
+
|
41 |
+
/*
|
42 |
+
*
|
43 |
+
* MENU
|
44 |
+
*
|
45 |
+
*/
|
46 |
+
|
47 |
+
__('Menu', 'responsive-menu') => [
|
48 |
+
__('Section Ordering', 'responsive-menu') => [
|
49 |
+
[
|
50 |
+
'option' => 'items_order',
|
51 |
+
'title' => __('Order of Menu Items', 'responsive-menu'),
|
52 |
+
'label' => __('Drag the items to re-order and click to turn them on/off', 'responsive-menu'),
|
53 |
+
'type' => 'menu_ordering'
|
54 |
+
]
|
55 |
+
],
|
56 |
+
__('Font Icons', 'responsive-menu') =>
|
57 |
+
[
|
58 |
+
[
|
59 |
+
'option' => 'menu_font_icons',
|
60 |
+
'title' => __('Font Icons', 'responsive-menu'),
|
61 |
+
'label' => __('Responsive Menu uses the brilliant <a href="http://fontawesome.io/icons/" target="_blank">Awesome Font Icons</a> for implementing icons in your menu - for more info please visit our doc pages at <a href="https://responsive.menu/docs/basic-setup/font-icons/" target="_blank">https://responsive.menu/docs/basic-setup/font-icons/</a>', 'responsive-menu'),
|
62 |
+
'type' => 'fonticons',
|
63 |
+
'pro' => true
|
64 |
+
]
|
65 |
+
],
|
66 |
+
__('Sizing', 'responsive-menu') =>
|
67 |
+
[
|
68 |
+
[
|
69 |
+
'option' => 'menu_width',
|
70 |
+
'title' => __('Menu Width', 'responsive-menu'),
|
71 |
+
'label' => __('', 'responsive-menu'),
|
72 |
+
'unit' => '%'
|
73 |
+
],
|
74 |
+
[
|
75 |
+
'option' => 'menu_maximum_width',
|
76 |
+
'title' => __('Maximum Width', 'responsive-menu'),
|
77 |
+
'label' => __('', 'responsive-menu'),
|
78 |
+
'unit' => 'px'
|
79 |
+
],
|
80 |
+
[
|
81 |
+
'option' => 'menu_minimum_width',
|
82 |
+
'title' => __('Minimum Width', 'responsive-menu'),
|
83 |
+
'label' => __('', 'responsive-menu'),
|
84 |
+
'unit' => 'px'
|
85 |
+
],
|
86 |
+
[
|
87 |
+
'option' => 'menu_links_height',
|
88 |
+
'title' => __('Links Height', 'responsive-menu'),
|
89 |
+
'label' => __('', 'responsive-menu'),
|
90 |
+
'unit' => 'px'
|
91 |
+
],
|
92 |
+
[
|
93 |
+
'option' => 'menu_auto_height',
|
94 |
+
'title' => __('Menu Auto Height', 'responsive-menu'),
|
95 |
+
'label' => __('', 'responsive-menu'),
|
96 |
+
'type' => 'checkbox',
|
97 |
+
'pro' => true
|
98 |
+
],
|
99 |
+
],
|
100 |
+
__('Title', 'responsive-menu') =>
|
101 |
+
[
|
102 |
+
[
|
103 |
+
'option' => 'menu_title',
|
104 |
+
'title' => __('Text', 'responsive-menu'),
|
105 |
+
'label' => __('', 'responsive-menu')
|
106 |
+
],
|
107 |
+
[
|
108 |
+
'option' => 'menu_title_link',
|
109 |
+
'title' => __('Link', 'responsive-menu'),
|
110 |
+
'label' => __('', 'responsive-menu'),
|
111 |
+
],
|
112 |
+
[
|
113 |
+
'option' => 'menu_title_link_location',
|
114 |
+
'title' => __('Link Location', 'responsive-menu'),
|
115 |
+
'label' => __('', 'responsive-menu'),
|
116 |
+
'type' => 'select',
|
117 |
+
'select' => [
|
118 |
+
['value' => '_blank', 'display' => 'New Tab'],
|
119 |
+
['value' => '_self', 'display' => 'Same Page'],
|
120 |
+
['value' => '_parent', 'display' => 'Parent Page'],
|
121 |
+
['value' => '_top', 'display' => 'Full Window Body']
|
122 |
+
]
|
123 |
+
],
|
124 |
+
[
|
125 |
+
'option' => 'menu_title_font_size',
|
126 |
+
'title' => __('Title Font Size', 'responsive-menu'),
|
127 |
+
'label' => __('', 'responsive-menu'),
|
128 |
+
'unit' => 'px'
|
129 |
+
],
|
130 |
+
[
|
131 |
+
'option' => 'menu_title_font_icon',
|
132 |
+
'title' => __('Font Icon', 'responsive-menu'),
|
133 |
+
'label' => __('', 'responsive-menu'),
|
134 |
+
'pro' => true
|
135 |
+
],
|
136 |
+
[
|
137 |
+
'option' => 'menu_title_image',
|
138 |
+
'title' => __('Image', 'responsive-menu'),
|
139 |
+
'label' => __('', 'responsive-menu'),
|
140 |
+
'type' => 'image'
|
141 |
+
],
|
142 |
+
[
|
143 |
+
'option' => 'menu_title_background_colour',
|
144 |
+
'title' => __('Title Background Colour', 'responsive-menu'),
|
145 |
+
'label' => __('', 'responsive-menu'),
|
146 |
+
'type' => 'colour',
|
147 |
+
'semi_pro' => true
|
148 |
+
],
|
149 |
+
[
|
150 |
+
'option' => 'menu_title_background_hover_colour',
|
151 |
+
'title' => __('Title Background Colour Hover', 'responsive-menu'),
|
152 |
+
'label' => __('', 'responsive-menu'),
|
153 |
+
'type' => 'colour',
|
154 |
+
'semi_pro' => true
|
155 |
+
],
|
156 |
+
[
|
157 |
+
'option' => 'menu_title_colour',
|
158 |
+
'title' => __('Title Colour', 'responsive-menu'),
|
159 |
+
'label' => __('', 'responsive-menu'),
|
160 |
+
'type' => 'colour',
|
161 |
+
'semi_pro' => true
|
162 |
+
],
|
163 |
+
[
|
164 |
+
'option' => 'menu_title_hover_colour',
|
165 |
+
'title' => __('Title Hover Colour', 'responsive-menu'),
|
166 |
+
'label' => __('', 'responsive-menu'),
|
167 |
+
'type' => 'colour',
|
168 |
+
'semi_pro' => true
|
169 |
+
]
|
170 |
+
|
171 |
+
],
|
172 |
+
__('Additional Content', 'responsive-menu') =>
|
173 |
+
[
|
174 |
+
[
|
175 |
+
'option' => 'menu_additional_content',
|
176 |
+
'title' => __('Text', 'responsive-menu'),
|
177 |
+
'label' => __('HTMl and Shortcodes can be used', 'responsive-menu'),
|
178 |
+
'type' => 'textarea'
|
179 |
+
],
|
180 |
+
[
|
181 |
+
'option' => 'menu_additional_content_colour',
|
182 |
+
'title' => __('Colour', 'responsive-menu'),
|
183 |
+
'label' => __('', 'responsive-menu'),
|
184 |
+
'type' => 'colour'
|
185 |
+
],
|
186 |
+
],
|
187 |
+
__('Animation', 'responsive-menu') =>
|
188 |
+
[
|
189 |
+
[
|
190 |
+
'option' => 'menu_appear_from',
|
191 |
+
'title' => __('Appear From', 'responsive-menu'),
|
192 |
+
'label' => __('', 'responsive-menu'),
|
193 |
+
'type' => 'select',
|
194 |
+
'select' => [
|
195 |
+
['value' => 'top', 'display' => 'Top'],
|
196 |
+
['value' => 'left', 'display' => 'Left'],
|
197 |
+
['value' => 'right', 'display' => 'Right'],
|
198 |
+
['value' => 'bottom', 'display' => 'Bottom']
|
199 |
+
],
|
200 |
+
],
|
201 |
+
[
|
202 |
+
'option' => 'animation_type',
|
203 |
+
'title' => __('Animation Type', 'responsive-menu'),
|
204 |
+
'label' => __('', 'responsive-menu'),
|
205 |
+
'type' => 'select',
|
206 |
+
'semi_pro' => true,
|
207 |
+
'select' => [
|
208 |
+
['value' => 'slide', 'display' => 'Slide'],
|
209 |
+
['value' => 'push', 'display' => 'Push'],
|
210 |
+
['value' => 'fade', 'display' => 'Fade', 'disabled' => true]
|
211 |
+
]
|
212 |
+
],
|
213 |
+
[
|
214 |
+
'option' => 'page_wrapper',
|
215 |
+
'title' => __('Page Wrapper CSS selector', 'responsive-menu'),
|
216 |
+
'label' => __('This is only needed if you are using the push animation above', 'responsive-menu')
|
217 |
+
],
|
218 |
+
[
|
219 |
+
'option' => 'menu_close_on_body_click',
|
220 |
+
'title' => __('Close Menu on Body Clicks', 'responsive-menu'),
|
221 |
+
'label' => __('', 'responsive-menu'),
|
222 |
+
'type' => 'checkbox'
|
223 |
+
],
|
224 |
+
[
|
225 |
+
'option' => 'menu_close_on_link_click',
|
226 |
+
'title' => __('Close Menu on Link Clicks', 'responsive-menu'),
|
227 |
+
'label' => __('', 'responsive-menu'),
|
228 |
+
'type' => 'checkbox'
|
229 |
+
],
|
230 |
+
],
|
231 |
+
__('Search Box', 'responsive-menu') =>
|
232 |
+
[
|
233 |
+
[
|
234 |
+
'option' => 'menu_search_box_text',
|
235 |
+
'title' => __('Menu Search Box Text', 'responsive-menu'),
|
236 |
+
'label' => __('', 'responsive-menu'),
|
237 |
+
'pro' => true
|
238 |
+
],
|
239 |
+
|
240 |
+
],
|
241 |
+
__('Background Colours', 'responsive-menu') =>
|
242 |
+
[
|
243 |
+
[
|
244 |
+
'option' => 'menu_background_colour',
|
245 |
+
'title' => __('Background Colour', 'responsive-menu'),
|
246 |
+
'label' => __('', 'responsive-menu'),
|
247 |
+
'type' => 'colour',
|
248 |
+
'semi_pro' => true
|
249 |
+
],
|
250 |
+
[
|
251 |
+
'option' => 'menu_item_background_colour',
|
252 |
+
'title' => __('Item Background Colour', 'responsive-menu'),
|
253 |
+
'label' => __('', 'responsive-menu'),
|
254 |
+
'type' => 'colour',
|
255 |
+
'semi_pro' => true
|
256 |
+
],
|
257 |
+
[
|
258 |
+
'option' => 'menu_item_background_hover_colour',
|
259 |
+
'title' => __('Item Background Colour Hover', 'responsive-menu'),
|
260 |
+
'label' => __('', 'responsive-menu'),
|
261 |
+
'type' => 'colour',
|
262 |
+
'semi_pro' => true
|
263 |
+
],
|
264 |
+
[
|
265 |
+
'option' => 'menu_item_border_colour',
|
266 |
+
'title' => __('Item Border Colour', 'responsive-menu'),
|
267 |
+
'label' => __('', 'responsive-menu'),
|
268 |
+
'type' => 'colour',
|
269 |
+
'semi_pro' => true
|
270 |
+
],
|
271 |
+
[
|
272 |
+
'option' => 'menu_item_border_colour_hover',
|
273 |
+
'title' => __('Item Border Colour Hover', 'responsive-menu'),
|
274 |
+
'label' => __('', 'responsive-menu'),
|
275 |
+
'type' => 'colour',
|
276 |
+
'semi_pro' => true
|
277 |
+
],
|
278 |
+
[
|
279 |
+
'option' => 'menu_current_item_background_colour',
|
280 |
+
'title' => __('Current Item Background Colour', 'responsive-menu'),
|
281 |
+
'label' => __('', 'responsive-menu'),
|
282 |
+
'type' => 'colour',
|
283 |
+
'semi_pro' => true
|
284 |
+
],
|
285 |
+
[
|
286 |
+
'option' => 'menu_current_item_background_hover_colour',
|
287 |
+
'title' => __('Current Item Background Colour Hover', 'responsive-menu'),
|
288 |
+
'label' => __('', 'responsive-menu'),
|
289 |
+
'type' => 'colour',
|
290 |
+
'semi_pro' => true
|
291 |
+
],
|
292 |
+
],
|
293 |
+
__('Text Colours', 'responsive-menu') =>
|
294 |
+
[
|
295 |
+
|
296 |
+
[
|
297 |
+
'option' => 'menu_link_colour',
|
298 |
+
'title' => __('Link Colour', 'responsive-menu'),
|
299 |
+
'label' => __('', 'responsive-menu'),
|
300 |
+
'type' => 'colour',
|
301 |
+
'semi_pro' => true
|
302 |
+
],
|
303 |
+
[
|
304 |
+
'option' => 'menu_link_hover_colour',
|
305 |
+
'title' => __('Link Hover Colour', 'responsive-menu'),
|
306 |
+
'label' => __('', 'responsive-menu'),
|
307 |
+
'type' => 'colour',
|
308 |
+
'semi_pro' => true
|
309 |
+
],
|
310 |
+
[
|
311 |
+
'option' => 'menu_current_link_colour',
|
312 |
+
'title' => __('Current Link Colour', 'responsive-menu'),
|
313 |
+
'label' => __('', 'responsive-menu'),
|
314 |
+
'type' => 'colour',
|
315 |
+
'semi_pro' => true
|
316 |
+
],
|
317 |
+
[
|
318 |
+
'option' => 'menu_current_link_hover_colour',
|
319 |
+
'title' => __('Current Link Hover Colour', 'responsive-menu'),
|
320 |
+
'label' => __('', 'responsive-menu'),
|
321 |
+
'type' => 'colour',
|
322 |
+
'semi_pro' => true
|
323 |
+
],
|
324 |
+
|
325 |
+
],
|
326 |
+
__('Text Styling', 'responsive-menu') =>
|
327 |
+
[
|
328 |
+
[
|
329 |
+
'option' => 'menu_font',
|
330 |
+
'title' => __('Font', 'responsive-menu'),
|
331 |
+
'label' => __('', 'responsive-menu')
|
332 |
+
],
|
333 |
+
[
|
334 |
+
'option' => 'menu_font_size',
|
335 |
+
'title' => __('Font Size', 'responsive-menu'),
|
336 |
+
'label' => __('', 'responsive-menu'),
|
337 |
+
'unit' => 'px'
|
338 |
+
],
|
339 |
+
[
|
340 |
+
'option' => 'menu_text_alignment',
|
341 |
+
'title' => __('Text Alignment', 'responsive-menu'),
|
342 |
+
'label' => __('', 'responsive-menu'),
|
343 |
+
'type' => 'select',
|
344 |
+
'select' => [
|
345 |
+
['value' => 'left', 'display' => 'Left'],
|
346 |
+
['value' => 'right', 'display' => 'Right'],
|
347 |
+
['value' => 'center', 'display' => 'Centred'],
|
348 |
+
['value' => 'justify', 'display' => 'Justified']
|
349 |
+
]
|
350 |
+
],
|
351 |
+
[
|
352 |
+
'option' => 'menu_word_wrap',
|
353 |
+
'title' => __('Word Wrap', 'responsive-menu'),
|
354 |
+
'label' => __('', 'responsive-menu'),
|
355 |
+
'type' => 'checkbox',
|
356 |
+
'pro' => true
|
357 |
+
],
|
358 |
+
],
|
359 |
+
__('Page Overlay', 'responsive-menu') =>
|
360 |
+
[
|
361 |
+
[
|
362 |
+
'option' => 'menu_overlay',
|
363 |
+
'title' => __('Add Page Overlay When Menu Open', 'responsive-menu'),
|
364 |
+
'label' => __('', 'responsive-menu'),
|
365 |
+
'type' => 'checkbox',
|
366 |
+
'pro' => true
|
367 |
+
],
|
368 |
+
[
|
369 |
+
'option' => 'menu_overlay_colour',
|
370 |
+
'title' => __('Overlay Colour', 'responsive-menu'),
|
371 |
+
'label' => __('', 'responsive-menu'),
|
372 |
+
'type' => 'colour',
|
373 |
+
'pro' => true
|
374 |
+
],
|
375 |
+
],
|
376 |
+
__('Advanced', 'responsive-menu') =>
|
377 |
+
[
|
378 |
+
[
|
379 |
+
'option' => 'menu_depth',
|
380 |
+
'title' => __('Depth', 'responsive-menu'),
|
381 |
+
'label' => __('', 'responsive-menu'),
|
382 |
+
'type' => 'select',
|
383 |
+
'select' => [
|
384 |
+
['value' => 1, 'display' => 1],
|
385 |
+
['value' => 2, 'display' => 2],
|
386 |
+
['value' => 3, 'display' => 3],
|
387 |
+
['value' => 4, 'display' => 4],
|
388 |
+
['value' => 5, 'display' => 5],
|
389 |
+
]
|
390 |
+
],
|
391 |
+
[
|
392 |
+
'option' => 'menu_disable_scrolling',
|
393 |
+
'title' => __('Disable Scrolling when Menu Active', 'responsive-menu'),
|
394 |
+
'label' => __('', 'responsive-menu'),
|
395 |
+
'type' => 'checkbox',
|
396 |
+
'pro' => true
|
397 |
+
],
|
398 |
+
[
|
399 |
+
'option' => 'theme_location_menu',
|
400 |
+
'title' => __('Theme Location Menu', 'responsive-menu'),
|
401 |
+
'label' => __('', 'responsive-menu'),
|
402 |
+
'type' => 'select',
|
403 |
+
'select' => $location_menus
|
404 |
+
]
|
405 |
+
],
|
406 |
+
],
|
407 |
+
|
408 |
+
/*
|
409 |
+
*
|
410 |
+
* BUTTON
|
411 |
+
*
|
412 |
+
*/
|
413 |
+
|
414 |
+
__('Button', 'responsive-menu') => [
|
415 |
+
__('Animation', 'responsive-menu') =>
|
416 |
+
[
|
417 |
+
[
|
418 |
+
'option' => 'button_click_animation',
|
419 |
+
'title' => __('Animation Type', 'responsive-menu'),
|
420 |
+
'label' => __('To see all animations in action please visit <a href="https://jonsuh.com/hamburgers/" target="_blank">this page</a>', 'responsive-menu'),
|
421 |
+
'type' => 'select',
|
422 |
+
'select' => [
|
423 |
+
['value' => 'off', 'display' => 'Off'],
|
424 |
+
['value' => '3dx', 'display' => '3DX', 'disabled' => true],
|
425 |
+
['value' => '3dx-r', 'display' => '3DX Reverse', 'disabled' => true],
|
426 |
+
['value' => '3dy', 'display' => '3DY', 'disabled' => true],
|
427 |
+
['value' => '3dy-r', 'display' => '3DY Reverse', 'disabled' => true],
|
428 |
+
['value' => 'arrow', 'display' => 'Arrow', 'disabled' => true],
|
429 |
+
['value' => 'arrow-r', 'display' => 'Arrow Reverse', 'disabled' => true],
|
430 |
+
['value' => 'arrowalt', 'display' => 'Arrow Alt', 'disabled' => true],
|
431 |
+
['value' => 'arrowalt-r', 'display' => 'Arrow Alt Reverse', 'disabled' => true],
|
432 |
+
['value' => 'boring', 'display' => 'Boring'],
|
433 |
+
['value' => 'collapse', 'display' => 'Collapse', 'disabled' => true],
|
434 |
+
['value' => 'collapse-r', 'display' => 'Collapse Reverse', 'disabled' => true],
|
435 |
+
['value' => 'elastic', 'display' => 'Elastic', 'disabled' => true],
|
436 |
+
['value' => 'elastic-r', 'display' => 'Elastic Reverse', 'disabled' => true],
|
437 |
+
['value' => 'emphatic', 'display' => 'Emphatic', 'disabled' => true],
|
438 |
+
['value' => 'emphatic-r', 'display' => 'Emphatic Reverse', 'disabled' => true],
|
439 |
+
['value' => 'slider', 'display' => 'Slider', 'disabled' => true],
|
440 |
+
['value' => 'slider-r', 'display' => 'Slider Reverse', 'disabled' => true],
|
441 |
+
['value' => 'spin', 'display' => 'Spin', 'disabled' => true],
|
442 |
+
['value' => 'spin-r', 'display' => 'Spin Reverse', 'disabled' => true],
|
443 |
+
['value' => 'spring', 'display' => 'Spring', 'disabled' => true],
|
444 |
+
['value' => 'spring-r', 'display' => 'Spring Reverse', 'disabled' => true],
|
445 |
+
['value' => 'stand', 'display' => 'Stand', 'disabled' => true],
|
446 |
+
['value' => 'stand-r', 'display' => 'Stand Reverse', 'disabled' => true],
|
447 |
+
['value' => 'squeeze', 'display' => 'Squeeze', 'disabled' => true],
|
448 |
+
['value' => 'vortex', 'display' => 'Vortex', 'disabled' => true],
|
449 |
+
['value' => 'vortex-r', 'display' => 'Vortex Reverse', 'disabled' => true]
|
450 |
+
],
|
451 |
+
'semi_pro' => true
|
452 |
+
],
|
453 |
+
[
|
454 |
+
'option' => 'button_position_type',
|
455 |
+
'title' => __('Position Type', 'responsive-menu'),
|
456 |
+
'label' => __('', 'responsive-menu'),
|
457 |
+
'type' => 'select',
|
458 |
+
'select' => [
|
459 |
+
['value' => 'absolute', 'display' => 'Absolute'],
|
460 |
+
['value' => 'fixed', 'display' => 'Fixed'],
|
461 |
+
['value' => 'relative', 'display' => 'Relative']
|
462 |
+
]
|
463 |
+
],
|
464 |
+
[
|
465 |
+
'option' => 'button_push_with_animation',
|
466 |
+
'title' => __('Push Button with Animation', 'responsive-menu'),
|
467 |
+
'label' => __('', 'responsive-menu'),
|
468 |
+
'type' => 'checkbox'
|
469 |
+
],
|
470 |
+
],
|
471 |
+
__('Location', 'responsive-menu') =>
|
472 |
+
[
|
473 |
+
[
|
474 |
+
'option' => 'button_distance_from_side',
|
475 |
+
'title' => __('Distance from Side', 'responsive-menu'),
|
476 |
+
'label' => __('', 'responsive-menu'),
|
477 |
+
'unit' => '%'
|
478 |
+
],
|
479 |
+
[
|
480 |
+
'option' => 'button_left_or_right',
|
481 |
+
'title' => __('Button Side', 'responsive-menu'),
|
482 |
+
'label' => __('', 'responsive-menu'),
|
483 |
+
'type' => 'select',
|
484 |
+
'select' => [
|
485 |
+
['value' => 'left', 'display' => 'Left'],
|
486 |
+
['value' => 'right', 'display' => 'Right']
|
487 |
+
]
|
488 |
+
],
|
489 |
+
[
|
490 |
+
'option' => 'button_top',
|
491 |
+
'title' => __('Distance from Top', 'responsive-menu'),
|
492 |
+
'label' => __('', 'responsive-menu'),
|
493 |
+
'unit' => 'px'
|
494 |
+
],
|
495 |
+
],
|
496 |
+
__('Container Sizing', 'responsive-menu') =>
|
497 |
+
[
|
498 |
+
[
|
499 |
+
'option' => 'button_height',
|
500 |
+
'title' => __('Height', 'responsive-menu'),
|
501 |
+
'label' => __('', 'responsive-menu'),
|
502 |
+
'unit' => 'px'
|
503 |
+
],
|
504 |
+
[
|
505 |
+
'option' => 'button_width',
|
506 |
+
'title' => __('Width', 'responsive-menu'),
|
507 |
+
'label' => __('', 'responsive-menu'),
|
508 |
+
'unit' => 'px'
|
509 |
+
],
|
510 |
+
],
|
511 |
+
__('Hamburger Sizing', 'responsive-menu') =>
|
512 |
+
[
|
513 |
+
[
|
514 |
+
'option' => 'button_line_height',
|
515 |
+
'title' => __('Line Height', 'responsive-menu'),
|
516 |
+
'label' => __('', 'responsive-menu'),
|
517 |
+
'unit' => 'px'
|
518 |
+
],
|
519 |
+
[
|
520 |
+
'option' => 'button_line_margin',
|
521 |
+
'title' => __('Line Margin', 'responsive-menu'),
|
522 |
+
'label' => __('', 'responsive-menu'),
|
523 |
+
'unit' => 'px'
|
524 |
+
],
|
525 |
+
[
|
526 |
+
'option' => 'button_line_width',
|
527 |
+
'title' => __('Line Width', 'responsive-menu'),
|
528 |
+
'label' => __('', 'responsive-menu'),
|
529 |
+
'unit' => 'px'
|
530 |
+
],
|
531 |
+
|
532 |
+
],
|
533 |
+
__('Background Colours', 'responsive-menu') => [
|
534 |
+
[
|
535 |
+
'option' => 'button_background_colour',
|
536 |
+
'title' => __('Background Colour', 'responsive-menu'),
|
537 |
+
'label' => __('', 'responsive-menu'),
|
538 |
+
'type' => 'colour',
|
539 |
+
'semi_pro' => true
|
540 |
+
],
|
541 |
+
[
|
542 |
+
'option' => 'button_background_colour_hover',
|
543 |
+
'title' => __('Background Hover Colour', 'responsive-menu'),
|
544 |
+
'label' => __('', 'responsive-menu'),
|
545 |
+
'type' => 'colour',
|
546 |
+
'semi_pro' => true
|
547 |
+
],
|
548 |
+
[
|
549 |
+
'option' => 'button_transparent_background',
|
550 |
+
'title' => __('Transparent Background', 'responsive-menu'),
|
551 |
+
'label' => __('', 'responsive-menu'),
|
552 |
+
'type' => 'checkbox'
|
553 |
+
]
|
554 |
+
],
|
555 |
+
__('Line Colours', 'responsive-menu') => [
|
556 |
+
[
|
557 |
+
'option' => 'button_line_colour',
|
558 |
+
'title' => __('Line Colour', 'responsive-menu'),
|
559 |
+
'label' => __('', 'responsive-menu'),
|
560 |
+
'type' => 'colour',
|
561 |
+
'semi_pro' => true
|
562 |
+
],
|
563 |
+
],
|
564 |
+
__('Title', 'responsive-menu') => [
|
565 |
+
[
|
566 |
+
'option' => 'button_title',
|
567 |
+
'title' => __('Text', 'responsive-menu'),
|
568 |
+
'label' => __('', 'responsive-menu'),
|
569 |
+
],
|
570 |
+
[
|
571 |
+
'option' => 'button_text_colour',
|
572 |
+
'title' => __('Colour', 'responsive-menu'),
|
573 |
+
'label' => __('', 'responsive-menu'),
|
574 |
+
'type' => 'colour',
|
575 |
+
'semi_pro' => true
|
576 |
+
],
|
577 |
+
[
|
578 |
+
'option' => 'button_title_position',
|
579 |
+
'title' => __('Title Text Position', 'responsive-menu'),
|
580 |
+
'label' => __('', 'responsive-menu'),
|
581 |
+
'type' => 'select',
|
582 |
+
'select' => [
|
583 |
+
['value' => 'left', 'display' => 'Left'],
|
584 |
+
['value' => 'right', 'display' => 'Right'],
|
585 |
+
['value' => 'top', 'display' => 'Top'],
|
586 |
+
['value' => 'bottom', 'display' => 'Bottom']
|
587 |
+
]
|
588 |
+
],
|
589 |
+
[
|
590 |
+
'option' => 'button_font',
|
591 |
+
'title' => __('Font', 'responsive-menu'),
|
592 |
+
'label' => __('', 'responsive-menu'),
|
593 |
+
],
|
594 |
+
[
|
595 |
+
'option' => 'button_font_size',
|
596 |
+
'title' => __('Font Size', 'responsive-menu'),
|
597 |
+
'label' => __('', 'responsive-menu'),
|
598 |
+
'unit' => 'px'
|
599 |
+
],
|
600 |
+
[
|
601 |
+
'option' => 'button_title_line_height',
|
602 |
+
'title' => __('Line Height', 'responsive-menu'),
|
603 |
+
'label' => __('', 'responsive-menu'),
|
604 |
+
'unit' => 'px'
|
605 |
+
],
|
606 |
+
],
|
607 |
+
__('Image', 'responsive-menu') =>
|
608 |
+
[
|
609 |
+
[
|
610 |
+
'option' => 'button_font_icon',
|
611 |
+
'title' => __('Font Icon', 'responsive-menu'),
|
612 |
+
'label' => __('', 'responsive-menu'),
|
613 |
+
'pro' => true
|
614 |
+
],
|
615 |
+
[
|
616 |
+
'option' => 'button_font_icon_when_clicked',
|
617 |
+
'title' => __('Font Icon When Clicked', 'responsive-menu'),
|
618 |
+
'label' => __('', 'responsive-menu'),
|
619 |
+
'pro' => true
|
620 |
+
],
|
621 |
+
[
|
622 |
+
'option' => 'button_image',
|
623 |
+
'title' => __('Image', 'responsive-menu'),
|
624 |
+
'label' => __('', 'responsive-menu'),
|
625 |
+
'type' => 'image'
|
626 |
+
],
|
627 |
+
[
|
628 |
+
'option' => 'button_image_when_clicked',
|
629 |
+
'title' => __('Image When Clicked', 'responsive-menu'),
|
630 |
+
'label' => __('', 'responsive-menu'),
|
631 |
+
'type' => 'image'
|
632 |
+
]
|
633 |
+
],
|
634 |
+
__('Advanced', 'responsive-menu') =>
|
635 |
+
[
|
636 |
+
[
|
637 |
+
'option' => 'button_click_trigger',
|
638 |
+
'title' => __('Trigger', 'responsive-menu'),
|
639 |
+
'label' => __('', 'responsive-menu'),
|
640 |
+
],
|
641 |
+
],
|
642 |
+
],
|
643 |
+
|
644 |
+
/*
|
645 |
+
*
|
646 |
+
* SUB MENUS
|
647 |
+
*
|
648 |
+
*/
|
649 |
+
__('Sub-Menus', 'responsive-menu') => [
|
650 |
+
|
651 |
+
__('Toggle Button Colours', 'responsive-menu') =>
|
652 |
+
[
|
653 |
+
[
|
654 |
+
'option' => 'menu_sub_arrow_background_colour',
|
655 |
+
'title' => __('Background Colour', 'responsive-menu'),
|
656 |
+
'label' => __('', 'responsive-menu'),
|
657 |
+
'type' => 'colour',
|
658 |
+
'semi_pro' => true
|
659 |
+
],
|
660 |
+
[
|
661 |
+
'option' => 'menu_sub_arrow_background_hover_colour',
|
662 |
+
'title' => __('Background Hover Colour', 'responsive-menu'),
|
663 |
+
'label' => __('', 'responsive-menu'),
|
664 |
+
'type' => 'colour',
|
665 |
+
'semi_pro' => true
|
666 |
+
],
|
667 |
+
[
|
668 |
+
'option' => 'menu_sub_arrow_border_colour',
|
669 |
+
'title' => __('Border Colour', 'responsive-menu'),
|
670 |
+
'label' => __('', 'responsive-menu'),
|
671 |
+
'type' => 'colour',
|
672 |
+
'semi_pro' => true
|
673 |
+
],
|
674 |
+
[
|
675 |
+
'option' => 'menu_sub_arrow_border_hover_colour',
|
676 |
+
'title' => __('Border Hover Colour', 'responsive-menu'),
|
677 |
+
'label' => __('', 'responsive-menu'),
|
678 |
+
'type' => 'colour',
|
679 |
+
'semi_pro' => true
|
680 |
+
],
|
681 |
+
],
|
682 |
+
__('Toggle Icon Colours', 'responsive-menu') =>
|
683 |
+
[
|
684 |
+
[
|
685 |
+
'option' => 'menu_sub_arrow_shape_colour',
|
686 |
+
'title' => __('Icon Colour', 'responsive-menu'),
|
687 |
+
'label' => __('', 'responsive-menu'),
|
688 |
+
'type' => 'colour',
|
689 |
+
'semi_pro' => true
|
690 |
+
],
|
691 |
+
[
|
692 |
+
'option' => 'menu_sub_arrow_shape_hover_colour',
|
693 |
+
'title' => __('Icon Hover Colour', 'responsive-menu'),
|
694 |
+
'label' => __('', 'responsive-menu'),
|
695 |
+
'type' => 'colour',
|
696 |
+
'semi_pro' => true
|
697 |
+
],
|
698 |
+
],
|
699 |
+
__('Animations', 'responsive-menu') =>
|
700 |
+
[
|
701 |
+
[
|
702 |
+
'option' => 'accordion_animation',
|
703 |
+
'title' => __('Use Accordion Animation', 'responsive-menu'),
|
704 |
+
'label' => __('', 'responsive-menu'),
|
705 |
+
'type' => 'checkbox'
|
706 |
+
],
|
707 |
+
[
|
708 |
+
'option' => 'auto_expand_all_submenus',
|
709 |
+
'title' => __('Auto Expand All Submenus', 'responsive-menu'),
|
710 |
+
'label' => __('', 'responsive-menu'),
|
711 |
+
'type' => 'checkbox'
|
712 |
+
],
|
713 |
+
[
|
714 |
+
'option' => 'auto_expand_current_submenus',
|
715 |
+
'title' => __('Auto Expand Current Submenus', 'responsive-menu'),
|
716 |
+
'label' => __('', 'responsive-menu'),
|
717 |
+
'type' => 'checkbox'
|
718 |
+
],
|
719 |
+
[
|
720 |
+
'option' => 'menu_item_click_to_trigger_submenu',
|
721 |
+
'title' => __('Disable Parent Item Clicks', 'responsive-menu'),
|
722 |
+
'label' => __('', 'responsive-menu'),
|
723 |
+
'type' => 'checkbox'
|
724 |
+
|
725 |
+
],
|
726 |
+
],
|
727 |
+
|
728 |
+
|
729 |
+
|
730 |
+
__('Sizing', 'responsive-menu') =>
|
731 |
+
[
|
732 |
+
[
|
733 |
+
'option' => 'submenu_arrow_height',
|
734 |
+
'title' => __('Toggle Button Height', 'responsive-menu'),
|
735 |
+
'label' => __('', 'responsive-menu'),
|
736 |
+
'unit' => 'px'
|
737 |
+
],
|
738 |
+
[
|
739 |
+
'option' => 'submenu_arrow_width',
|
740 |
+
'title' => __('Toggle Button Width', 'responsive-menu'),
|
741 |
+
'label' => __('', 'responsive-menu'),
|
742 |
+
'unit' => 'px'
|
743 |
+
],
|
744 |
+
|
745 |
+
],
|
746 |
+
__('Toggle Icons', 'responsive-menu') =>
|
747 |
+
[
|
748 |
+
[
|
749 |
+
'option' => 'active_arrow_font_icon',
|
750 |
+
'title' => __('Font Icon Active', 'responsive-menu'),
|
751 |
+
'label' => __('', 'responsive-menu'),
|
752 |
+
'pro' => true
|
753 |
+
],
|
754 |
+
[
|
755 |
+
'option' => 'inactive_arrow_font_icon',
|
756 |
+
'title' => __('Font Icon Inactive', 'responsive-menu'),
|
757 |
+
'label' => __('', 'responsive-menu'),
|
758 |
+
'pro' => true
|
759 |
+
],
|
760 |
+
[
|
761 |
+
'option' => 'active_arrow_shape',
|
762 |
+
'title' => __('HTML Shape Active', 'responsive-menu'),
|
763 |
+
'label' => __('', 'responsive-menu')
|
764 |
+
],
|
765 |
+
[
|
766 |
+
'option' => 'inactive_arrow_shape',
|
767 |
+
'title' => __('HTML Shape Inactive', 'responsive-menu'),
|
768 |
+
'label' => __('', 'responsive-menu')
|
769 |
+
],
|
770 |
+
[
|
771 |
+
'option' => 'active_arrow_image',
|
772 |
+
'title' => __('Image Active', 'responsive-menu'),
|
773 |
+
'label' => __('', 'responsive-menu'),
|
774 |
+
'type' => 'image'
|
775 |
+
],
|
776 |
+
[
|
777 |
+
'option' => 'inactive_arrow_image',
|
778 |
+
'title' => __('Image Inactive', 'responsive-menu'),
|
779 |
+
'label' => __('', 'responsive-menu'),
|
780 |
+
'type' => 'image'
|
781 |
+
]
|
782 |
+
],
|
783 |
+
],
|
784 |
+
|
785 |
+
/*
|
786 |
+
*
|
787 |
+
* TECHNICAL
|
788 |
+
*
|
789 |
+
*/
|
790 |
+
|
791 |
+
__('Technical', 'responsive-menu') => [
|
792 |
+
__('Scripts', 'responsive-menu') => [
|
793 |
+
[
|
794 |
+
'option' => 'external_files',
|
795 |
+
'title' => __('Use External Files?', 'responsive-menu'),
|
796 |
+
'label' => __('This will create external files for CSS and JavaScript', 'responsive-menu'),
|
797 |
+
'type' => 'checkbox'
|
798 |
+
],
|
799 |
+
[
|
800 |
+
'option' => 'minify_scripts',
|
801 |
+
'title' => __('Minify Scripts?', 'responsive-menu'),
|
802 |
+
'label' => __('This will minify CSS and JavaScript output', 'responsive-menu'),
|
803 |
+
'type' => 'checkbox'
|
804 |
+
],
|
805 |
+
[
|
806 |
+
'option' => 'scripts_in_footer',
|
807 |
+
'title' => __('Place Scripts In Footer?', 'responsive-menu'),
|
808 |
+
'label' => __('This will place the JavaScript file in the footer', 'responsive-menu'),
|
809 |
+
'type' => 'checkbox'
|
810 |
+
]
|
811 |
+
],
|
812 |
+
__('Menu', 'responsive-menu') => [
|
813 |
+
[
|
814 |
+
'option' => 'custom_walker',
|
815 |
+
'title' => __('Custom Walker', 'responsive-menu'),
|
816 |
+
'label' => __('Warning: For extremely advanced use only', 'responsive-menu'),
|
817 |
+
],
|
818 |
+
[
|
819 |
+
'option' => 'mobile_only',
|
820 |
+
'title' => __('Show on mobile devices only?', 'responsive-menu'),
|
821 |
+
'label' => __('This will make it not a responsive menu but a "mobile menu"', 'responsive-menu'),
|
822 |
+
'type' => 'checkbox',
|
823 |
+
'pro' => true
|
824 |
+
],
|
825 |
+
[
|
826 |
+
'option' => 'shortcode',
|
827 |
+
'title' => __('Use Shortcode?', 'responsive-menu'),
|
828 |
+
'label' => __('Please place [responsive_menu] in your files to use. Full documentation can be found <a target="_blank" href="https://responsive.menu/docs/advanced-setup/shortcode/">here</a>', 'responsive-menu'),
|
829 |
+
'type' => 'checkbox'
|
830 |
+
]
|
831 |
+
],
|
832 |
+
__('Animation Speeds', 'responsive-menu') =>
|
833 |
+
[
|
834 |
+
[
|
835 |
+
'option' => 'animation_speed',
|
836 |
+
'title' => __('Animation Speed', 'responsive-menu'),
|
837 |
+
'label' => __('', 'responsive-menu'),
|
838 |
+
'unit' => 's'
|
839 |
+
],
|
840 |
+
[
|
841 |
+
'option' => 'transition_speed',
|
842 |
+
'title' => __('Transition Speed', 'responsive-menu'),
|
843 |
+
'label' => __('', 'responsive-menu'),
|
844 |
+
'unit' => 's'
|
845 |
+
]
|
846 |
+
],
|
847 |
+
],
|
848 |
+
/*
|
849 |
+
*
|
850 |
+
* CUSTOM CSS
|
851 |
+
*
|
852 |
+
*/
|
853 |
+
|
854 |
+
__('Custom CSS', 'responsive-menu') => [
|
855 |
+
__('CSS', 'responsive-menu') => [
|
856 |
+
[
|
857 |
+
'option' => 'custom_css',
|
858 |
+
'title' => __('Custom CSS', 'responsive-menu'),
|
859 |
+
'label' => __('', 'responsive-menu'),
|
860 |
+
'type' => 'textarea',
|
861 |
+
'pro' => true
|
862 |
+
]
|
863 |
+
]
|
864 |
+
],
|
865 |
+
/*
|
866 |
+
*
|
867 |
+
* HEADER BAR
|
868 |
+
*
|
869 |
+
*/
|
870 |
+
__('Header Bar', 'responsive-menu') => [
|
871 |
+
__('Setup', 'responsive-menu') => [
|
872 |
+
[
|
873 |
+
'option' => 'use_header_bar',
|
874 |
+
'title' => __('Use Header Bar', 'responsive-menu'),
|
875 |
+
'label' => __('', 'responsive-menu'),
|
876 |
+
'type' => 'checkbox',
|
877 |
+
'pro' => true
|
878 |
+
],
|
879 |
+
[
|
880 |
+
'option' => 'header_bar_position_type',
|
881 |
+
'title' => __('Position Type', 'responsive-menu'),
|
882 |
+
'label' => __('', 'responsive-menu'),
|
883 |
+
'type' => 'select',
|
884 |
+
'select' => [
|
885 |
+
['value' => 'fixed', 'display' => 'Fixed'],
|
886 |
+
['value' => 'relative', 'display' => 'Relative'],
|
887 |
+
['value' => 'absolute', 'display' => 'Absolute']
|
888 |
+
],
|
889 |
+
'pro' => true
|
890 |
+
],
|
891 |
+
[
|
892 |
+
'option' => 'header_bar_breakpoint',
|
893 |
+
'title' => __('Breakpoint', 'responsive-menu'),
|
894 |
+
'label' => __('', 'responsive-menu'),
|
895 |
+
'pro' => true
|
896 |
+
],
|
897 |
+
],
|
898 |
+
__('Ordering', 'responsive-menu') => [
|
899 |
+
[
|
900 |
+
'option' => 'header_bar_items_order',
|
901 |
+
'title' => __('Ordering', 'responsive-menu'),
|
902 |
+
'label' => __('', 'responsive-menu'),
|
903 |
+
'type' => 'header_ordering',
|
904 |
+
'pro' => true
|
905 |
+
]
|
906 |
+
],
|
907 |
+
__('Logo', 'responsive-menu') => [
|
908 |
+
[
|
909 |
+
'option' => 'header_bar_logo',
|
910 |
+
'title' => __('Image', 'responsive-menu'),
|
911 |
+
'label' => __('', 'responsive-menu'),
|
912 |
+
'type' => 'image',
|
913 |
+
'pro' => true
|
914 |
+
],
|
915 |
+
[
|
916 |
+
'option' => 'header_bar_logo_link',
|
917 |
+
'title' => __('Link', 'responsive-menu'),
|
918 |
+
'label' => __('', 'responsive-menu'),
|
919 |
+
'pro' => true
|
920 |
+
],
|
921 |
+
],
|
922 |
+
__('Title', 'responsive-menu') => [
|
923 |
+
[
|
924 |
+
'option' => 'header_bar_title',
|
925 |
+
'title' => __('Title', 'responsive-menu'),
|
926 |
+
'label' => __('', 'responsive-menu'),
|
927 |
+
'pro' => true
|
928 |
+
]
|
929 |
+
],
|
930 |
+
__('Content', 'responsive-menu') => [
|
931 |
+
[
|
932 |
+
'option' => 'header_bar_html_content',
|
933 |
+
'title' => __('HTML Content', 'responsive-menu'),
|
934 |
+
'label' => __('Accepts shortcodes', 'responsive-menu'),
|
935 |
+
'type' => 'textarea',
|
936 |
+
'pro' => true
|
937 |
+
]
|
938 |
+
],
|
939 |
+
__('Text', 'responsive-menu') => [
|
940 |
+
[
|
941 |
+
'option' => 'header_bar_font',
|
942 |
+
'title' => __('Font', 'responsive-menu'),
|
943 |
+
'label' => __('', 'responsive-menu'),
|
944 |
+
'pro' => true
|
945 |
+
],
|
946 |
+
[
|
947 |
+
'option' => 'header_bar_font_size',
|
948 |
+
'title' => __('Font Size', 'responsive-menu'),
|
949 |
+
'label' => __('', 'responsive-menu'),
|
950 |
+
'unit' => 'px',
|
951 |
+
'pro' => true
|
952 |
+
],
|
953 |
+
],
|
954 |
+
__('Sizing', 'responsive-menu') => [
|
955 |
+
[
|
956 |
+
'option' => 'header_bar_height',
|
957 |
+
'title' => __('Height', 'responsive-menu'),
|
958 |
+
'label' => __('', 'responsive-menu'),
|
959 |
+
'unit' => 'px',
|
960 |
+
'pro' => true
|
961 |
+
],
|
962 |
+
],
|
963 |
+
__('Colours', 'responsive-menu') => [
|
964 |
+
[
|
965 |
+
'option' => 'header_bar_background_color',
|
966 |
+
'title' => __('Background Colour', 'responsive-menu'),
|
967 |
+
'label' => __('', 'responsive-menu'),
|
968 |
+
'type' => 'colour',
|
969 |
+
'pro' => true
|
970 |
+
],
|
971 |
+
[
|
972 |
+
'option' => 'header_bar_text_color',
|
973 |
+
'title' => __('Text Colour', 'responsive-menu'),
|
974 |
+
'label' => __('', 'responsive-menu'),
|
975 |
+
'type' => 'colour',
|
976 |
+
'pro' => true
|
977 |
+
],
|
978 |
+
],
|
979 |
+
],
|
980 |
+
|
981 |
+
/*
|
982 |
+
*
|
983 |
+
* SINGLE MENU
|
984 |
+
*
|
985 |
+
*/
|
986 |
+
__('Single Menu', 'responsive-menu') => [
|
987 |
+
__('Setup', 'responsive-menu') => [
|
988 |
+
[
|
989 |
+
'option' => 'use_single_menu',
|
990 |
+
'title' => __('Use Single Menu', 'responsive-menu'),
|
991 |
+
'label' => __('To use this option you must turn the Shortcode option on and use the shortcode in your theme where you want the menu to appear', 'responsive-menu'),
|
992 |
+
'type' => 'checkbox',
|
993 |
+
'pro' => true
|
994 |
+
]
|
995 |
+
],
|
996 |
+
__('Menu Colours', 'responsive-menu') => [
|
997 |
+
[
|
998 |
+
'option' => 'single_menu_item_background_colour',
|
999 |
+
'title' => __('Background Colour', 'responsive-menu'),
|
1000 |
+
'label' => __('', 'responsive-menu'),
|
1001 |
+
'type' => 'colour',
|
1002 |
+
'pro' => true
|
1003 |
+
],
|
1004 |
+
[
|
1005 |
+
'option' => 'single_menu_item_background_colour_hover',
|
1006 |
+
'title' => __('Background Hover Colour', 'responsive-menu'),
|
1007 |
+
'label' => __('', 'responsive-menu'),
|
1008 |
+
'type' => 'colour',
|
1009 |
+
'pro' => true
|
1010 |
+
],
|
1011 |
+
[
|
1012 |
+
'option' => 'single_menu_item_link_colour',
|
1013 |
+
'title' => __('Text Colour', 'responsive-menu'),
|
1014 |
+
'label' => __('', 'responsive-menu'),
|
1015 |
+
'type' => 'colour',
|
1016 |
+
'pro' => true
|
1017 |
+
],
|
1018 |
+
[
|
1019 |
+
'option' => 'single_menu_item_link_colour_hover',
|
1020 |
+
'title' => __('Text Hover Colour', 'responsive-menu'),
|
1021 |
+
'label' => __('', 'responsive-menu'),
|
1022 |
+
'type' => 'colour',
|
1023 |
+
'pro' => true
|
1024 |
+
],
|
1025 |
+
],
|
1026 |
+
__('Sub-Menu Colours', 'responsive-menu') => [
|
1027 |
+
[
|
1028 |
+
'option' => 'single_menu_item_submenu_background_colour',
|
1029 |
+
'title' => __('Background Colour', 'responsive-menu'),
|
1030 |
+
'label' => __('', 'responsive-menu'),
|
1031 |
+
'type' => 'colour',
|
1032 |
+
'pro' => true
|
1033 |
+
],
|
1034 |
+
[
|
1035 |
+
'option' => 'single_menu_item_submenu_background_colour_hover',
|
1036 |
+
'title' => __('Background Hover Colour', 'responsive-menu'),
|
1037 |
+
'label' => __('', 'responsive-menu'),
|
1038 |
+
'type' => 'colour',
|
1039 |
+
'pro' => true
|
1040 |
+
],
|
1041 |
+
[
|
1042 |
+
'option' => 'single_menu_item_submenu_link_colour',
|
1043 |
+
'title' => __('Text Colour', 'responsive-menu'),
|
1044 |
+
'label' => __('', 'responsive-menu'),
|
1045 |
+
'type' => 'colour',
|
1046 |
+
'pro' => true
|
1047 |
+
],
|
1048 |
+
[
|
1049 |
+
'option' => 'single_menu_item_submenu_link_colour_hover',
|
1050 |
+
'title' => __('Text Hover Colour', 'responsive-menu'),
|
1051 |
+
'label' => __('', 'responsive-menu'),
|
1052 |
+
'type' => 'colour',
|
1053 |
+
'pro' => true
|
1054 |
+
]
|
1055 |
+
],
|
1056 |
+
__('Menu Styling', 'responsive-menu') => [
|
1057 |
+
[
|
1058 |
+
'option' => 'single_menu_font',
|
1059 |
+
'title' => __('Font', 'responsive-menu'),
|
1060 |
+
'label' => __('', 'responsive-menu'),
|
1061 |
+
'pro' => true
|
1062 |
+
],
|
1063 |
+
[
|
1064 |
+
'option' => 'single_menu_font_size',
|
1065 |
+
'title' => __('Font Size', 'responsive-menu'),
|
1066 |
+
'label' => __('', 'responsive-menu'),
|
1067 |
+
'unit' => 'px',
|
1068 |
+
'pro' => true
|
1069 |
+
]
|
1070 |
+
],
|
1071 |
+
__('Sub-Menu Styling', 'responsive-menu') => [
|
1072 |
+
[
|
1073 |
+
'option' => 'single_menu_submenu_font',
|
1074 |
+
'title' => __('Font', 'responsive-menu'),
|
1075 |
+
'label' => __('', 'responsive-menu'),
|
1076 |
+
'pro' => true
|
1077 |
+
],
|
1078 |
+
[
|
1079 |
+
'option' => 'single_menu_submenu_font_size',
|
1080 |
+
'title' => __('Font Size', 'responsive-menu'),
|
1081 |
+
'label' => __('', 'responsive-menu'),
|
1082 |
+
'unit' => 'px',
|
1083 |
+
'pro' => true
|
1084 |
+
]
|
1085 |
+
],
|
1086 |
+
__('Menu Sizing', 'responsive-menu') => [
|
1087 |
+
[
|
1088 |
+
'option' => 'single_menu_height',
|
1089 |
+
'title' => __('Height', 'responsive-menu'),
|
1090 |
+
'label' => __('', 'responsive-menu'),
|
1091 |
+
'unit' => 'px',
|
1092 |
+
'pro' => true
|
1093 |
+
]
|
1094 |
+
],
|
1095 |
+
__('Sub-Menu Sizing', 'responsive-menu') => [
|
1096 |
+
[
|
1097 |
+
'option' => 'single_menu_submenu_height',
|
1098 |
+
'title' => __('Height', 'responsive-menu'),
|
1099 |
+
'label' => __('', 'responsive-menu'),
|
1100 |
+
'unit' => 'px',
|
1101 |
+
'pro' => true
|
1102 |
+
]
|
1103 |
+
]
|
1104 |
+
],
|
1105 |
+
'Import/Export' => [
|
1106 |
+
__('Import/Export', 'responsive-menu') => [
|
1107 |
+
[
|
1108 |
+
'option' => 'import',
|
1109 |
+
'title' => __('Import', 'responsive-menu'),
|
1110 |
+
'label' => __('', 'responsive-menu'),
|
1111 |
+
'type' => 'import'
|
1112 |
+
],
|
1113 |
+
[
|
1114 |
+
'option' => 'export',
|
1115 |
+
'title' => __('Export', 'responsive-menu'),
|
1116 |
+
'label' => __('', 'responsive-menu'),
|
1117 |
+
'type' => 'export'
|
1118 |
+
],
|
1119 |
+
[
|
1120 |
+
'option' => 'reset',
|
1121 |
+
'title' => __('Reset', 'responsive-menu'),
|
1122 |
+
'label' => __('', 'responsive-menu'),
|
1123 |
+
'type' => 'reset'
|
1124 |
+
]
|
1125 |
+
]
|
1126 |
+
]
|
1127 |
+
];
|
src/config/default_options.php
ADDED
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$default_options = array(
|
4 |
+
|
5 |
+
'breakpoint' => 800,
|
6 |
+
'menu_to_hide' => '',
|
7 |
+
'menu_depth' => 5,
|
8 |
+
'menu_to_use' => '',
|
9 |
+
'theme_location_menu' => '',
|
10 |
+
|
11 |
+
// Button Settings
|
12 |
+
'button_title' => null,
|
13 |
+
'button_image' => null,
|
14 |
+
'button_image_when_clicked' => null,
|
15 |
+
'button_font' => null,
|
16 |
+
'button_font_icon' => null,
|
17 |
+
'button_font_icon_when_clicked' => null,
|
18 |
+
'button_click_trigger' => '#responsive-menu-button',
|
19 |
+
'button_title_position' => 'left',
|
20 |
+
'button_title_line_height' => '13',
|
21 |
+
'button_background_colour' => '#000',
|
22 |
+
'button_background_colour_hover' => '#000',
|
23 |
+
'button_click_animation' => 'boring',
|
24 |
+
'button_line_colour' => '#fff',
|
25 |
+
'button_text_colour' => '#fff',
|
26 |
+
'button_transparent_background' => 'off',
|
27 |
+
'button_width' => 50,
|
28 |
+
'button_height' => 50,
|
29 |
+
'button_line_margin' => 5,
|
30 |
+
'button_line_height' => 3,
|
31 |
+
'button_line_width' => 25,
|
32 |
+
'button_top' => 15,
|
33 |
+
'button_distance_from_side' => 5,
|
34 |
+
'button_left_or_right' => 'right',
|
35 |
+
'button_position_type' => 'fixed',
|
36 |
+
'button_push_with_animation' => 'off',
|
37 |
+
'button_font_size' => 14,
|
38 |
+
|
39 |
+
// Animation Settings
|
40 |
+
'animation_type' => 'slide',
|
41 |
+
'page_wrapper' => null,
|
42 |
+
'animation_speed' => 0.5,
|
43 |
+
'transition_speed' => 0.5,
|
44 |
+
|
45 |
+
// Menu Settings
|
46 |
+
'active_arrow_shape' => '▲',
|
47 |
+
'inactive_arrow_shape' => '▼',
|
48 |
+
'active_arrow_image' => '',
|
49 |
+
'inactive_arrow_image' => '',
|
50 |
+
'active_arrow_font_icon' => '',
|
51 |
+
'inactive_arrow_font_icon' => '',
|
52 |
+
'submenu_arrow_width' => '40',
|
53 |
+
'submenu_arrow_height' => '40',
|
54 |
+
'accordion_animation' => 'off',
|
55 |
+
'auto_expand_all_submenus' => 'off',
|
56 |
+
'auto_expand_current_submenus' => 'off',
|
57 |
+
|
58 |
+
'menu_background_colour' => '#212121',
|
59 |
+
'menu_item_background_colour' => '#212121',
|
60 |
+
'menu_item_background_hover_colour' => '#3f3f3f',
|
61 |
+
'menu_item_border_colour' => '#212121',
|
62 |
+
'menu_item_border_colour_hover' => '#212121',
|
63 |
+
'menu_title_background_colour' => '#212121',
|
64 |
+
'menu_title_background_hover_colour' => '#212121',
|
65 |
+
'menu_current_item_background_colour' => '#212121',
|
66 |
+
'menu_current_item_background_hover_colour' => '#3f3f3f',
|
67 |
+
'menu_title_colour' => '#fff',
|
68 |
+
'menu_title_hover_colour' => '#fff',
|
69 |
+
'menu_link_colour' => '#fff',
|
70 |
+
'menu_link_hover_colour' => '#fff',
|
71 |
+
'menu_current_link_colour' => '#fff',
|
72 |
+
'menu_current_link_hover_colour' => '#fff',
|
73 |
+
'menu_sub_arrow_border_colour' => '#212121',
|
74 |
+
'menu_sub_arrow_border_hover_colour' => '#fff',
|
75 |
+
'menu_sub_arrow_background_colour' => '#212121',
|
76 |
+
'menu_sub_arrow_background_hover_colour' => '#3f3f3f',
|
77 |
+
'menu_sub_arrow_shape_colour' => '#fff',
|
78 |
+
'menu_sub_arrow_shape_hover_colour' => '#fff',
|
79 |
+
'menu_font' => null,
|
80 |
+
'menu_font_size' => 13,
|
81 |
+
'menu_title_font_size' => 13,
|
82 |
+
'menu_text_alignment' => 'left',
|
83 |
+
'menu_links_height' => 40,
|
84 |
+
'menu_minimum_width' => null,
|
85 |
+
'menu_maximum_width' => null,
|
86 |
+
'menu_auto_height' => 'off',
|
87 |
+
'menu_additional_content' => null,
|
88 |
+
'menu_additional_content_colour' => '#fff',
|
89 |
+
'menu_title' => null,
|
90 |
+
'menu_title_image' => null,
|
91 |
+
'menu_title_font_icon' => null,
|
92 |
+
'menu_appear_from' => 'left',
|
93 |
+
'menu_title_link' => null,
|
94 |
+
'menu_title_link_location' => '_self',
|
95 |
+
'menu_width' => 75,
|
96 |
+
'menu_close_on_link_click' => 'off',
|
97 |
+
'menu_close_on_body_click' => 'off',
|
98 |
+
'menu_item_click_to_trigger_submenu' => 'off',
|
99 |
+
'menu_disable_scrolling' => 'off',
|
100 |
+
'menu_overlay' => 'off',
|
101 |
+
'menu_overlay_colour' => 'rgba(0,0,0,0.7)',
|
102 |
+
'menu_font_icons' => '',
|
103 |
+
'menu_search_box_text' => 'Search',
|
104 |
+
'menu_word_wrap' => 'off',
|
105 |
+
|
106 |
+
'minify_scripts' => 'off',
|
107 |
+
'scripts_in_footer' => 'off',
|
108 |
+
'external_files' => 'off',
|
109 |
+
|
110 |
+
'shortcode' => 'off',
|
111 |
+
'mobile_only' => 'off',
|
112 |
+
'custom_walker' => null,
|
113 |
+
'custom_css' => null,
|
114 |
+
|
115 |
+
'use_single_menu' => 'off',
|
116 |
+
|
117 |
+
'single_menu_height' => '80',
|
118 |
+
'single_menu_font' => null,
|
119 |
+
'single_menu_font_size' => '14',
|
120 |
+
|
121 |
+
'single_menu_submenu_height' => '40',
|
122 |
+
'single_menu_submenu_font' => null,
|
123 |
+
'single_menu_submenu_font_size' => '12',
|
124 |
+
|
125 |
+
'single_menu_item_link_colour' => '#ffffff',
|
126 |
+
'single_menu_item_link_colour_hover' => '#ffffff',
|
127 |
+
'single_menu_item_background_colour' => '#ffffff',
|
128 |
+
'single_menu_item_background_colour_hover' => '#ffffff',
|
129 |
+
|
130 |
+
'single_menu_item_submenu_link_colour' => '#ffffff',
|
131 |
+
'single_menu_item_submenu_link_colour_hover' => '#ffffff',
|
132 |
+
'single_menu_item_submenu_background_colour' => '#ffffff',
|
133 |
+
'single_menu_item_submenu_background_colour_hover' => '#ffffff',
|
134 |
+
|
135 |
+
'use_header_bar' => 'off',
|
136 |
+
'header_bar_breakpoint' => '800',
|
137 |
+
'header_bar_logo' => null,
|
138 |
+
'header_bar_logo_link' => null,
|
139 |
+
'header_bar_title' => null,
|
140 |
+
'header_bar_html_content' => null,
|
141 |
+
'header_bar_height' => '80',
|
142 |
+
'header_bar_font_size' => '14',
|
143 |
+
'header_bar_font' => null,
|
144 |
+
'header_bar_background_color' => '#ffffff',
|
145 |
+
'header_bar_text_color' => '#ffffff',
|
146 |
+
'header_bar_position_type' => 'fixed',
|
147 |
+
|
148 |
+
'items_order' => '{"title": "on","menu":"on","search":"on","additional content":"on"}',
|
149 |
+
'header_bar_items_order' => '{"logo": "on","title":"on","search":"on","html content":"on","button":"on"}',
|
150 |
+
|
151 |
+
);
|
src/config/option_helpers.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$option_helpers = array(
|
4 |
+
'menu_font_icons' => array(
|
5 |
+
'filter' => 'ResponsiveMenu\Filters\JsonFilter'
|
6 |
+
),
|
7 |
+
'menu_additional_content' => array(
|
8 |
+
'filter' => 'ResponsiveMenu\Filters\HtmlFilter'
|
9 |
+
),
|
10 |
+
'items_order' => array(
|
11 |
+
'filter' => 'ResponsiveMenu\Filters\JsonFilter'
|
12 |
+
),
|
13 |
+
'header_bar_items_order' => array(
|
14 |
+
'filter' => 'ResponsiveMenu\Filters\JsonFilter'
|
15 |
+
),
|
16 |
+
'header_bar_html_content' => array(
|
17 |
+
'filter' => 'ResponsiveMenu\Filters\HtmlFilter'
|
18 |
+
)
|
19 |
+
);
|
src/config/route_dependencies.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$container = new ResponsiveMenu\Routing\Container();
|
4 |
+
|
5 |
+
$container['database'] = function($c) {
|
6 |
+
return new ResponsiveMenu\Database\WpDatabase;
|
7 |
+
};
|
8 |
+
|
9 |
+
$container['option_factory'] = function($c) {
|
10 |
+
return new ResponsiveMenu\Factories\OptionFactory;
|
11 |
+
};
|
12 |
+
|
13 |
+
$container['option_repository'] = function($c) {
|
14 |
+
return new ResponsiveMenu\Repositories\Options\ComplexOptionRepository($c['database'], $c['option_factory']);
|
15 |
+
};
|
16 |
+
|
17 |
+
$container['simple_option_repository'] = function($c) {
|
18 |
+
return new ResponsiveMenu\Repositories\Options\SimpleOptionReadRepository($c['database']);
|
19 |
+
};
|
20 |
+
|
21 |
+
$container['admin_view'] = function($c) {
|
22 |
+
return new ResponsiveMenu\View\AdminView;
|
23 |
+
};
|
24 |
+
|
25 |
+
$container['front_view'] = function($c) {
|
26 |
+
return new ResponsiveMenu\View\FrontView;
|
27 |
+
};
|
28 |
+
|
29 |
+
$container['admin_controller'] = function($c) {
|
30 |
+
return new ResponsiveMenu\Controllers\Admin\Main($c['option_repository'], $c['admin_view']);
|
31 |
+
};
|
32 |
+
|
33 |
+
$container['front_controller'] = function($c) {
|
34 |
+
return new ResponsiveMenu\Controllers\Front($c['simple_option_repository'], $c['front_view']);
|
35 |
+
};
|
src/public/css/admin/main.css
ADDED
@@ -0,0 +1,695 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.tab_container
|
2 |
+
{
|
3 |
+
display: none;
|
4 |
+
}
|
5 |
+
|
6 |
+
.tabs_container {
|
7 |
+
margin: 25px 0 15px 0;
|
8 |
+
}
|
9 |
+
|
10 |
+
.wrap .notice,
|
11 |
+
.wrap div.error,
|
12 |
+
.wrap div.updated {
|
13 |
+
margin: 0;
|
14 |
+
}
|
15 |
+
|
16 |
+
#menu-sortable {
|
17 |
+
position: relative;
|
18 |
+
}
|
19 |
+
|
20 |
+
#menu-sortable,
|
21 |
+
#items_order_container td:last-child {
|
22 |
+
width:400px;
|
23 |
+
}
|
24 |
+
|
25 |
+
#postbox_order .fa {
|
26 |
+
position: absolute;
|
27 |
+
right: 3%;
|
28 |
+
top: 13px;
|
29 |
+
}
|
30 |
+
|
31 |
+
#postbox_ordering .fa {
|
32 |
+
position: absolute;
|
33 |
+
left: 47%;
|
34 |
+
bottom: 11px;
|
35 |
+
}
|
36 |
+
|
37 |
+
#postbox_ordering li.draggable {
|
38 |
+
height: 41px;
|
39 |
+
vertical-align: top;
|
40 |
+
}
|
41 |
+
|
42 |
+
.menu-order-option-switch,
|
43 |
+
.order-option-switch {
|
44 |
+
background: #DE4B42;
|
45 |
+
color: white;
|
46 |
+
position: absolute;
|
47 |
+
left: 0;
|
48 |
+
top: 0;
|
49 |
+
bottom: 0;
|
50 |
+
line-height: 40px;
|
51 |
+
padding: 0 5px;
|
52 |
+
width: 30px;
|
53 |
+
text-align: center;
|
54 |
+
cursor: pointer;
|
55 |
+
}
|
56 |
+
|
57 |
+
.menu-order-option-switch.menu-order-option-switch-on,
|
58 |
+
.order-option-switch.order-option-switch-on {
|
59 |
+
background: green;
|
60 |
+
}
|
61 |
+
|
62 |
+
.menu-order-option-switch:after,
|
63 |
+
.order-option-switch:after {
|
64 |
+
content: "OFF";
|
65 |
+
}
|
66 |
+
|
67 |
+
.menu-order-option-switch.menu-order-option-switch-on:after,
|
68 |
+
.order-option-switch.order-option-switch-on:after {
|
69 |
+
content: "ON";
|
70 |
+
}
|
71 |
+
|
72 |
+
li.draggable {
|
73 |
+
position: relative;
|
74 |
+
}
|
75 |
+
|
76 |
+
.postbox > h4 {
|
77 |
+
background: #ffffff none repeat scroll 0 0;
|
78 |
+
border-bottom: 1px solid #eee;
|
79 |
+
box-sizing: border-box;
|
80 |
+
display: block;
|
81 |
+
font-size: 14px;
|
82 |
+
line-height: 1.4;
|
83 |
+
padding: 8px 12px;
|
84 |
+
width: 100%;
|
85 |
+
margin: 0;
|
86 |
+
}
|
87 |
+
|
88 |
+
.add-font-icon {
|
89 |
+
display: inline-block;
|
90 |
+
background: #298CBA;
|
91 |
+
color: white;
|
92 |
+
padding: 10px 25px;
|
93 |
+
border-radius: 2px;
|
94 |
+
cursor: pointer;
|
95 |
+
margin-top: 15px;
|
96 |
+
font-weight: bold;
|
97 |
+
}
|
98 |
+
|
99 |
+
.postbox .inside .select,
|
100 |
+
.postbox .inside .image_button,
|
101 |
+
.postbox .inside .image,
|
102 |
+
.postbox .inside .text {
|
103 |
+
padding: 5px 15px;
|
104 |
+
height: 30px;
|
105 |
+
margin-right: 10px;
|
106 |
+
}
|
107 |
+
|
108 |
+
.postbox .inside .textarea {
|
109 |
+
height: 100px;
|
110 |
+
padding: 15px;
|
111 |
+
width: 100%;
|
112 |
+
}
|
113 |
+
|
114 |
+
.font-icon-container .font-icon-row:first-child {
|
115 |
+
font-weight: bold;
|
116 |
+
}
|
117 |
+
|
118 |
+
.postbox .inside {
|
119 |
+
padding: 0;
|
120 |
+
margin: 0 !important;
|
121 |
+
}
|
122 |
+
|
123 |
+
.postbox .inside table {
|
124 |
+
width: 100%;
|
125 |
+
border-spacing: 0;
|
126 |
+
}
|
127 |
+
|
128 |
+
.postbox .inside table .description {
|
129 |
+
color: #899194;
|
130 |
+
line-height: 16px;
|
131 |
+
font-size: 12px;
|
132 |
+
}
|
133 |
+
|
134 |
+
.postbox .inside table tr td {
|
135 |
+
border-bottom: 1px solid #f5f5f5;
|
136 |
+
vertical-align: middle;
|
137 |
+
}
|
138 |
+
|
139 |
+
.postbox .inside table tr td:first-child {
|
140 |
+
background: #F9F9F9;
|
141 |
+
font-weight: bold;
|
142 |
+
border-right: 1px solid #e1e1e1;
|
143 |
+
color: #333;
|
144 |
+
width: 250px;
|
145 |
+
}
|
146 |
+
|
147 |
+
.postbox .inside table tr td:last-child:hover {
|
148 |
+
background: #FCFCFC;
|
149 |
+
}
|
150 |
+
|
151 |
+
.postbox .inside table tr.pro_option td:last-child:hover {
|
152 |
+
background: #FFE9E8;
|
153 |
+
}
|
154 |
+
|
155 |
+
.postbox .inside table tr.semi_pro_option td:last-child:hover {
|
156 |
+
background: #EDEAEA;
|
157 |
+
}
|
158 |
+
|
159 |
+
.postbox .inside table tr td:last-child {
|
160 |
+
text-align: left;
|
161 |
+
position: relative;
|
162 |
+
}
|
163 |
+
|
164 |
+
input[type="text"].image,
|
165 |
+
.select-style,
|
166 |
+
.inside .minicolors-theme-default.minicolors,
|
167 |
+
.postbox .inside .textarea,
|
168 |
+
.postbox .inside input.text {
|
169 |
+
width: 74%;
|
170 |
+
}
|
171 |
+
|
172 |
+
#normal-sortables .button.submit,
|
173 |
+
.postbox .inside .image_button {
|
174 |
+
background: #298CBA;
|
175 |
+
color: white;
|
176 |
+
border-color: #298CBA;
|
177 |
+
}
|
178 |
+
|
179 |
+
#normal-sortables .button.submit {
|
180 |
+
padding: 0 35px;
|
181 |
+
height: 50px;
|
182 |
+
line-height: 50px;
|
183 |
+
font-weight: bold;
|
184 |
+
font-size: 11px;
|
185 |
+
}
|
186 |
+
|
187 |
+
#normal-sortables .button.submit:hover {
|
188 |
+
background: #40A1CE;
|
189 |
+
}
|
190 |
+
|
191 |
+
.postbox .inside .image_button .fa {
|
192 |
+
vertical-align: text-top;
|
193 |
+
}
|
194 |
+
|
195 |
+
#header_bar_items_order_container td {
|
196 |
+
width: 100%;
|
197 |
+
display: block;
|
198 |
+
padding: 20px;
|
199 |
+
border: 0;
|
200 |
+
box-sizing: border-box;
|
201 |
+
}
|
202 |
+
|
203 |
+
.postbox .inside tr.semi_pro_option td:last-child:before,
|
204 |
+
.postbox .inside tr.pro_option td:last-child:before {
|
205 |
+
content: "PRO";
|
206 |
+
float: right;
|
207 |
+
color: #DE4B42;
|
208 |
+
font-weight: bold;
|
209 |
+
font-size: 9px;
|
210 |
+
margin-top: 6px;
|
211 |
+
border-left: 1px solid #DE4B42;
|
212 |
+
padding-left: 8px;
|
213 |
+
}
|
214 |
+
|
215 |
+
.postbox .inside tr.semi_pro_option td:last-child:before {
|
216 |
+
content: "SEMI PRO";
|
217 |
+
color: #333;
|
218 |
+
border-color: #333;
|
219 |
+
}
|
220 |
+
|
221 |
+
.postbox .inside tr.pro_option td:last-child:hover:after {
|
222 |
+
width: 100%;
|
223 |
+
content: "Please upgrade to use";
|
224 |
+
top: 0;
|
225 |
+
left: 0;
|
226 |
+
right: 0;
|
227 |
+
bottom: 0;
|
228 |
+
position: absolute;
|
229 |
+
text-align: center;
|
230 |
+
color: #333;
|
231 |
+
transform: translateY(30%);
|
232 |
+
font-weight: bold;
|
233 |
+
font-size: 14px;
|
234 |
+
}
|
235 |
+
|
236 |
+
#items_order_container td:last-child,
|
237 |
+
#header_bar_items_order_container td:last-child {
|
238 |
+
text-align: center;
|
239 |
+
}
|
240 |
+
|
241 |
+
.postbox_font_icons .inside
|
242 |
+
{
|
243 |
+
padding: 0;
|
244 |
+
margin-bottom: 0;
|
245 |
+
}
|
246 |
+
|
247 |
+
.postbox .inside .wp-color-picker {
|
248 |
+
cursor: crosshair;
|
249 |
+
}
|
250 |
+
|
251 |
+
#all_options_container,
|
252 |
+
#banner_area
|
253 |
+
{
|
254 |
+
vertical-align: top;
|
255 |
+
display: inline-block;
|
256 |
+
box-sizing: border-box;
|
257 |
+
}
|
258 |
+
|
259 |
+
#all_options_container {
|
260 |
+
width: 74%;
|
261 |
+
}
|
262 |
+
|
263 |
+
#banner_area
|
264 |
+
{
|
265 |
+
width: 24%;
|
266 |
+
margin-top: 1px;
|
267 |
+
margin-left: 2%;
|
268 |
+
}
|
269 |
+
|
270 |
+
#upgrade_banner {
|
271 |
+
padding: 35px;
|
272 |
+
background: #DE4B42;
|
273 |
+
color: #fff;
|
274 |
+
border: 1px solid #D33C34;
|
275 |
+
border-radius: 2px;
|
276 |
+
}
|
277 |
+
|
278 |
+
#docs_banner {
|
279 |
+
background: #FAB719;
|
280 |
+
padding: 35px;
|
281 |
+
color: #333;
|
282 |
+
margin-top: 15px;
|
283 |
+
text-align: center;
|
284 |
+
}
|
285 |
+
|
286 |
+
#upgrade_banner,
|
287 |
+
#docs_banner {
|
288 |
+
font-size: 18px;
|
289 |
+
font-weight: bold;
|
290 |
+
line-height: 24px;
|
291 |
+
}
|
292 |
+
|
293 |
+
#upgrade_banner li {
|
294 |
+
list-style: inside;
|
295 |
+
font-weight: bold;
|
296 |
+
font-size: 11px;
|
297 |
+
}
|
298 |
+
|
299 |
+
#docs_banner .button,
|
300 |
+
#upgrade_banner .button {
|
301 |
+
background: white;
|
302 |
+
padding: 0 25px;
|
303 |
+
height: 50px;
|
304 |
+
line-height: 50px;
|
305 |
+
font-weight: bold;
|
306 |
+
font-size: 13px;
|
307 |
+
color: #333;
|
308 |
+
display: inline-block;
|
309 |
+
margin: auto;
|
310 |
+
width: auto;
|
311 |
+
}
|
312 |
+
|
313 |
+
#docs_banner .button {
|
314 |
+
margin-top: 15px;
|
315 |
+
}
|
316 |
+
|
317 |
+
#options_list_container .tab_container:first-child {
|
318 |
+
display: block;
|
319 |
+
}
|
320 |
+
|
321 |
+
.tab
|
322 |
+
{
|
323 |
+
display: inline-block;
|
324 |
+
padding: 5px;
|
325 |
+
text-align: center;
|
326 |
+
border: 1px solid #CCC;
|
327 |
+
border-radius: 2px;
|
328 |
+
cursor: pointer;
|
329 |
+
background: white;
|
330 |
+
margin: 0 5px 0 0 !important;
|
331 |
+
}
|
332 |
+
|
333 |
+
.tab.active_tab {
|
334 |
+
background: #00A0D2;
|
335 |
+
color: white;
|
336 |
+
border-color: #298CBA;
|
337 |
+
}
|
338 |
+
|
339 |
+
.option_holder
|
340 |
+
{
|
341 |
+
display: inline-block;
|
342 |
+
width: 30%;
|
343 |
+
vertical-align: middle;
|
344 |
+
position: relative;
|
345 |
+
text-align: center;
|
346 |
+
margin-right: 2%;
|
347 |
+
padding: 5px 2% 25px 2%;
|
348 |
+
margin-top: 15px;
|
349 |
+
border: 1px dashed #DADADA;
|
350 |
+
border-radius: 5px;
|
351 |
+
transition: 0.4s all;
|
352 |
+
box-sizing: border-box;
|
353 |
+
}
|
354 |
+
|
355 |
+
.option_holder:hover
|
356 |
+
{
|
357 |
+
background: #F7F2F2;
|
358 |
+
}
|
359 |
+
|
360 |
+
.option_holder h4
|
361 |
+
{
|
362 |
+
margin-bottom: 0;
|
363 |
+
}
|
364 |
+
|
365 |
+
.option_holder h5
|
366 |
+
{
|
367 |
+
margin: 5px 0;
|
368 |
+
font-weight: normal;
|
369 |
+
}
|
370 |
+
|
371 |
+
.option_holder.pro_option
|
372 |
+
{
|
373 |
+
border-color: #ED655E;
|
374 |
+
}
|
375 |
+
|
376 |
+
.option_holder.semi_pro_option {
|
377 |
+
border-color: #DADADA;
|
378 |
+
}
|
379 |
+
|
380 |
+
.options_container
|
381 |
+
{
|
382 |
+
background: white;
|
383 |
+
border: 1px solid #CCC;
|
384 |
+
border-radius: 0 2px 2px 2px;
|
385 |
+
padding: 0 15px 15px 15px;
|
386 |
+
text-align: center;
|
387 |
+
}
|
388 |
+
|
389 |
+
.options_container input,
|
390 |
+
.options_container textarea,
|
391 |
+
.options_container select
|
392 |
+
{
|
393 |
+
width: 90%;
|
394 |
+
border: 1px solid #CCC;
|
395 |
+
border-radius: 2px;
|
396 |
+
padding: 5px;
|
397 |
+
background: white;
|
398 |
+
}
|
399 |
+
|
400 |
+
ul#adminmenu a.wp-has-current-submenu::after,
|
401 |
+
ul#adminmenu > li.current > a.current::after
|
402 |
+
{
|
403 |
+
border-color: transparent #DE4B42 transparent transparent;
|
404 |
+
}
|
405 |
+
|
406 |
+
/* On-Off Buttons */
|
407 |
+
|
408 |
+
.onoffswitch {
|
409 |
+
position: relative; width: 74px;
|
410 |
+
-webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
|
411 |
+
}
|
412 |
+
.onoffswitch-checkbox {
|
413 |
+
display: none;
|
414 |
+
}
|
415 |
+
.onoffswitch-label {
|
416 |
+
display: block; overflow: hidden; cursor: pointer;
|
417 |
+
border: 2px solid transparent;
|
418 |
+
text-align: left;
|
419 |
+
}
|
420 |
+
.onoffswitch-inner {
|
421 |
+
display: block; width: 200%; margin-left: -100%;
|
422 |
+
transition: margin 0.3s ease-in 0s;
|
423 |
+
}
|
424 |
+
.onoffswitch-inner:before, .onoffswitch-inner:after {
|
425 |
+
display: block; float: left; width: 50%; height: 23px; padding: 0; line-height: 23px;
|
426 |
+
font-size: 14px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold;
|
427 |
+
box-sizing: border-box;
|
428 |
+
}
|
429 |
+
.onoffswitch-inner:before {
|
430 |
+
content: "ON";
|
431 |
+
padding-left: 10px;
|
432 |
+
background-color: transparent; color: #DE4B42;
|
433 |
+
}
|
434 |
+
.onoffswitch-inner:after {
|
435 |
+
content: "OFF";
|
436 |
+
padding-right: 10px;
|
437 |
+
background-color: transparent; color: #999999;
|
438 |
+
text-align: right;
|
439 |
+
}
|
440 |
+
.onoffswitch-switch {
|
441 |
+
display: block; width: 13px; margin: 5px;
|
442 |
+
background: #FFFFFF;
|
443 |
+
position: absolute; top: 0; bottom: 0;
|
444 |
+
right: 47px;
|
445 |
+
border: 2px solid #999999; border-radius: 12px;
|
446 |
+
transition: all 0.3s ease-in 0s;
|
447 |
+
}
|
448 |
+
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
|
449 |
+
margin-left: 0;
|
450 |
+
}
|
451 |
+
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
|
452 |
+
right: 0px;
|
453 |
+
}
|
454 |
+
|
455 |
+
input[type="checkbox"]
|
456 |
+
{
|
457 |
+
display: none;
|
458 |
+
}
|
459 |
+
|
460 |
+
.key-container {
|
461 |
+
margin-bottom: 15px;
|
462 |
+
}
|
463 |
+
|
464 |
+
.key-container .key-title {
|
465 |
+
font-weight: bold;
|
466 |
+
display: inline-block;
|
467 |
+
margin-right: 10px;
|
468 |
+
}
|
469 |
+
|
470 |
+
.key-container .key {
|
471 |
+
display: inline-block;
|
472 |
+
font-size: 9px;
|
473 |
+
border: 1px solid #DADADA;
|
474 |
+
border-radius: 2px;
|
475 |
+
padding: 5px 15px 5px 5px;
|
476 |
+
background: white;
|
477 |
+
}
|
478 |
+
|
479 |
+
.key-container .key span {
|
480 |
+
border-right: 1px solid #de4b42;
|
481 |
+
display: inline-block;
|
482 |
+
padding-right: 5px;
|
483 |
+
margin-right: 10px;
|
484 |
+
color: #de4b42;
|
485 |
+
font-size: 9px;
|
486 |
+
font-weight: bold;
|
487 |
+
}
|
488 |
+
|
489 |
+
.key-container .key.key-semi-pro span {
|
490 |
+
color: #333;
|
491 |
+
border-color: #333;
|
492 |
+
}
|
493 |
+
|
494 |
+
.key-container .key.key-pro {
|
495 |
+
margin-right: 15px;
|
496 |
+
}
|
497 |
+
|
498 |
+
.key-container a {
|
499 |
+
text-decoration: none;
|
500 |
+
color: #333;
|
501 |
+
}
|
502 |
+
|
503 |
+
/* End On-Off Buttons */
|
504 |
+
|
505 |
+
/* Nice Select Button Styling */
|
506 |
+
.select-style {
|
507 |
+
border: 1px solid #ccc;
|
508 |
+
border-radius: 3px;
|
509 |
+
cursor: pointer;
|
510 |
+
overflow: hidden;
|
511 |
+
background: #fafafa url("data:image/png;base64,R0lGODlhDwAUAIABAAAAAP///yH5BAEAAAEALAAAAAAPABQAAAIXjI+py+0Po5wH2HsXzmw//lHiSJZmUAAAOw==")no-repeat 95% 50%;
|
512 |
+
}
|
513 |
+
|
514 |
+
.select-style select {
|
515 |
+
width: 105%;
|
516 |
+
border: none;
|
517 |
+
cursor: pointer;
|
518 |
+
box-shadow: none;
|
519 |
+
background: transparent;
|
520 |
+
background-image: none;
|
521 |
+
-webkit-appearance: none;
|
522 |
+
max-width: 115%;
|
523 |
+
}
|
524 |
+
|
525 |
+
.select-style select:focus {
|
526 |
+
outline: none;
|
527 |
+
}
|
528 |
+
|
529 |
+
/* End Select Button Styling */
|
530 |
+
|
531 |
+
/* Text Box Styling */
|
532 |
+
|
533 |
+
input[type="text"].text,
|
534 |
+
input[type="text"].image
|
535 |
+
{
|
536 |
+
padding: 10px 5%;
|
537 |
+
border: 1px solid #c9c9c9;
|
538 |
+
border-bottom: solid 2px #c9c9c9;
|
539 |
+
transition: border 0.3s;
|
540 |
+
}
|
541 |
+
|
542 |
+
input[type="text"].text:focus,
|
543 |
+
input[type="text"].text.focus,
|
544 |
+
input[type="text"].image:focus,
|
545 |
+
input[type="text"].image.focus,
|
546 |
+
{
|
547 |
+
border-bottom: solid 2px #969696;
|
548 |
+
}
|
549 |
+
|
550 |
+
input[type="button"].image_button
|
551 |
+
{
|
552 |
+
width: 15%;
|
553 |
+
height: 42px;
|
554 |
+
}
|
555 |
+
|
556 |
+
input[type="text"].image,
|
557 |
+
input[type="button"].image_button
|
558 |
+
{
|
559 |
+
display: inline-block;
|
560 |
+
}
|
561 |
+
|
562 |
+
/* End Text Box Styling */
|
563 |
+
#custom_css,
|
564 |
+
#menu_font_icons_container,
|
565 |
+
#custom_css_container
|
566 |
+
{
|
567 |
+
width: 90%;
|
568 |
+
}
|
569 |
+
|
570 |
+
.font-icon-container
|
571 |
+
{
|
572 |
+
width: 100%;
|
573 |
+
display: table;
|
574 |
+
}
|
575 |
+
|
576 |
+
#custom_css {
|
577 |
+
height: 300px;
|
578 |
+
}
|
579 |
+
|
580 |
+
.font-icon-row
|
581 |
+
{
|
582 |
+
display: table-row;
|
583 |
+
}
|
584 |
+
|
585 |
+
.font-icon-cell-id,
|
586 |
+
.font-icon-cell-icon
|
587 |
+
{
|
588 |
+
display: inline-block;
|
589 |
+
text-align: left;
|
590 |
+
}
|
591 |
+
|
592 |
+
.font-icon-cell-id {
|
593 |
+
width: 10%;
|
594 |
+
}
|
595 |
+
|
596 |
+
.font-icon-cell-icon {
|
597 |
+
width: 64%;
|
598 |
+
}
|
599 |
+
|
600 |
+
.font-icon-cell-id input,
|
601 |
+
.font-icon-cell-icon input
|
602 |
+
{
|
603 |
+
width: 100%;
|
604 |
+
}
|
605 |
+
|
606 |
+
.draggable {
|
607 |
+
border: 1px solid #DADADA;
|
608 |
+
border-radius: 2px;
|
609 |
+
background: #EFEFEF;
|
610 |
+
padding: 10px 0;
|
611 |
+
margin: 0;
|
612 |
+
cursor: move;
|
613 |
+
font-weight: bold;
|
614 |
+
padding-left: 35px;
|
615 |
+
box-sizing: border-box;
|
616 |
+
}
|
617 |
+
|
618 |
+
.draggable input {
|
619 |
+
display: none;
|
620 |
+
}
|
621 |
+
|
622 |
+
#header_bar_items_order_container .draggable {
|
623 |
+
display: inline-block;
|
624 |
+
width: 19%;
|
625 |
+
}
|
626 |
+
|
627 |
+
.upgrade-notes {
|
628 |
+
background: #DE4B42;
|
629 |
+
padding: 15px 2%;
|
630 |
+
width: 96%;
|
631 |
+
position: relative;
|
632 |
+
margin: 15px 0;
|
633 |
+
color: white;
|
634 |
+
}
|
635 |
+
|
636 |
+
.upgrade-notes a {
|
637 |
+
color: white;
|
638 |
+
text-decoration: underline;
|
639 |
+
}
|
640 |
+
|
641 |
+
.upgrade-notes-title {
|
642 |
+
font-size: 16px;
|
643 |
+
margin-bottom: 10px;
|
644 |
+
font-weight: bold;
|
645 |
+
}
|
646 |
+
|
647 |
+
.upgrade-notes-close {
|
648 |
+
position: absolute;
|
649 |
+
top: 0;
|
650 |
+
right: 2%;
|
651 |
+
font-size: 18px;
|
652 |
+
padding: 15px;
|
653 |
+
font-weight: bold;
|
654 |
+
cursor: pointer;
|
655 |
+
}
|
656 |
+
|
657 |
+
@media (max-width: 800px) {
|
658 |
+
.tab {
|
659 |
+
margin-bottom: 10px !important;
|
660 |
+
width: 18%;
|
661 |
+
margin-right: 1% !important;
|
662 |
+
}
|
663 |
+
#banner_area,
|
664 |
+
#all_options_container {
|
665 |
+
width: 100%;
|
666 |
+
}
|
667 |
+
.tabs_container {
|
668 |
+
text-align: center;
|
669 |
+
}
|
670 |
+
.postbox .inside table tr td,
|
671 |
+
.postbox .inside table tr td:last-child,
|
672 |
+
.postbox .inside table tr td:first-child {
|
673 |
+
width: 100%;
|
674 |
+
display: block;
|
675 |
+
text-align: center;
|
676 |
+
padding: 10px 0;
|
677 |
+
}
|
678 |
+
#banner_area {
|
679 |
+
margin: 15px 0;
|
680 |
+
}
|
681 |
+
#menu-sortable,
|
682 |
+
.onoffswitch,
|
683 |
+
.select-style {
|
684 |
+
margin: auto;
|
685 |
+
}
|
686 |
+
#menu-sortable, #items_order_container td:last-child {
|
687 |
+
width: 90%;
|
688 |
+
margin: auto;
|
689 |
+
}
|
690 |
+
#normal-sortables .button.submit {
|
691 |
+
margin: auto;
|
692 |
+
display: block;
|
693 |
+
float: none;
|
694 |
+
}
|
695 |
+
}
|
src/public/js/admin/main.js
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(function($) {
|
2 |
+
|
3 |
+
$('.wp-color-picker').wpColorPicker();
|
4 |
+
|
5 |
+
$('#banner_area').stick_in_parent();
|
6 |
+
|
7 |
+
var custom_uploader;
|
8 |
+
|
9 |
+
$('.image_button').click(function (e) {
|
10 |
+
e.preventDefault();
|
11 |
+
window.imgFor = $(this).attr('for');
|
12 |
+
//If the uploader object has already been created, reopen the dialog
|
13 |
+
if (custom_uploader) {
|
14 |
+
custom_uploader.open();
|
15 |
+
return;
|
16 |
+
}
|
17 |
+
//Extend the wp.media object
|
18 |
+
custom_uploader = wp.media.frames.file_frame = wp.media({
|
19 |
+
title: 'Choose Image',
|
20 |
+
button: {
|
21 |
+
text: 'Choose Image',
|
22 |
+
id: 'test'
|
23 |
+
},
|
24 |
+
multiple: false
|
25 |
+
});
|
26 |
+
|
27 |
+
//When a file is selected, grab the URL and set it as the text field's value
|
28 |
+
custom_uploader.on('select', function () {
|
29 |
+
attachment = custom_uploader.state().get('selection').first().toJSON();
|
30 |
+
$('#' + window.imgFor).val(attachment.url);
|
31 |
+
});
|
32 |
+
|
33 |
+
//Open the uploader dialog
|
34 |
+
custom_uploader.open();
|
35 |
+
});
|
36 |
+
|
37 |
+
$(document).on('click', '.tab', function() {
|
38 |
+
container_name = '#tab_container_' + $(this).attr('id').replace('tab_', '');
|
39 |
+
$('.tab_container').css('display', 'none');
|
40 |
+
$(container_name).css('display', 'block');
|
41 |
+
$('.tab').removeClass('active_tab');
|
42 |
+
$(this).addClass('active_tab');
|
43 |
+
if(typeof(Storage) !== "undefined") {
|
44 |
+
localStorage.responsive_menu_tab = $(this).attr('id');
|
45 |
+
}
|
46 |
+
});
|
47 |
+
|
48 |
+
if(typeof(Storage) !== "undefined") {
|
49 |
+
if(localStorage.rmupgrade) {
|
50 |
+
$('.upgrade-notes').hide();
|
51 |
+
} else {
|
52 |
+
$(document).on('click', '.upgrade-notes-close', function(e) {
|
53 |
+
e.stopPropagation();
|
54 |
+
e.preventDefault();
|
55 |
+
$('.upgrade-notes').fadeOut();
|
56 |
+
localStorage.rmupgrade = "true";
|
57 |
+
});
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
if(typeof(Storage) !== "undefined" && localStorage.responsive_menu_tab) {
|
62 |
+
tab_id = localStorage.responsive_menu_tab;
|
63 |
+
container_name = '#tab_container_' + tab_id.replace('tab_', '');
|
64 |
+
$('.tab_container').css('display', 'none');
|
65 |
+
$(container_name).css('display', 'block');
|
66 |
+
$('.tab').removeClass('active_tab');
|
67 |
+
$('#' + tab_id).addClass('active_tab');
|
68 |
+
}
|
69 |
+
|
70 |
+
});
|
src/public/js/admin/postbox-edit.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function($){
|
2 |
+
$('.if-js-closed').removeClass('if-js-closed').addClass('closed');
|
3 |
+
postboxes.add_postbox_toggles('responsive-menu');
|
4 |
+
});
|
src/public/js/admin/sticky-sidebar.js
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
Sticky-kit v1.1.2 | WTFPL | Leaf Corcoran 2015 | http://leafo.net
|
3 |
+
*/
|
4 |
+
(function(){var b,f;b=this.jQuery||window.jQuery;f=b(window);b.fn.stick_in_parent=function(d){var A,w,J,n,B,K,p,q,k,E,t;null==d&&(d={});t=d.sticky_class;B=d.inner_scrolling;E=d.recalc_every;k=d.parent;q=d.offset_top;p=d.spacer;w=d.bottoming;null==q&&(q=0);null==k&&(k=void 0);null==B&&(B=!0);null==t&&(t="is_stuck");A=b(document);null==w&&(w=!0);J=function(a,d,n,C,F,u,r,G){var v,H,m,D,I,c,g,x,y,z,h,l;if(!a.data("sticky_kit")){a.data("sticky_kit",!0);I=A.height();g=a.parent();null!=k&&(g=g.closest(k));
|
5 |
+
if(!g.length)throw"failed to find stick parent";v=m=!1;(h=null!=p?p&&a.closest(p):b("<div />"))&&h.css("position",a.css("position"));x=function(){var c,f,e;if(!G&&(I=A.height(),c=parseInt(g.css("border-top-width"),10),f=parseInt(g.css("padding-top"),10),d=parseInt(g.css("padding-bottom"),10),n=g.offset().top+c+f,C=g.height(),m&&(v=m=!1,null==p&&(a.insertAfter(h),h.detach()),a.css({position:"",top:"",width:"",bottom:""}).removeClass(t),e=!0),F=a.offset().top-(parseInt(a.css("margin-top"),10)||0)-q,
|
6 |
+
u=a.outerHeight(!0),r=a.css("float"),h&&h.css({width:a.outerWidth(!0),height:u,display:a.css("display"),"vertical-align":a.css("vertical-align"),"float":r}),e))return l()};x();if(u!==C)return D=void 0,c=q,z=E,l=function(){var b,l,e,k;if(!G&&(e=!1,null!=z&&(--z,0>=z&&(z=E,x(),e=!0)),e||A.height()===I||x(),e=f.scrollTop(),null!=D&&(l=e-D),D=e,m?(w&&(k=e+u+c>C+n,v&&!k&&(v=!1,a.css({position:"fixed",bottom:"",top:c}).trigger("sticky_kit:unbottom"))),e<F&&(m=!1,c=q,null==p&&("left"!==r&&"right"!==r||a.insertAfter(h),
|
7 |
+
h.detach()),b={position:"",width:"",top:""},a.css(b).removeClass(t).trigger("sticky_kit:unstick")),B&&(b=f.height(),u+q>b&&!v&&(c-=l,c=Math.max(b-u,c),c=Math.min(q,c),m&&a.css({top:c+"px"})))):e>F&&(m=!0,b={position:"fixed",top:c},b.width="border-box"===a.css("box-sizing")?a.outerWidth()+"px":a.width()+"px",a.css(b).addClass(t),null==p&&(a.after(h),"left"!==r&&"right"!==r||h.append(a)),a.trigger("sticky_kit:stick")),m&&w&&(null==k&&(k=e+u+c>C+n),!v&&k)))return v=!0,"static"===g.css("position")&&g.css({position:"relative"}),
|
8 |
+
a.css({position:"absolute",bottom:d,top:"auto"}).trigger("sticky_kit:bottom")},y=function(){x();return l()},H=function(){G=!0;f.off("touchmove",l);f.off("scroll",l);f.off("resize",y);b(document.body).off("sticky_kit:recalc",y);a.off("sticky_kit:detach",H);a.removeData("sticky_kit");a.css({position:"",bottom:"",top:"",width:""});g.position("position","");if(m)return null==p&&("left"!==r&&"right"!==r||a.insertAfter(h),h.remove()),a.removeClass(t)},f.on("touchmove",l),f.on("scroll",l),f.on("resize",
|
9 |
+
y),b(document.body).on("sticky_kit:recalc",y),a.on("sticky_kit:detach",H),setTimeout(l,0)}};n=0;for(K=this.length;n<K;n++)d=this[n],J(b(d));return this}}).call(this);
|
src/public/scss/hamburgers/_base.scss
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Hamburger
|
2 |
+
// ==================================================
|
3 |
+
.responsive-menu-button {
|
4 |
+
padding: $hamburger-padding-y $hamburger-padding-x;
|
5 |
+
display: inline-block;
|
6 |
+
cursor: pointer;
|
7 |
+
|
8 |
+
transition-property: opacity, filter;
|
9 |
+
transition-duration: $hamburger-hover-transition-duration;
|
10 |
+
transition-timing-function: $hamburger-hover-transition-timing-function;
|
11 |
+
|
12 |
+
// Normalize (<button>)
|
13 |
+
font: inherit;
|
14 |
+
color: inherit;
|
15 |
+
text-transform: none;
|
16 |
+
background-color: transparent;
|
17 |
+
border: 0;
|
18 |
+
margin: 0;
|
19 |
+
overflow: visible;
|
20 |
+
|
21 |
+
&:hover {
|
22 |
+
@if $hamburger-hover-use-filter == true {
|
23 |
+
filter: $hamburger-hover-filter;
|
24 |
+
}
|
25 |
+
@else {
|
26 |
+
opacity: $hamburger-hover-opacity;
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
.responsive-menu-box {
|
32 |
+
width: $hamburger-layer-width;
|
33 |
+
height: $hamburger-layer-height * 3 + $hamburger-layer-spacing * 2;
|
34 |
+
display: inline-block;
|
35 |
+
position: relative;
|
36 |
+
}
|
37 |
+
|
38 |
+
.responsive-menu-inner {
|
39 |
+
display: block;
|
40 |
+
top: 50%;
|
41 |
+
margin-top: $hamburger-layer-height / -2;
|
42 |
+
|
43 |
+
&,
|
44 |
+
&::before,
|
45 |
+
&::after {
|
46 |
+
width: $hamburger-layer-width;
|
47 |
+
height: $hamburger-layer-height;
|
48 |
+
background-color: $hamburger-layer-color;
|
49 |
+
border-radius: $hamburger-layer-border-radius;
|
50 |
+
position: absolute;
|
51 |
+
transition-property: transform;
|
52 |
+
transition-duration: 0.15s;
|
53 |
+
transition-timing-function: ease;
|
54 |
+
}
|
55 |
+
|
56 |
+
&::before,
|
57 |
+
&::after {
|
58 |
+
content: "";
|
59 |
+
display: block;
|
60 |
+
}
|
61 |
+
|
62 |
+
&::before {
|
63 |
+
top: ($hamburger-layer-spacing + $hamburger-layer-height) * -1;
|
64 |
+
}
|
65 |
+
|
66 |
+
&::after {
|
67 |
+
bottom: ($hamburger-layer-spacing + $hamburger-layer-height) * -1;
|
68 |
+
}
|
69 |
+
}
|
src/public/scss/hamburgers/hamburgers.scss
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* Hamburgers
|
3 |
+
* @description Tasty CSS-animated hamburgers
|
4 |
+
* @author Jonathan Suh @jonsuh
|
5 |
+
* @site https://jonsuh.com/hamburgers
|
6 |
+
* @link https://github.com/jonsuh/hamburgers
|
7 |
+
*/
|
8 |
+
|
9 |
+
// Settings
|
10 |
+
// ==================================================
|
11 |
+
$hamburger-padding-x : 0 !default;
|
12 |
+
$hamburger-padding-y : 0 !default;
|
13 |
+
$hamburger-layer-width : 40px !default;
|
14 |
+
$hamburger-layer-height : 4px !default;
|
15 |
+
$hamburger-layer-spacing : 6px !default;
|
16 |
+
$hamburger-layer-color : #000 !default;
|
17 |
+
$hamburger-layer-border-radius : 4px !default;
|
18 |
+
$hamburger-hover-opacity : 0.7 !default;
|
19 |
+
$hamburger-hover-transition-duration : 0.15s !default;
|
20 |
+
$hamburger-hover-transition-timing-function: linear !default;
|
21 |
+
|
22 |
+
// To use CSS filters as the hover effect instead of opacity,
|
23 |
+
// set $hamburger-hover-use-filter as true and
|
24 |
+
// change the value of $hamburger-hover-filter accordingly.
|
25 |
+
$hamburger-hover-use-filter: false !default;
|
26 |
+
$hamburger-hover-filter : opacity(50%) !default;
|
27 |
+
|
28 |
+
// Types (Remove or comment out what you don’t need)
|
29 |
+
// ==================================================
|
30 |
+
$hamburger-types: (
|
31 |
+
boring,
|
32 |
+
none
|
33 |
+
) !default;
|
34 |
+
|
35 |
+
// Base Hamburger (We need this)
|
36 |
+
// ==================================================
|
37 |
+
@import "base";
|
38 |
+
|
39 |
+
// Hamburger types
|
40 |
+
// ==================================================
|
41 |
+
@import "types/boring";
|
42 |
+
@import "types/vortex";
|
43 |
+
|
44 |
+
// ==================================================
|
45 |
+
// Cooking up additional types:
|
46 |
+
//
|
47 |
+
// The Sass for each hamburger type should be nested
|
48 |
+
// inside an @if directive to check whether or not
|
49 |
+
// it exists in $hamburger-types so only the CSS for
|
50 |
+
// included types are generated.
|
51 |
+
//
|
52 |
+
// e.g. hamburgers/types/_new-type.scss
|
53 |
+
//
|
54 |
+
// @if index($hamburger-types, new-type) {
|
55 |
+
// .responsive-menu-new-type {
|
56 |
+
// ...
|
57 |
+
// }
|
58 |
+
// }
|
src/public/scss/hamburgers/types/_boring.scss
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@if index($hamburger-types, boring) {
|
2 |
+
/*
|
3 |
+
* Boring
|
4 |
+
*/
|
5 |
+
.responsive-menu-boring {
|
6 |
+
.responsive-menu-inner {
|
7 |
+
&,
|
8 |
+
&::before,
|
9 |
+
&::after {
|
10 |
+
transition-property: none;
|
11 |
+
}
|
12 |
+
}
|
13 |
+
|
14 |
+
&.is-active {
|
15 |
+
.responsive-menu-inner {
|
16 |
+
transform: rotate(45deg);
|
17 |
+
|
18 |
+
&::before {
|
19 |
+
top: 0;
|
20 |
+
opacity: 0;
|
21 |
+
}
|
22 |
+
|
23 |
+
&::after {
|
24 |
+
bottom: 0;
|
25 |
+
transform: rotate(-90deg);
|
26 |
+
}
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
30 |
+
}
|
src/views/admin/main.phtml
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use ResponsiveMenu\Formatters\Tabs as Tabs;
|
4 |
+
use ResponsiveMenu\Formatters\Text as Text;
|
5 |
+
// This is horrible!
|
6 |
+
include dirname(dirname(dirname(__FILE__))) . '/config/admin_ordering.php';
|
7 |
+
|
8 |
+
$tabs = new ResponsiveMenu\ViewModels\Components\Admin\Tabs($order_mapping);
|
9 |
+
$boxes = new ResponsiveMenu\ViewModels\Components\Admin\Boxes($order_mapping, $l['options']);
|
10 |
+
|
11 |
+
?>
|
12 |
+
<div class="wrap">
|
13 |
+
<div id="poststuff">
|
14 |
+
<div id="postbox-container" class="postbox-container">
|
15 |
+
<?php if(isset($l['flash']['success'])): ?>
|
16 |
+
<div class="updated notice notice-success is-dismissible" id="message">
|
17 |
+
<p><?php _e($l['flash']['success'], 'responsive-menu'); ?></p>
|
18 |
+
<button class="notice-dismiss" type="button">
|
19 |
+
<span class="screen-reader-text">
|
20 |
+
<?php _e('Dismiss this notice', 'responsive-menu') ?>.
|
21 |
+
</span>
|
22 |
+
</button>
|
23 |
+
</div> <!-- updated -->
|
24 |
+
<?php endif; ?>
|
25 |
+
<?php if(isset($l['flash']['errors'])): ?>
|
26 |
+
<div class="notice notice-error is-dismissible" id="message">
|
27 |
+
<ul>
|
28 |
+
<?php foreach($l['flash']['errors'] as $error): ?>
|
29 |
+
<li><?php _e($error, 'responsive-menu'); ?></li>
|
30 |
+
<?php endforeach; ?>
|
31 |
+
</ul>
|
32 |
+
<button class="notice-dismiss" type="button">
|
33 |
+
<span class="screen-reader-text">
|
34 |
+
<?php _e('Dismiss this notice', 'responsive-menu') ?>.
|
35 |
+
</span>
|
36 |
+
</button>
|
37 |
+
</div>
|
38 |
+
<?php endif; ?>
|
39 |
+
|
40 |
+
<div class="tabs_container">
|
41 |
+
<?php echo $tabs->render(); ?>
|
42 |
+
</div>
|
43 |
+
|
44 |
+
<div class="key-container">
|
45 |
+
<a href="http://responsive.menu/pricing/">
|
46 |
+
<div class="key key-pro"><span>PRO</span>Only available in Pro version</div>
|
47 |
+
<div class="key key-semi-pro"><span>SEMI PRO</span>Fully unlocked in Pro version (i.e - opacity selection for colours)</div>
|
48 |
+
</a>
|
49 |
+
</div>
|
50 |
+
|
51 |
+
<div class="upgrade-notes">
|
52 |
+
<div class="upgrade-notes-title">Welcome to Responsive Menu 3.0</div>
|
53 |
+
<div class="upgrade-notes-content">
|
54 |
+
As this is a brand new version, there are over 14,000 combinations of options so squashing bugs is not an easy task and some may still exist. Therefore, please report any bugs to us <a href="https://responsive.menu/contact/" target="_blank">here</a> and we will deal with them quickly.<br /><br />
|
55 |
+
For an upgrade guide, please check out <a href="https://responsive.menu/upgrading-from-version-2-to-version-3" target="_blank">this page</a>.
|
56 |
+
</div>
|
57 |
+
<div class="upgrade-notes-close">x</div>
|
58 |
+
</div>
|
59 |
+
|
60 |
+
<div id="all_options_container">
|
61 |
+
<div class="meta-box-sortables ui-sortable" id="normal-sortables">
|
62 |
+
<form action="" method="post" enctype="multipart/form-data">
|
63 |
+
<input type="submit" class="button submit" name="responsive_menu_submit" value="Update Options" style="display: none;" />
|
64 |
+
<div id="options_list_container">
|
65 |
+
<?php echo $boxes->render(); ?>
|
66 |
+
</div>
|
67 |
+
<input type="submit" id="responsive_menu_submit" class="button submit" name="responsive_menu_submit" value="<?php _e('Update Options', 'responsive-menu') ?>" />
|
68 |
+
</form>
|
69 |
+
</div> <!-- #normal-sortables -->
|
70 |
+
</div><!--#all_options_container
|
71 |
+
--><div id="banner_area">
|
72 |
+
<div id="upgrade_banner">
|
73 |
+
<?php _e('Upgrade today to unlock the following features:', 'responsive-menu'); ?>
|
74 |
+
<ul>
|
75 |
+
<li><?php _e('Font Awesome Icon Support', 'responsive-menu'); ?></li>
|
76 |
+
<li><?php _e('Opacity Option for all Colours', 'responsive-menu'); ?></li>
|
77 |
+
<li><?php _e('15+ Button Animations', 'responsive-menu'); ?></li>
|
78 |
+
<li><?php _e('Style Desktop Menu Too', 'responsive-menu'); ?></li>
|
79 |
+
<li><?php _e('Header Bar', 'responsive-menu'); ?></li>
|
80 |
+
<li><?php _e('And much more', 'responsive-menu'); ?></li>
|
81 |
+
</ul>
|
82 |
+
<a target="_blank" href="http://responsive.menu/why-go-pro" class="button"><?php _e('Buy today for just $14.99', 'responsive-menu'); ?></a>
|
83 |
+
</div>
|
84 |
+
<div id="docs_banner">
|
85 |
+
<?php _e('Confused? Check out our documentation', 'responsive-menu'); ?>
|
86 |
+
<a target="_blank" href="https://responsive.menu/docs" class="button"><?php _e('View Docs', 'responsive-menu'); ?></a>
|
87 |
+
</div>
|
88 |
+
</div> <!-- #banner_area -->
|
89 |
+
</div> <!-- #postbox-container -->
|
90 |
+
</div> <!-- #poststuff -->
|
91 |
+
</div> <!-- #wrap -->
|
src/views/button.phtml
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php echo $l['button'];
|
src/views/header_bar.phtml
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<div id="responsive-menu-header">
|
2 |
+
<?php echo $l['header']; ?>
|
3 |
+
</div>
|
src/views/menu.phtml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="responsive-menu-container"
|
2 |
+
class="
|
3 |
+
<?php echo $l['options']['animation_type']; ?>-<?php echo $l['options']['menu_appear_from']; ?>
|
4 |
+
">
|
5 |
+
<div id="responsive-menu-wrapper">
|
6 |
+
<?php echo $l['menu']; ?>
|
7 |
+
</div>
|
8 |
+
</div>
|