├── NOTICE ├── COPYRIGHT.md ├── .gitignore ├── sly ├── toolbar │ ├── toolbar-aem-indicator.html │ ├── ToolBar.js │ └── brackets_aem_icons.svg ├── nls │ ├── strings.js │ ├── root │ │ └── strings.js │ ├── en-gb │ │ └── strings.js │ └── ro │ │ └── strings.js ├── panel │ ├── aem-sync-entry.html │ ├── aem-sync-panel.html │ └── Panel.js ├── bootstrap │ ├── extensions │ │ ├── sling.json │ │ └── cq.json │ └── default.json ├── SessionStorage.js ├── FileMTimeCache.js ├── node │ ├── Constants.js │ ├── FilterRule.js │ ├── VaultIgnore.js │ ├── Filter.js │ ├── SlyDomain.js │ └── PackMgr.js ├── styles │ └── sly.css ├── command │ └── Commands.js ├── menu │ └── Menu.js ├── preferences │ ├── project-settings-dialog.html │ └── Preferences.js ├── Highlighter.js ├── ProjectUtils.js ├── Preview.js ├── BeanManager.js ├── SightlyLanguage.js ├── SightlyCodeHint.js └── RemoteSyncManager.js ├── sly-tests ├── resources │ ├── parse-test.sly │ └── codehint-test.sly ├── BeanManagerTest.js ├── SightlyLanguageTest.js └── SightlyCodeHintTest.js ├── .jshintrc ├── strings.js ├── .github └── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── unittests.js ├── LICENSE_HEADER.md ├── package.json ├── PULL_REQUEST_TEMPLATE.md ├── CONTRIBUTING.md ├── main.js ├── README.md ├── CODE_OF_CONDUCT.md ├── Gruntfile.js └── LICENSE /NOTICE: -------------------------------------------------------------------------------- 1 | Copyright 2014 Adobe Systems Incorporated. All rights reserved. 2 | 3 | Licensed under the Apache License 2.0. 4 | http://www.apache.org/licenses/LICENSE-2.0 -------------------------------------------------------------------------------- /COPYRIGHT.md: -------------------------------------------------------------------------------- 1 | © Copyright 2015-2018 Adobe. All rights reserved. 2 | 3 | Adobe holds the copyright for all the files found in this repository. 4 | 5 | See the LICENSE file for licensing information. 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | atlassian-ide-plugin.xml 2 | node_modules 3 | sling 4 | target 5 | .idea 6 | .classpath 7 | .project 8 | .settings 9 | .checkstyle 10 | *.iml 11 | *.ipr 12 | *.iws 13 | bin 14 | .vlt 15 | .vlt-sync-config.properties 16 | .vlt-sync.log 17 | .DS_Store 18 | *.log 19 | -------------------------------------------------------------------------------- /sly/toolbar/toolbar-aem-indicator.html: -------------------------------------------------------------------------------- 1 | {{!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | ~ Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved. 3 | ~ 4 | ~ Licensed under the Apache License 2.0. 5 | ~ http://www.apache.org/licenses/LICENSE-2.0 6 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--}} 7 | 8 | -------------------------------------------------------------------------------- /sly-tests/resources/parse-test.sly: -------------------------------------------------------------------------------- 1 | 2 |
3 | ${properties.phBeforeText || false} 4 | 7 |
${3}
8 |
-------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "nonew" : true, 3 | "curly" : true, 4 | "latedef" : true, 5 | "unused" : "vars", 6 | "noarg" : true, 7 | "indent" : 4, 8 | "trailing": true, 9 | "forin" : true, 10 | "noempty" : true, 11 | "quotmark": "single", 12 | "node" : true, 13 | "eqeqeq" : true, 14 | "strict" : true, 15 | "undef" : true, 16 | "bitwise" : true, 17 | "immed" : true, 18 | "maxlen" : 140, 19 | "freeze" : true, 20 | "multistr": true 21 | } 22 | -------------------------------------------------------------------------------- /strings.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved. 3 | * 4 | * Licensed under the Apache License 2.0. 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | ******************************************************************************/ 7 | /*global define */ 8 | define(function (require, exports, module) { 9 | 'use strict'; 10 | 11 | module.exports = require('i18n!sly/nls/strings'); 12 | }); 13 | -------------------------------------------------------------------------------- /sly/nls/strings.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved. 3 | * 4 | * Licensed under the Apache License 2.0. 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | ******************************************************************************/ 7 | /*global define*/ 8 | define(function (require, exports, module) { 9 | 10 | 'use strict'; 11 | 12 | module.exports = { 13 | "root": true, 14 | "ro": true, 15 | "en-gb": true 16 | }; 17 | }); 18 | -------------------------------------------------------------------------------- /sly/panel/aem-sync-entry.html: -------------------------------------------------------------------------------- 1 | {{!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | ~ Copyright (c) 2015 Adobe Systems Incorporated. All rights reserved. 3 | ~ 4 | ~ Licensed under the Apache License 2.0. 5 | ~ http://www.apache.org/licenses/LICENSE-2.0 6 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--}} 7 | {{#status}} 8 | 9 | {{path}} 10 | {{status}} 11 | {{time}} 12 | 13 | {{/status}} 14 | {{#error}} 15 | 16 | {{error}} 17 | {{time}} 18 | 19 | {{/error}} 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 🚀 Feature Request 3 | about: I have a suggestion (and I could even submit a PR 🤘🏼)! 4 | 5 | --- 6 | 7 | ## Feature Request 8 | 9 | **Is your feature request related to a problem? Please describe.** 10 | A clear and concise description of what the problem is. Ex. I have an issue when [...] 11 | 12 | **Describe the solution you'd like** 13 | A clear and concise description of what you want to happen. Add any considered drawbacks. 14 | 15 | **Are there alternatives?** 16 | A clear and concise description of any alternative solutions or features you've considered. 17 | 18 | **Documentation** 19 | If you can, explain how users will be able to use this and possibly write out a version of the docs. 20 | Maybe a screenshot or design? 21 | -------------------------------------------------------------------------------- /sly/bootstrap/extensions/sling.json: -------------------------------------------------------------------------------- 1 | { 2 | "attributes": 3 | { 4 | }, 5 | "beanClasses": 6 | { 7 | "org.apache.sling.api.resource.ValueMap" : {"hidden": true, "members": [{"name":"jcr:title"},{"name":"jcr:description"}]}, 8 | "org.apache.sling.api.resource.Resource": {"hidden": true, "members": [{"name":"listChildren"},{"name":"name"},{"name":"parent"},{"name":"path"},{"name":"resourceType"},{"name":"resourceSuperType"}]} 9 | }, 10 | "beans": { 11 | "properties": { 12 | "name": "properties", 13 | "clazz": "org.apache.sling.api.resource.ValueMap" 14 | }, 15 | "resource": { 16 | "name": "resource", 17 | "clazz": "org.apache.sling.api.resource.Resource" 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /unittests.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved. 3 | * 4 | * Licensed under the Apache License 2.0. 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | ******************************************************************************/ 7 | 8 | /**/ 9 | /* Sightly Extension unit tests*/ 10 | /*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */ 11 | /*global brackets,define, $, jasmine, describe, beforeFirst, afterLast, afterEach, it, runs, waitsFor, expect, waitsForDone */ 12 | define(function (require, exports, module) { 13 | "use strict"; 14 | describe("All Sightly Tests", function () { 15 | require("sly-tests/SightlyLanguageTest"); 16 | require("sly-tests/BeanManagerTest"); 17 | require("sly-tests/SightlyCodeHintTest"); 18 | }); 19 | }); -------------------------------------------------------------------------------- /sly-tests/resources/codehint-test.sly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

6 | blah 7 |

8 | 9 | 10 |
11 | blah 12 |
13 | 14 | 15 |
16 | blah 17 |
18 | 19 | 20 |
21 | ${currentPage.listChildren} 22 |
23 | 24 | 25 |
26 | ${resource.} 27 |
28 | 29 | 30 |
31 | ${resource.name} 32 |
33 | 34 | 35 | -------------------------------------------------------------------------------- /sly/SessionStorage.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved. 3 | * 4 | * Licensed under the Apache License 2.0. 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | ******************************************************************************/ 7 | /*global define, sessionStorage */ 8 | define(function (require, exports, module) { 9 | 'use strict'; 10 | 11 | var NS = 'brackets.sly'; 12 | 13 | function put(key, object) { 14 | sessionStorage.setItem(NS + '.' + key, JSON.stringify(object)); 15 | } 16 | 17 | function get(key) { 18 | return JSON.parse(sessionStorage.getItem(NS + '.' + key)); 19 | } 20 | 21 | function remove(key) { 22 | var result = JSON.parse(sessionStorage.getItem(NS + '.' + key)); 23 | sessionStorage.removeItem(NS + '.' + key); 24 | return result; 25 | } 26 | 27 | exports.put = put; 28 | exports.get = get; 29 | exports.remove = remove; 30 | 31 | }); -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 🐛 Bug Report 3 | about: It doesn't work for me. 🤔 4 | 5 | --- 6 | 11 | 12 | ## Bug Report 13 | 14 | **Current Behavior** 15 | A clear and concise description of the behavior and your setup, with steps to reproduce the issue. 16 | 17 | **Expected behavior/code** 18 | A clear and concise description of what you expected to happen. 19 | 20 | **Environment** 21 | - Brackets version (e.g. Release 1.13 build 1.13.0-17696 (release 49d29a8bc)) 22 | - AEM Brackets Extension (e.g. 0.0.14) 23 | - Operating System version (e.g. macOS 10.13.6, Windows 10, etc.) 24 | 25 | **Possible Solution** 26 | 27 | 28 | **Additional context / Screenshots** 29 | Add any other context about the problem here. If applicable, add screenshots to help explain. 30 | 31 | -------------------------------------------------------------------------------- /sly/FileMTimeCache.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2015 Adobe Systems Incorporated. All rights reserved. 3 | * 4 | * Licensed under the Apache License 2.0. 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | ******************************************************************************/ 7 | /*global define, brackets, $*/ 8 | define(function (require, exports, module) { 9 | 'use strict'; 10 | var _cache = {}; 11 | 12 | /* Put last modified time for given file entry */ 13 | function put(file, mtime) { 14 | _cache[file] = mtime; 15 | } 16 | 17 | /* Get last modified time for given file entry */ 18 | function get(file) { 19 | try { 20 | return _cache[file]; 21 | } catch (e) { 22 | return null; 23 | } 24 | } 25 | 26 | /* Remove everything from cache */ 27 | function clean() { 28 | _cache = {}; 29 | } 30 | 31 | exports.get = get; 32 | exports.put = put; 33 | exports.clean = clean; 34 | }); -------------------------------------------------------------------------------- /sly/node/Constants.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved. 3 | * 4 | * Licensed under the Apache License 2.0. 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | ******************************************************************************/ 7 | (function () { 8 | 'use strict'; 9 | 10 | var sync = {}; 11 | 12 | /** 13 | * Allowed by filters. 14 | * 15 | * @type {number} 16 | */ 17 | sync.FILTER_INCLUDED = 1; 18 | 19 | /** 20 | * Not included in filters. 21 | * 22 | * @type {number} 23 | */ 24 | sync.FILTER_IGNORED = 0; 25 | 26 | /** 27 | * Excluded by filters. 28 | * 29 | * @type {number} 30 | */ 31 | sync.FILTER_EXCLUDED = -1; 32 | 33 | /** 34 | * Excluded by .vltignore files or excluded by default. 35 | * 36 | * @type {number} 37 | */ 38 | sync.EXCLUDED = -2; 39 | 40 | /** 41 | * Deleted from the receiving end. 42 | * 43 | * @type {number} 44 | */ 45 | sync.DELETED_FROM_REMOTE = -3; 46 | 47 | module.exports.sync = sync; 48 | }()); 49 | -------------------------------------------------------------------------------- /sly/node/FilterRule.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved. 3 | * 4 | * Licensed under the Apache License 2.0. 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | ******************************************************************************/ 7 | (function (){ 8 | 'use strict'; 9 | 10 | /** 11 | * A FilterRule represents an 'include' / 'exclude' single entry for a 'filter' tag from an Apache Jackrabbit FileVault 12 | * filter.xml file. 13 | * 14 | * @param {String} type the rule's type (see {@link FilterRule#INCLUDE_RULE}, {@link FilterRule#EXCLUDE_RULE}) 15 | * @param {RegExp} pattern the rule's pattern 16 | * @constructor 17 | */ 18 | function FilterRule(type, pattern) { 19 | this.type = type; 20 | this.pattern = pattern; 21 | } 22 | 23 | /** 24 | * Constant for 'include' rule type. 25 | * @type {string} 26 | */ 27 | FilterRule.INCLUDE_RULE = 'include'; 28 | 29 | /** 30 | * Constant for 'exclude' rule type. 31 | * @type {String} 32 | */ 33 | FilterRule.EXCLUDE_RULE = 'exclude'; 34 | 35 | module.exports = FilterRule; 36 | }()); -------------------------------------------------------------------------------- /sly/styles/sly.css: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved. 3 | * 4 | * Licensed under the Apache License 2.0. 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | ******************************************************************************/ 7 | .sly table { 8 | width: 100%; 9 | } 10 | 11 | .sly .tablehead, .sly .settings-parameter { 12 | font-weight: 500; 13 | } 14 | 15 | .disabled-toolbar-button { 16 | opacity: 0.4; 17 | pointer-events: none; 18 | cursor: default; 19 | } 20 | 21 | .sly .alert { 22 | color: #DD3E3A; 23 | font-weight: 500; 24 | } 25 | 26 | #sly-status-aem { 27 | background-image: url('../toolbar/brackets_aem_icons.svg'); 28 | } 29 | 30 | #sly-status-aem.sly-status-inactive { 31 | background-position: 0px 0px !important; 32 | } 33 | 34 | #sly-status-aem.sly-status-ok { 35 | background-position: 0 -24px !important; 36 | } 37 | 38 | #sly-status-aem.sly-status-warning { 39 | background-position: 0px -48px !important; 40 | } 41 | 42 | #sly-status-aem.sly-status-error { 43 | background-position: 0px -72px !important; 44 | } 45 | 46 | #sly-status-aem.sly-status-active { 47 | background-position: 0px -96px !important; 48 | } 49 | -------------------------------------------------------------------------------- /sly/panel/aem-sync-panel.html: -------------------------------------------------------------------------------- 1 | {{!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | ~ Copyright (c) 2015 Adobe Systems Incorporated. All rights reserved. 3 | ~ 4 | ~ Licensed under the Apache License 2.0. 5 | ~ http://www.apache.org/licenses/LICENSE-2.0 6 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--}} 7 |
8 |
9 |
10 | 11 |
12 | × 13 |
14 |

{{Strings.SYNC_STATUS}}

15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
{{Strings.SYNC_STATUS_TH_FILE}}{{Strings.SYNC_STATUS_TH_STATUS}}{{Strings.SYNC_STATUS_TH_TIME}}
26 |
27 |
-------------------------------------------------------------------------------- /LICENSE_HEADER.md: -------------------------------------------------------------------------------- 1 | # Apache V2 2 | 3 | ``` 4 | Copyright 2018 Adobe. All rights reserved. 5 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. You may obtain a copy 7 | of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software distributed under 10 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 11 | OF ANY KIND, either express or implied. See the License for the specific language 12 | governing permissions and limitations under the License. 13 | ``` 14 | 15 | ### Javascript, Java, C, C++, Swift, Go, Objective C 16 | 17 | ``` 18 | /* 19 | Copyright 2018 Adobe. All rights reserved. 20 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 21 | you may not use this file except in compliance with the License. You may obtain a copy 22 | of the License at http://www.apache.org/licenses/LICENSE-2.0 23 | 24 | Unless required by applicable law or agreed to in writing, software distributed under 25 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 26 | OF ANY KIND, either express or implied. See the License for the specific language 27 | governing permissions and limitations under the License. 28 | */ 29 | ``` 30 | -------------------------------------------------------------------------------- /sly/bootstrap/extensions/cq.json: -------------------------------------------------------------------------------- 1 | { 2 | "beanClasses": { 3 | "com.day.cq.wcm.api.Page": 4 | { 5 | "hidden": true, 6 | "members" : [ 7 | {"name":"language"}, 8 | {"name":"lastModifiedBy"}, 9 | {"name":"listChildren"}, 10 | {"name":"name"}, 11 | {"name":"navigationTitle"}, 12 | {"name":"pageTitle"}, 13 | {"name":"parent"}, 14 | {"name":"path"}, 15 | {"name":"properties"}, 16 | {"name":"tags"}, 17 | {"name":"title"}, 18 | {"name":"vanityUrl"}, 19 | {"name":"hasChild"}, 20 | {"name":"hasContent"}, 21 | {"name":"isHideInNav"}, 22 | {"name":"isLocked"}, 23 | {"name":"isValid"}]}, 24 | "com.day.cq.wcm.api.WCMMode": 25 | { 26 | "hidden": true, 27 | "members" : [ 28 | {"name":"edit"}, 29 | {"name":"preview"}, 30 | {"name":"disabled"}, 31 | {"name":"design"}] 32 | } 33 | }, 34 | 35 | "beans": { 36 | "currentPage": { 37 | "name": "currentPage", 38 | "clazz": "com.day.cq.wcm.api.Page" 39 | }, 40 | "wcmmode": { 41 | "name": "wcmmode", 42 | "clazz": "com.day.cq.wcm.api.WCMMode" 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /sly/command/Commands.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved. 3 | * 4 | * Licensed under the Apache License 2.0. 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | ******************************************************************************/ 7 | /* 8 | jshint nonew:true, curly:true, latedef:true, unused:vars, noarg:true, indent:4, trailing:true, forin:true, noempty:true, quotmark:single, 9 | node:true, eqeqeq:true, strict:true, undef:true, bitwise:true, immed:true, maxlen:140, freeze:true, multistr:true 10 | */ 11 | /*global define*/ 12 | define(function (require, exports, module) { 13 | 'use strict'; 14 | 15 | var Strings = require('strings'); 16 | 17 | // SIGHTLY menu 18 | var MENU = { 19 | projectPreferences : { 20 | id : 'sly.openProjectPreferences', // Preferences.js openProjectPreferences() 21 | name : Strings.MENU_PROJECT_SETTINGS, 22 | keyBindings: { key: 'Cmd-Shift-P'} 23 | }, 24 | exportContentPackage: { 25 | id : 'sly.exportContentPackage', 26 | name : Strings.MENU_EXPORT_CONTENT_PACKAGE, 27 | keyBindings: {key: 'Cmd-Shift-E'} 28 | }, 29 | importContentPackage: { 30 | id : 'sly.importContentPackage', 31 | name : Strings.MENU_IMPORT_CONTENT_PACKAGE, 32 | keyBindings: {key: 'Cmd-Shift-I'} 33 | } 34 | }; 35 | 36 | exports.MENU = MENU; 37 | 38 | }); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "aem-sightly-brackets-extension", 3 | "title" : "AEM Brackets Extension", 4 | "description" : "The AEM Brackets Extension provides a smooth and easy development workflow for front-end developers to edit AEM components. Its main features are: automatic synchronisation of changed project files to your AEM instance; manual importing of content from the AEM instance to the project; Sightly syntax-highlighting and auto-completion; easy editing of associated client libraries (CSS, JavaScript).", 5 | "version" : "0.0.16-dev", 6 | "engines" : { 7 | "brackets": ">=0.45.0" 8 | }, 9 | "author" : "Adobe (https://github.com/adobe)", 10 | "homepage" : "https://docs.adobe.com/content/docs/en/dev-tools/aem-brackets.html", 11 | "repository" : "https://github.com/adobe/aem-brackets-extension.git", 12 | "license" : "Apache-2.0", 13 | "keywords": ["Adobe", "Adobe Experience Manager", "AEM", "Sightly", "sly", "HTL"], 14 | "categories": ["editing", "language", "external"], 15 | "i18n" : ["en", "ro", "en-gb"], 16 | "dependencies" : { 17 | "request" : "~2.74.0", 18 | "adm-zip": "~> 0.4.11", 19 | "q" : "1.0.1", 20 | "glob" : "3.2.9", 21 | "fs-extra": "5.0.0", 22 | "xmldom" : "0.1.19", 23 | "xpath" : "0.0.7", 24 | "unzip" : "0.1.9", 25 | "archiver": "0.10.1" 26 | }, 27 | "devDependencies": { 28 | "grunt" : "~0.4.2", 29 | "grunt-maven-tasks" : "~1.1.0", 30 | "grunt-npm-install" : "~0.1.0", 31 | "grunt-contrib-compress": "~0.8.0" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Description 4 | 5 | 6 | 7 | ## Related Issue 8 | 9 | 10 | 11 | 12 | 13 | 14 | ## Motivation and Context 15 | 16 | 17 | 18 | ## How Has This Been Tested? 19 | 20 | 21 | 22 | 23 | 24 | ## Screenshots (if appropriate): 25 | 26 | ## Types of changes 27 | 28 | 29 | 30 | - [ ] Bug fix (non-breaking change which fixes an issue) 31 | - [ ] New feature (non-breaking change which adds functionality) 32 | - [ ] Breaking change (fix or feature that would cause existing functionality to change) 33 | 34 | ## Checklist: 35 | 36 | 37 | 38 | 39 | - [ ] I have signed the [Adobe Open Source CLA](http://opensource.adobe.com/cla.html). 40 | - [ ] My code follows the code style of this project. 41 | - [ ] My change requires a change to the documentation. 42 | - [ ] I have updated the documentation accordingly. 43 | - [ ] I have read the **CONTRIBUTING** document. 44 | - [ ] I have added tests to cover my changes. 45 | - [ ] All new and existing tests passed. 46 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Thanks for choosing to contribute! 4 | 5 | The following are a set of guidelines to follow when contributing to this project. 6 | 7 | ## Code Of Conduct 8 | 9 | This project adheres to the Adobe [code of conduct](CODE_OF_CONDUCT.md). By participating, 10 | you are expected to uphold this code. Please report unacceptable behavior to 11 | [Grp-opensourceoffice@adobe.com](mailto:Grp-opensourceoffice@adobe.com). 12 | 13 | ## Have A Question? 14 | 15 | Start by filing an issue. The existing committers on this project work to reach 16 | consensus around project direction and issue solutions within issue threads 17 | (when appropriate). 18 | 19 | ## Contributor License Agreement 20 | 21 | All third-party contributions to this project must be accompanied by a signed contributor 22 | license agreement. This gives Adobe permission to redistribute your contributions 23 | as part of the project. [Sign our CLA](http://opensource.adobe.com/cla.html). You 24 | only need to submit an Adobe CLA one time, so if you have submitted one previously, 25 | you are good to go! 26 | 27 | ## Code Reviews 28 | 29 | All submissions should come in the form of pull requests and need to be reviewed 30 | by project committers. Read [GitHub's pull request documentation](https://help.github.com/articles/about-pull-requests/) 31 | for more information on sending pull requests. 32 | 33 | Lastly, please follow the [pull request template](PULL_REQUEST_TEMPLATE.md) when 34 | submitting a pull request! 35 | 36 | ## From Contributor To Committer 37 | 38 | We love contributions from our community! If you'd like to go a step beyond contributor 39 | and become a committer with full write access and a say in the project, you must 40 | be invited to the project. The existing committers employ an internal nomination 41 | process that must reach lazy consensus (silence is approval) before invitations 42 | are issued. If you feel you are qualified and want to get more deeply involved, 43 | feel free to reach out to existing committers to have a conversation about that. 44 | 45 | ## Security Issues 46 | 47 | Security issues shouldn't be reported on this issue tracker. Instead, [file an issue to our security experts](https://helpx.adobe.com/security/alertus.html) 48 | -------------------------------------------------------------------------------- /sly/panel/Panel.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2015 Adobe Systems Incorporated. All rights reserved. 3 | * 4 | * Licensed under the Apache License 2.0. 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | ******************************************************************************/ 7 | /*global define, brackets, Mustache, $, sessionStorage */ 8 | define(function (require, exports, module) { 9 | 'use strict'; 10 | 11 | var WorkspaceManager = brackets.getModule('view/WorkspaceManager'), 12 | Strings = require('strings'), 13 | statusPanel = null, 14 | MAX_SIZE = 1000, 15 | panelTemplate = require('text!./aem-sync-panel.html'), 16 | entryTemplate = require('text!./aem-sync-entry.html'); 17 | 18 | function _init() { 19 | if (statusPanel === null) { 20 | var templateVars = { 21 | Strings: Strings, 22 | syncStatus: null 23 | } 24 | statusPanel = WorkspaceManager.createBottomPanel("sly.status", $(Mustache.render(panelTemplate, templateVars))); 25 | } 26 | statusPanel.$panel.on("click", ".close", toggle); 27 | statusPanel.$panel.on("click", ".clear", clear); 28 | } 29 | 30 | function toggle(show) { 31 | if (statusPanel === null) { 32 | _init(); 33 | } 34 | if (typeof show === "boolean") { 35 | statusPanel.setVisible(show); 36 | } else { 37 | statusPanel.setVisible(!statusPanel.isVisible()); 38 | } 39 | } 40 | 41 | function clear() { 42 | if (statusPanel === null) { 43 | return; 44 | } 45 | statusPanel.$panel.find(".sly-sync-results table tbody").empty(); 46 | } 47 | 48 | function append(entry) { 49 | if (statusPanel === null) { 50 | _init(); 51 | } 52 | var tbody = statusPanel.$panel.find(".sly-sync-results table tbody"); 53 | tbody.prepend(Mustache.render(entryTemplate, entry)); 54 | tbody.find("tr").slice(MAX_SIZE).remove(); 55 | } 56 | 57 | exports.toggle = toggle; 58 | exports.clear = clear; 59 | exports.append = append 60 | }); -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved. 3 | * 4 | * Licensed under the Apache License 2.0. 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | ******************************************************************************/ 7 | /*global define, $, brackets, require */ 8 | require.config({ 9 | paths: { 10 | 'text' : 'lib/text', 11 | 'i18n' : 'lib/i18n' 12 | }, 13 | locale: brackets.getLocale() 14 | }); 15 | 16 | define(function (require, exports, module) { 17 | 'use strict'; 18 | 19 | // Load submodules 20 | var Menu = require('sly/menu/Menu'), 21 | SightlyLanguage = require('sly/SightlyLanguage'), 22 | BeanManager = require('sly/BeanManager'), 23 | SlyCodeHints = require('sly/SightlyCodeHint'), 24 | Highlighter = require('sly/Highlighter'), 25 | RemoteSyncMgr = require('sly/RemoteSyncManager'), 26 | ToolBar = require('sly/toolbar/ToolBar'), 27 | Preferences = require('sly/preferences/Preferences'), 28 | SLYDefault = require('text!sly/bootstrap/default.json'), 29 | SLYCQ = require('text!sly/bootstrap/extensions/cq.json'), 30 | SLYSling = require('text!sly/bootstrap/extensions/sling.json'), 31 | defaultJSON = JSON.parse(SLYDefault), 32 | cqJSON = JSON.parse(SLYCQ), 33 | slingJSON = JSON.parse(SLYSling), 34 | SLYDictionary = $.extend(true, defaultJSON, cqJSON, slingJSON), 35 | AppInit = brackets.getModule('utils/AppInit'), 36 | ExtensionUtils = brackets.getModule('utils/ExtensionUtils'); 37 | 38 | AppInit.appReady(function () { 39 | try { 40 | Menu.load(SLYDictionary); 41 | Preferences.load(SLYDictionary); 42 | RemoteSyncMgr.load(SLYDictionary); 43 | SightlyLanguage.load(SLYDictionary); 44 | Highlighter.load(SLYDictionary); 45 | BeanManager.load(SLYDictionary); 46 | SlyCodeHints.load(SLYDictionary); 47 | ToolBar.load(SLYDictionary); 48 | ExtensionUtils.loadStyleSheet(module, 'sly/styles/sly.css').done(); 49 | } catch (e) { 50 | console.error('unable to correctly load sightly extension : ' + e); 51 | } 52 | }); 53 | 54 | }); 55 | -------------------------------------------------------------------------------- /sly/menu/Menu.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved. 3 | * 4 | * Licensed under the Apache License 2.0. 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | ******************************************************************************/ 7 | /* 8 | jshint nonew:true, curly:true, latedef:true, unused:vars, noarg:true, indent:4, trailing:true, forin:true, noempty:true, quotmark:single, 9 | node:true, eqeqeq:true, strict:true, undef:true, bitwise:true, immed:true, maxlen:140, freeze:true, multistr:true 10 | */ 11 | /*global define,brackets */ 12 | define(function (require, exports, module) { 13 | 'use strict'; 14 | 15 | var Menus = brackets.getModule('command/Menus'), 16 | Commands = require('sly/command/Commands'), 17 | Preferences = require('sly/preferences/Preferences'), 18 | RemoteSyncManager = require('sly/RemoteSyncManager'), 19 | CommandManager = brackets.getModule('command/CommandManager'), 20 | KeyBindingManager = brackets.getModule('command/KeyBindingManager'); 21 | 22 | function load(SLYDictionary) { 23 | var appMenu = Menus.addMenu('AEM', 'sly.adobe.main', Menus.BEFORE, Menus.AppMenuBar.HELP_MENU); 24 | var openProjectPreferencesCommand = CommandManager.register( 25 | Commands.MENU.projectPreferences.name, 26 | Commands.MENU.projectPreferences.id, 27 | Preferences.openProjectPreferences 28 | ); 29 | KeyBindingManager.addBinding(openProjectPreferencesCommand, Commands.MENU.projectPreferences.keyBindings); 30 | appMenu.addMenuItem(openProjectPreferencesCommand); 31 | 32 | var exportContentPackageCommand = CommandManager.register( 33 | Commands.MENU.exportContentPackage.name, 34 | Commands.MENU.exportContentPackage.id, 35 | RemoteSyncManager.exportContentPackage 36 | ); 37 | KeyBindingManager.addBinding(exportContentPackageCommand, Commands.MENU.exportContentPackage.keyBindings); 38 | appMenu.addMenuItem(exportContentPackageCommand); 39 | 40 | var importContentPackageCommand = CommandManager.register( 41 | Commands.MENU.importContentPackage.name, 42 | Commands.MENU.importContentPackage.id, 43 | RemoteSyncManager.importContentPackage 44 | ); 45 | KeyBindingManager.addBinding(importContentPackageCommand, Commands.MENU.importContentPackage.keyBindings); 46 | appMenu.addMenuItem(importContentPackageCommand); 47 | } 48 | 49 | exports.load = load; 50 | }); 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AEM Brackets Extension 2 | ![](https://raw.githubusercontent.com/wiki/adobe/aem-brackets-extension/screenshots/brackets.png) 3 | 4 | This extension provides a smooth workflow to edit AEM components and client libraries, and leverages the power of the [Brackets](http://brackets.io) code editor, which gives access from within the code editor to Photoshop files and layers. The easy synchronization provided by the AEM Brackets Extension (no Maven or File Vault required) increases developer efficiency and also helps front-end developers with limited AEM knowledge to participate on projects. This extension also provides some [HTL](https://github.com/adobe/htl-spec) support, a template language that takes away the complexity of JSP to make component development easier and more secure. 5 | 6 | ## Documentation 7 | Please refer to the [documentation page](http://docs.adobe.com/content/docs/en/dev-tools/aem-brackets.html) for instructions on how to install the extension, as well as detailed information about the features. 8 | 9 | ## Get Started 10 | If you don't have of your own a project with a content-package to try out, you can try out the [HTL TodoMVC Example](https://github.com/Adobe-Marketing-Cloud/aem-htl-sample-todomvc) sample application that was built with the AEM Brackets Extension. Download the ZIP from GitHub, extract the files locally, open the `jcr_root` folder in Brackets, setup the Project Settings, and upload the whole package to your AEM development instance by doing an Export Content Package. 11 | 12 | After these steps, you should be able to access the `/content/todo.html` URL on your AEM development instance and you can start doing modifications to the code in Brackets and see how, after doing a refresh in the web browser, the changes were immediately synchronized to the AEM server. 13 | 14 | ## Known Issues or Limitations 15 | * Embedded content packages are not supported. 16 | 17 | ## Reporting Bugs 18 | Please report any issues you encounter using GitHub's [issue tracker from](https://github.com/adobe/aem-brackets-extension/issues). 19 | 20 | ## Development 21 | The AEM Brackets Extension is a Node.js module. The following steps need to be followed if you want to start hacking on new features: 22 | 23 | 1. install [Node.js](http://nodejs.org/ "node.js") for your platform 24 | 2. clone this repository 25 | 26 | ```bash 27 | git clone git@github.com:adobe/aem-brackets-extension.git 28 | ``` 29 | 3. in the `aem-brackets-extension` folder run 30 | 31 | ```bash 32 | npm install 33 | grunt 34 | ``` 35 | 36 | ## Contributing 37 | 38 | Contributions are welcome! Read the [Contributing Guide](CONTRIBUTING.md) for more information. 39 | 40 | ## Licensing 41 | 42 | This project is licensed under the Apache V2 License. See [LICENSE](LICENSE) for more information. 43 | -------------------------------------------------------------------------------- /sly/toolbar/ToolBar.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved. 3 | * 4 | * Licensed under the Apache License 2.0. 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | ******************************************************************************/ 7 | /*global define, brackets, Mustache, $, sessionStorage */ 8 | define(function (require, exports, module) { 9 | 'use strict'; 10 | 11 | var Dialogs = brackets.getModule('widgets/Dialogs'), 12 | WorkspaceManager = brackets.getModule('view/WorkspaceManager'), 13 | Strings = require('strings'), 14 | Panel = require('sly/panel/Panel'), 15 | ToolBarIndicatorTemplate = require('text!./toolbar-aem-indicator.html'), 16 | AEM_INDICATOR = 'sly-status-aem', 17 | DISABLED_TOOLBAR_BUTTON_CLASS = 'disabled-toolbar-button', 18 | states = {}, 19 | $slySyncStatus; 20 | 21 | states.INACTIVE = {title: Strings.AEM_SLY_EXTENSION, style: 'sly-status-inactive'}; 22 | states.SYNC_FULL = {title: Strings.SYNC_FULL, style: 'sly-status-ok'}; 23 | states.SYNC_PARTIAL = {title: Strings.SYNC_PARTIAL, style: 'sly-status-warning'}; 24 | states.SYNC_NONE = {title: Strings.SYNC_NONE, style: 'sly-status-error'}; 25 | states.SYNC_IN_PROGRESS = {title: Strings.SYNC_IN_PROGRESS, style: 'sly-status-active'}; 26 | 27 | function load() { 28 | var templateVars = { 29 | title: Strings.AEM_SLY_EXTENSION 30 | }; 31 | $slySyncStatus = $(Mustache.render(ToolBarIndicatorTemplate, templateVars)); 32 | $slySyncStatus.addClass(DISABLED_TOOLBAR_BUTTON_CLASS).addClass(states.INACTIVE.style); 33 | $slySyncStatus.appendTo('#main-toolbar div.buttons'); 34 | } 35 | 36 | function updateStatusIndicator(show, state, title, errorMessage) { 37 | if (errorMessage !== undefined) { 38 | Panel.append({error: errorMessage, time: new Date().toLocaleString()}); 39 | Panel.toggle(true); 40 | } 41 | if (show === true) { 42 | if (state) { 43 | var templateVars = { 44 | title: title || state.title 45 | }; 46 | var template = Mustache.render(ToolBarIndicatorTemplate, templateVars); 47 | $slySyncStatus.replaceWith(template); 48 | $slySyncStatus = $('#' + AEM_INDICATOR); 49 | $slySyncStatus.addClass(state.style || ''); 50 | $slySyncStatus.removeClass(DISABLED_TOOLBAR_BUTTON_CLASS); 51 | $slySyncStatus.click(function () { 52 | Panel.toggle(); 53 | }); 54 | } 55 | } else { 56 | $slySyncStatus.addClass(DISABLED_TOOLBAR_BUTTON_CLASS); 57 | } 58 | } 59 | 60 | exports.load = load; 61 | exports.updateStatusIndicator = updateStatusIndicator; 62 | exports.states = states; 63 | 64 | }); 65 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Adobe Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of experience, 9 | nationality, personal appearance, race, religion, or sexual identity and 10 | orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at Grp-opensourceoffice@adobe.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at [http://contributor-covenant.org/version/1/4][version] 72 | 73 | [homepage]: http://contributor-covenant.org 74 | [version]: http://contributor-covenant.org/version/1/4/ 75 | -------------------------------------------------------------------------------- /sly-tests/BeanManagerTest.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved. 3 | * 4 | * Licensed under the Apache License 2.0. 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | ******************************************************************************/ 7 | 8 | /**/ 9 | /* Sightly Language unit tests*/ 10 | /*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */ 11 | /*global brackets,define, $, jasmine, spyOn, describe, beforeFirst, afterLast, afterEach, it, runs, waitsFor, expect, waitsForDone */ 12 | 13 | define(function (require, exports, module) { 14 | "use strict"; 15 | var beanManager = require("sly/BeanManager"), 16 | SpecRunnerUtils = brackets.getModule("spec/SpecRunnerUtils"), 17 | DocumentManager = brackets.getModule("document/DocumentManager"), 18 | SLYDefault = require("text!sly/bootstrap/default.json"), 19 | SLYCQ = require("text!sly/bootstrap/extensions/cq.json"), 20 | SLYSling = require("text!sly/bootstrap/extensions/sling.json"), 21 | defaultJSON = JSON.parse(SLYDefault), 22 | cqJSON = JSON.parse(SLYCQ), 23 | slingJSON = JSON.parse(SLYSling), 24 | SLYDictionnary = $.extend(true, defaultJSON, cqJSON, slingJSON); 25 | 26 | 27 | describe("Sightly Bean Manager", function () { 28 | beanManager.load(SLYDictionnary); 29 | 30 | it("initializes a new set of beans at every refreshSlyDoc event", function () { 31 | beanManager.__testonly__refreshBeans(); 32 | expect(beanManager.getBeans()).toBeDefined(); 33 | }); 34 | it("registers a bean at the correct line (registerBean)"); 35 | it("retrieves all bean classes except the private ones (getBeanClasses)"); 36 | it("retrieves all beans available at given line (getAt)"); 37 | it("removes all beans from changed line (and only them) (onChangedLine)", function () { 38 | 39 | beanManager.getBeans().remove = { 40 | name : "remove", 41 | members : "null", 42 | start : {"line": 1, "ch": 12}, 43 | end: {"line": 3, "ch": 21} 44 | }; 45 | beanManager.getBeans().removeAnother = { 46 | name : "removeAnother", 47 | members : "null", 48 | start : {"line": 1, "ch": 43} 49 | }; 50 | beanManager.getBeans().dontremove = { 51 | name : "dontremove", 52 | members : "null", 53 | start : {"line": 2, "ch": 12} 54 | }; 55 | var beanCount = Object.keys(beanManager.getBeans()).length; 56 | beanManager.__testonly__onChangedLine(null, 1); 57 | expect(Object.keys(beanManager.getBeans()).length).toBe(beanCount - 2); 58 | expect(beanManager.getBeans().remove).not.toBeDefined(); 59 | expect(beanManager.getBeans().dontremove).toBeDefined(); 60 | }); 61 | it("re registers list beans whith good scope when name is not changed", function () { 62 | beanManager.__testonly__reRegisterBean("data-sly-list.remove", SLYDictionnary.constants.LIST.CLASS, {"line": 1, "ch": 12}); 63 | expect(beanManager.getBeans().remove).toBeDefined(); 64 | expect(beanManager.getBeans().remove.end).toBeDefined(); 65 | }); 66 | }); 67 | }); -------------------------------------------------------------------------------- /sly/bootstrap/default.json: -------------------------------------------------------------------------------- 1 | { 2 | "constants": { 3 | "SHORTCUT": "sly", 4 | "PREFIX": "data-sly-", 5 | "BEAN_DECL": "data-sly-use", 6 | "LIST": { 7 | "DECL": "data-sly-list", 8 | "CLASS": { 9 | "members": [ 10 | { 11 | "name": "index" 12 | }, 13 | { 14 | "name": "count" 15 | }, 16 | { 17 | "name": "first" 18 | }, 19 | { 20 | "name": "middle" 21 | }, 22 | { 23 | "name": "last" 24 | }, 25 | { 26 | "name": "odd" 27 | }, 28 | { 29 | "name": "even" 30 | } 31 | ] 32 | }, 33 | "DEFAULT_NAME": "item" 34 | }, 35 | "REPEAT": { 36 | "DECL": "data-sly-repeat", 37 | "CLASS": { 38 | "members": [ 39 | { 40 | "name": "index" 41 | }, 42 | { 43 | "name": "count" 44 | }, 45 | { 46 | "name": "first" 47 | }, 48 | { 49 | "name": "middle" 50 | }, 51 | { 52 | "name": "last" 53 | }, 54 | { 55 | "name": "odd" 56 | }, 57 | { 58 | "name": "even" 59 | } 60 | ] 61 | }, 62 | "DEFAULT_NAME": "item" 63 | }, 64 | "EXPR_START": "${", 65 | "EXPR_END": "}", 66 | "EXPR_REGEX": "\\$\\{.*\\}", 67 | "VALUE_REGEX": "'.*'|\".*\"|true|false|[0-9]+", 68 | "OPERATOR_REGEX": "&&|@|<|>|<=|>=|\\?|:|\\|\\||\\!", 69 | "ATTRIBUTE_NAME_REGEX": "data-sly-[a-zA-Z\\._]+", 70 | "COMPLETION": { 71 | "EXPR": "\"${|}\"", 72 | "STATIC": "\"|\"" 73 | }, 74 | "LOCAL_BEAN_JS": { 75 | "REGEX": ".*\\.js$", 76 | "RETURN_OBJECT_REGEXP": "return[ \\s\\n]*\\{" 77 | }, 78 | "LOCAL_BEAN_JAVA": { 79 | "REGEX": ".*\\.java$" 80 | }, 81 | "COMPLETION_CURSOR_POS": "|", 82 | "TOKEN_START": "{ '\"&|![", 83 | "MEMBER_START": ".", 84 | "DECL_START": ".", 85 | "EXTENSIONS": [ 86 | "html", 87 | "sly" 88 | ], 89 | "DEFAULT_SERVER_URL": "http://localhost:4502", 90 | "DEFAULT_USER": "admin", 91 | "DEFAULT_PASSWORD": "admin", 92 | "DEFAULT_AUTO_SYNC": false 93 | }, 94 | "attributes": { 95 | "data-sly-attribute": { 96 | "type": "EXPR" 97 | }, 98 | "data-sly-call": { 99 | "type": "EXPR", 100 | "mandatory": true 101 | }, 102 | "data-sly-element": { 103 | "type": "EXPR", 104 | "mandatory": true 105 | }, 106 | "data-sly-include": { 107 | "type": "EXPR", 108 | "mandatory": true 109 | }, 110 | "data-sly-list": { 111 | "type": "EXPR" 112 | }, 113 | "data-sly-repeat": { 114 | "type": "EXPR" 115 | }, 116 | "data-sly-resource": { 117 | "type": "EXPR", 118 | "mandatory": true 119 | }, 120 | "data-sly-test": { 121 | "type": "EXPR" 122 | }, 123 | "data-sly-text": { 124 | "type": "EXPR", 125 | "mandatory": true 126 | }, 127 | "data-sly-template": { 128 | "type": "EXPR", 129 | "mandatory": true, 130 | "identifier": true 131 | }, 132 | "data-sly-use": { 133 | "type": "STATIC", 134 | "mandatory": true, 135 | "identifier": true 136 | }, 137 | "data-sly-unwrap": { 138 | "type": "NONE" 139 | } 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /sly/node/VaultIgnore.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved. 3 | * 4 | * Licensed under the Apache License 2.0. 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | ******************************************************************************/ 7 | (function () { 8 | 9 | /** 10 | * Compiles the positive and negative patterns from the contents of a file containing .vltignore rules. 11 | * @param content the contents of the file 12 | * @returns {{accepts: accepts, denies: denies}} 13 | */ 14 | function compile(content) { 15 | var parsed = exports.parse(content), 16 | positives = parsed[0], 17 | negatives = parsed[1]; 18 | return { 19 | accepts: function (input) { 20 | if (input[0] === '/') input[0] = input[0].slice(1); 21 | return negatives.test(input) || !positives.test(input); 22 | }, 23 | denies: function (input) { 24 | return !this.accepts(input); 25 | } 26 | }; 27 | } 28 | 29 | /** 30 | * Parses the contents of a file containing .vltignore rules, transforming them into regular expressions. 31 | * @param content the contents of the file 32 | * @returns {Array.} an array with two elements: the positives regex at position 0, the negatives regex at position 1 33 | */ 34 | function parse(content) { 35 | return content.split('\n') 36 | .map( 37 | function (line) { 38 | line = line.trim(); 39 | return line; 40 | } 41 | ).filter( 42 | function (line) { 43 | return line && line[0] !== '#'; 44 | } 45 | ).reduce( 46 | function (lists, line) { 47 | var isNegative = line[0] === '!'; 48 | if (isNegative) { 49 | line = line.slice(1); 50 | } 51 | if (isNegative) { 52 | lists[1].push(line); 53 | } else { 54 | lists[0].push(line); 55 | } 56 | return lists; 57 | }, 58 | [ 59 | [], 60 | [] 61 | ] 62 | ).map( 63 | function (list) { 64 | return list 65 | .sort() 66 | .map(_prepareRegexPattern); 67 | } 68 | ).map( 69 | function (patternsArray) { 70 | return new RegExp('^((' + patternsArray.join(')|(') + '))$'); 71 | } 72 | ); 73 | } 74 | 75 | function _prepareRegexPattern(pattern) { 76 | var preparedPattern = _escapeRegex(pattern).replace('**', '(.+)').replace('*', '([^\\/]*)'); 77 | if (pattern.indexOf('*.') === 0) { 78 | preparedPattern = '(.*\/)?(' + preparedPattern + ')'; 79 | } else if (pattern.indexOf('/') === 0) { 80 | // remove escaped forward slash 81 | preparedPattern = '(' + preparedPattern.slice(2) + ')(\/.*)?'; 82 | } else if (pattern.indexOf('/') === -1) { 83 | preparedPattern = '(.*\/)?' + preparedPattern + '(\/.*)?'; 84 | } 85 | return preparedPattern; 86 | } 87 | 88 | function _escapeRegex(pattern) { 89 | return pattern.replace(/[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g, "\\$&"); 90 | } 91 | 92 | exports.compile = compile; 93 | exports.parse = parse; 94 | 95 | }()); 96 | -------------------------------------------------------------------------------- /sly/node/Filter.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved. 3 | * 4 | * Licensed under the Apache License 2.0. 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | ******************************************************************************/ 7 | (function (){ 8 | 'use strict'; 9 | 10 | var FilterRule = require('./FilterRule'), 11 | Constants = require('./Constants'), 12 | FilterAction = { 13 | INCLUDE : 'include', 14 | EXCLUDE : 'exclude' 15 | }; 16 | 17 | /** 18 | * A Filter represents a single 'filter' entry from an Apache Jackrabbit FileVault filter-vlt.xml / filter.xml file, that 19 | * describes how the content of a root path should be treated with regards to importing it into a content repository. 20 | * 21 | * @param {String} root the filter's root path 22 | * @param {FilterRule[]} rules the 'include' / 'exclude' rules 23 | * @constructor 24 | */ 25 | function Filter(root, rules) { 26 | this.root = root; 27 | this.rules = rules; 28 | this._action = _getDefaultAction(rules); 29 | } 30 | 31 | /** 32 | * Checks if a path belonging to a jcr_root can be synced according to this filter or not. 33 | * 34 | * @param {String} path the path to check 35 | * @returns {Number} see {@link Constants} 36 | */ 37 | Filter.prototype.getSyncStatus = function (path) { 38 | var shouldSync = Constants.sync.FILTER_IGNORED, 39 | i; 40 | if (_startsWith(path, this.root)) { 41 | var matchedRulePattern = false; 42 | for (i = 0; i < this.rules.length; i++) { 43 | var rule = this.rules[i]; 44 | if (rule.pattern.test(path)) { 45 | matchedRulePattern = true; 46 | if (rule.type === FilterRule.INCLUDE_RULE) { 47 | shouldSync = Constants.sync.FILTER_INCLUDED; 48 | } else if (rule.type === FilterRule.EXCLUDE_RULE) { 49 | shouldSync = Constants.sync.FILTER_EXCLUDED; 50 | } 51 | } 52 | } 53 | if (!matchedRulePattern) { 54 | if (this._action === FilterAction.INCLUDE) { 55 | shouldSync = Constants.sync.FILTER_INCLUDED; 56 | } else if (this._action === FilterAction.EXCLUDE) { 57 | shouldSync = Constants.sync.FILTER_EXCLUDED; 58 | } 59 | } 60 | } 61 | return shouldSync; 62 | }; 63 | 64 | /** 65 | * Checks if string starts with prefix. 66 | * 67 | * @param {String} string the string 68 | * @param {String} prefix the prefix 69 | * @returns {boolean} true if the string starts with prefix, false otherwise 70 | * @private 71 | */ 72 | function _startsWith(string, prefix) { 73 | return string.indexOf(prefix) === 0; 74 | } 75 | 76 | /** 77 | * Analyses the filter's rules and returns its default action. 78 | * 79 | * @param {FilterRule[]} rules the filter's rules 80 | * @returns {String} the filter's action 81 | * @private 82 | */ 83 | function _getDefaultAction(rules) { 84 | if (rules && rules.length && rules.length > 0) { 85 | var firstRule = rules[0]; 86 | if (firstRule.type === FilterRule.INCLUDE_RULE) { 87 | return FilterAction.EXCLUDE; 88 | } else if (firstRule.type === FilterRule.EXCLUDE_RULE) { 89 | return FilterAction.INCLUDE; 90 | } 91 | } 92 | return FilterAction.INCLUDE; 93 | } 94 | 95 | module.exports = Filter; 96 | }()); -------------------------------------------------------------------------------- /sly/nls/root/strings.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved. 3 | * 4 | * Licensed under the Apache License 2.0. 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | ******************************************************************************/ 7 | /*global define*/ 8 | define({ 9 | AEM_SLY_EXTENSION : 'AEM Sightly Extension', 10 | 11 | // Button labels 12 | BUTTON_OK : 'OK', 13 | BUTTON_CANCEL : 'Cancel', 14 | 15 | // Menus 16 | // -- top level 17 | MENU_PROJECT_SETTINGS : 'Project Settings...', 18 | MENU_EXPORT_CONTENT_PACKAGE : 'Export Content Package to Server', 19 | MENU_IMPORT_CONTENT_PACKAGE : 'Import Content Package from Server', 20 | 21 | // -- contextual menus 22 | CONTEXTUAL_PULL_REMOTE : 'Import from Server', 23 | CONTEXTUAL_PUSH_REMOTE : 'Export to Server', 24 | CONTEXTUAL_OPEN_REMOTE : 'Open on Server', 25 | 26 | // Project Settings dialogue 27 | PROJECT_SETTINGS : 'Project Settings', 28 | PROJECT_SETTING_SERVER_URL : 'Server URL', 29 | PROJECT_SETTING_REMOTE_USER : 'Username', 30 | PROJECT_SETTING_REMOTE_USER_PASSWORD : 'Password', 31 | PROJECT_SETTING_AUTO_SYNC : 'Automatically synchronize file-system changes to server', 32 | PROJECT_SETTING_SERVER_URL_HINT : 'http://localhost:4502', 33 | PROJECT_SETTING_REMOTE_USER_HINT : 'admin', 34 | PROJECT_SYNCHRONISATION_SETTINGS : 'Synchronization Settings', 35 | PROJECT_SETTING_SERVER_URL_ERROR_MISSING : 'Please provide a server URL.', 36 | PROJECT_SETTING_SERVER_URL_ERROR_INVALID_PROTOCOL: 'Invalid protocol used for the server URL.', 37 | PROJECT_SETTING_SERVER_URL_ERROR_UNKNOWN : 'Unknown error: server URL.', 38 | PROJECT_SETTING_SERVER_URL_ERROR_INVALID_CHAR : 'Special characters like \'{0}\' must be %-encoded.', 39 | PROJECT_SETTING_REMOTE_USER_ERROR_EMPTY : 'Please provide a username.', 40 | PROJECT_SETTING_REMOTE_USER_PASSWORD_ERROR_EMPTY : 'Please provide a password.', 41 | PROJECT_SETTING_ACCEPT_SELF_SIGNED_CERTIFICATES : 'Accept self-signed certificates for HTTPS', 42 | 43 | // Synchronisation indicator tooltip 44 | SYNC_FULL : 'All selected files were synced successfully.', 45 | SYNC_PARTIAL : 'Some of the selected files were not synced successfully.', 46 | SYNC_NONE : 'None of the selected files were synced.', 47 | SYNC_IN_PROGRESS : 'Your selected files are synchronizing.', 48 | 49 | // Synchronisation report dialogue 50 | SYNC_STATUS : 'Synchronization Status', 51 | SYNC_STATUS_TH_FILE : 'Entry', 52 | SYNC_STATUS_TH_STATUS : 'Synchronization Status', 53 | SYNC_STATUS_TH_TIME : 'Time', 54 | SYNC_STATUS_IMPORTED : 'imported', 55 | SYNC_STATUS_EXPORTED : 'exported', 56 | SYNC_STATUS_IGNORED : 'ignored by the filter configuration', 57 | SYNC_STATUS_EXCLUDED : 'excluded by the filter configuration', 58 | SYNC_STATUS_EXCLUDED_VLT : 'vlt file or file excluded by .vltignore pattern', 59 | SYNC_STATUS_DELETED_FROM_REMOTE : 'removed - the file was deleted on the server', 60 | 61 | // Synchronization panel 62 | SYNC_PANEL_CLEAR : 'Clear results' 63 | 64 | }); 65 | -------------------------------------------------------------------------------- /sly/nls/en-gb/strings.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved. 3 | * 4 | * Licensed under the Apache License 2.0. 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | ******************************************************************************/ 7 | /*global define*/ 8 | define({ 9 | AEM_SLY_EXTENSION : 'AEM Sightly Extension', 10 | 11 | // Button labels 12 | BUTTON_OK : 'OK', 13 | BUTTON_CANCEL : 'Cancel', 14 | 15 | // Menus 16 | // -- top level 17 | MENU_PROJECT_SETTINGS : 'Project Settings...', 18 | MENU_EXPORT_CONTENT_PACKAGE : 'Export Content Package to Server', 19 | MENU_IMPORT_CONTENT_PACKAGE : 'Import Content Package from Server', 20 | 21 | // -- contextual menus 22 | CONTEXTUAL_PULL_REMOTE : 'Import from Server', 23 | CONTEXTUAL_PUSH_REMOTE : 'Export to Server', 24 | CONTEXTUAL_OPEN_REMOTE : 'Open on Server', 25 | 26 | // Project Settings dialogue 27 | PROJECT_SETTINGS : 'Project Settings', 28 | PROJECT_SETTING_SERVER_URL : 'Server URL', 29 | PROJECT_SETTING_REMOTE_USER : 'Username', 30 | PROJECT_SETTING_REMOTE_USER_PASSWORD : 'Password', 31 | PROJECT_SETTING_AUTO_SYNC : 'Automatically synchronise file-system changes to server', 32 | PROJECT_SETTING_SERVER_URL_HINT : 'http://localhost:4502', 33 | PROJECT_SETTING_REMOTE_USER_HINT : 'admin', 34 | PROJECT_SYNCHRONISATION_SETTINGS : 'Synchronisation Settings', 35 | PROJECT_SETTING_SERVER_URL_ERROR_MISSING : 'Please provide a server URL.', 36 | PROJECT_SETTING_SERVER_URL_ERROR_INVALID_PROTOCOL: 'Invalid protocol used for the server URL.', 37 | PROJECT_SETTING_SERVER_URL_ERROR_UNKNOWN : 'Unknown error: server URL.', 38 | PROJECT_SETTING_SERVER_URL_ERROR_INVALID_CHAR : 'Special characters like \'{0}\' must be %-encoded.', 39 | PROJECT_SETTING_REMOTE_USER_ERROR_EMPTY : 'Please provide a username.', 40 | PROJECT_SETTING_REMOTE_USER_PASSWORD_ERROR_EMPTY : 'Please provide a password.', 41 | PROJECT_SETTING_ACCEPT_SELF_SIGNED_CERTIFICATES : 'Accept self-signed certificates for HTTPS', 42 | 43 | // Synchronisation indicator tooltip 44 | SYNC_FULL : 'All selected files were synced successfully.', 45 | SYNC_PARTIAL : 'Some of the selected files were not synced successfully.', 46 | SYNC_NONE : 'None of the selected files were synced.', 47 | SYNC_IN_PROGRESS : 'Your selected files are synchronising.', 48 | 49 | // Synchronisation report dialogue 50 | SYNC_STATUS : 'Synchronisation Status', 51 | SYNC_STATUS_TH_FILE : 'Entry', 52 | SYNC_STATUS_TH_STATUS : 'Synchronisation Status', 53 | SYNC_STATUS_TH_TIME : 'Time', 54 | SYNC_STATUS_IMPORTED : 'imported', 55 | SYNC_STATUS_EXPORTED : 'exported', 56 | SYNC_STATUS_IGNORED : 'ignored by the filter configuration', 57 | SYNC_STATUS_EXCLUDED : 'excluded by the filter configuration', 58 | SYNC_STATUS_EXCLUDED_VLT : 'vlt file or file excluded by .vltignore pattern', 59 | SYNC_STATUS_DELETED_FROM_REMOTE : 'removed - the file was deleted on the server', 60 | 61 | // Synchronization panel 62 | SYNC_PANEL_CLEAR : 'Clear results' 63 | 64 | }); 65 | -------------------------------------------------------------------------------- /sly/nls/ro/strings.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved. 3 | * 4 | * Licensed under the Apache License 2.0. 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | ******************************************************************************/ 7 | /*global define*/ 8 | define({ 9 | AEM_SLY_EXTENSION : 'AEM Sightly Extension', 10 | 11 | // Button labels 12 | BUTTON_OK : 'OK', 13 | BUTTON_CANCEL : 'Revocare', 14 | 15 | // Menus 16 | // -- top level 17 | MENU_PROJECT_SETTINGS : 'Setările Proiectului...', 18 | MENU_EXPORT_CONTENT_PACKAGE : 'Exportați Content Package-ul pe Server', 19 | MENU_IMPORT_CONTENT_PACKAGE : 'Importați Content Package-ul de pe Server', 20 | 21 | // -- contextual menus 22 | CONTEXTUAL_PULL_REMOTE : 'Importați de pe Server', 23 | CONTEXTUAL_PUSH_REMOTE : 'Exportați pe Server', 24 | CONTEXTUAL_OPEN_REMOTE : 'Deschideți pe Server', 25 | 26 | // Project Settings dialogue 27 | PROJECT_SETTINGS : 'Setările Proiectului', 28 | PROJECT_SETTING_SERVER_URL : 'URL Server', 29 | PROJECT_SETTING_REMOTE_USER : 'Utilizator', 30 | PROJECT_SETTING_REMOTE_USER_PASSWORD : 'Parolă', 31 | PROJECT_SETTING_AUTO_SYNC : 'Sincronizare automată a schimbărilor de pe disc către server', 32 | PROJECT_SETTING_SERVER_URL_HINT : 'http://localhost:4502', 33 | PROJECT_SETTING_REMOTE_USER_HINT : 'admin', 34 | PROJECT_SYNCHRONISATION_SETTINGS : 'Setări de Sincronizare', 35 | PROJECT_SETTING_SERVER_URL_ERROR_MISSING : 'Vă rugăm să introduceți URL-ul serverului.', 36 | PROJECT_SETTING_SERVER_URL_ERROR_INVALID_PROTOCOL: 'URL-ul serverului are un protocol invalid.', 37 | PROJECT_SETTING_SERVER_URL_ERROR_UNKNOWN : 'Eroare necunoscută: URL Server.', 38 | PROJECT_SETTING_SERVER_URL_ERROR_INVALID_CHAR : 'Caracterele speciale precum \'{0}\' trebuie să fie %-codificate.', 39 | PROJECT_SETTING_REMOTE_USER_ERROR_EMPTY : 'Vă rugăm să introduceți utilizatorul.', 40 | PROJECT_SETTING_REMOTE_USER_PASSWORD_ERROR_EMPTY : 'Vă rugăm să introduceți parola.', 41 | PROJECT_SETTING_ACCEPT_SELF_SIGNED_CERTIFICATES : 'Acceptați certificate care nu sunt semnate de CA', 42 | 43 | // Synchronisation indicator tooltip 44 | SYNC_FULL : 'Toate fișierele selectate au fost sincronizate cu succes.', 45 | SYNC_PARTIAL : 'Unele dintre fișierele selectate nu au fost sincronizate cu succes.', 46 | SYNC_NONE : 'Niciunul dintre fișierele selectate nu a fost sincronizat.', 47 | SYNC_IN_PROGRESS : 'Fișierele selectate de dumneavoastră se sincronizează.', 48 | 49 | // Synchronisation report dialogue 50 | SYNC_STATUS : 'Stare Sincronizare', 51 | SYNC_STATUS_TH_FILE : 'Fișier', 52 | SYNC_STATUS_TH_STATUS : 'Stare Sincronizare', 53 | SYNC_STATUS_TH_TIME : 'Timp', 54 | SYNC_STATUS_IMPORTED : 'importat', 55 | SYNC_STATUS_EXPORTED : 'exportat', 56 | SYNC_STATUS_IGNORED : 'ignorat de către configurarea filtrului', 57 | SYNC_STATUS_EXCLUDED : 'exclus de către configurarea filtrului', 58 | SYNC_STATUS_EXCLUDED_VLT : 'fișier vlt sau fișier exclus de către .vltignore', 59 | SYNC_STATUS_DELETED_FROM_REMOTE : 'șters - fișierul a fost șters pe server', 60 | 61 | // Synchronization panel 62 | SYNC_PANEL_CLEAR : 'Șterge rezultate' 63 | 64 | }); 65 | -------------------------------------------------------------------------------- /sly/preferences/project-settings-dialog.html: -------------------------------------------------------------------------------- 1 | {{!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | ~ Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved. 3 | ~ 4 | ~ Licensed under the Apache License 2.0. 5 | ~ http://www.apache.org/licenses/LICENSE-2.0 6 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--}} 7 | 55 | 76 | -------------------------------------------------------------------------------- /sly-tests/SightlyLanguageTest.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved. 3 | * 4 | * Licensed under the Apache License 2.0. 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | ******************************************************************************/ 7 | 8 | /**/ 9 | /* Sightly Language unit tests*/ 10 | /*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */ 11 | /*global brackets,define, $, jasmine, spyOn, describe, beforeFirst, afterLast, afterEach, it, runs, waitsFor, expect, waitsForDone */ 12 | 13 | define(function (require, exports, module) { 14 | "use strict"; 15 | var language = require("sly/SightlyLanguage"), 16 | SpecRunnerUtils = brackets.getModule("spec/SpecRunnerUtils"), 17 | FileUtils = brackets.getModule("file/FileUtils"), 18 | DocumentManager = brackets.getModule("document/DocumentManager"), 19 | SLYDefault = require("text!sly/bootstrap/default.json"), 20 | SLYCQ = require("text!sly/bootstrap/extensions/cq.json"), 21 | SLYSling = require("text!sly/bootstrap/extensions/sling.json"), 22 | defaultJSON = JSON.parse(SLYDefault), 23 | cqJSON = JSON.parse(SLYCQ), 24 | slingJSON = JSON.parse(SLYSling), 25 | SLYDictionnary = $.extend(true, defaultJSON, cqJSON, slingJSON); 26 | 27 | 28 | describe("Sightly Language", function () { 29 | language.load(SLYDictionnary); 30 | var resourcesPath = FileUtils.getNativeModuleDirectoryPath(module) + "/resources/"; 31 | 32 | it("registers all specified sightly extension as of html language"); 33 | it("extracts correctly a variable bean name from an attribute declaration, null if not or wrongly defined", function () { 34 | expect(language.extractBeanVarName("data-sly-use.blah")).toBe("blah"); 35 | expect(language.extractBeanVarName("data-sly-use.")).toBeNull(); 36 | expect(language.extractBeanVarName("data-sly-use")).toBeNull(); 37 | }); 38 | it("sends parsedSlyBlock event with open tag info & end position when parsing a tag block containing sly attributes"); 39 | it("sends parsedSlyOperator event with start and end of the operator when parsing an operator"); 40 | it("sends parsedSlyValue event with start and end of the value when parsing an value"); 41 | it("sends parsedSlyExpression event with start and end of the expression when parsing an expression"); 42 | it("sends correct number of event for a given file (parse)", function () { 43 | var promise, doc, 44 | parseTestPath = resourcesPath + "parse-test.sly", 45 | eventSpy = jasmine.createSpyObj("eventSpy", ['expr', 'operator', 'value', 'block']); 46 | $(language).on("parsedSlyExpression", eventSpy.expr); 47 | $(language).on("parsedSlyValue", eventSpy.value); 48 | $(language).on("parsedSlyOperator", eventSpy.operator); 49 | $(language).on("parsedSlyBlock", eventSpy.block); 50 | 51 | runs(function () { 52 | waitsForDone(DocumentManager.getDocumentForPath(parseTestPath).done(function (_doc) { 53 | doc = _doc; 54 | }), "get document"); 55 | }); 56 | 57 | runs(function () { 58 | expect(language.__testonly__parse(doc)).toBe(true); 59 | expect(eventSpy.expr.callCount).toBe(6); 60 | expect(eventSpy.value.callCount).toBe(4); 61 | expect(eventSpy.operator.callCount).toBe(3); 62 | expect(eventSpy.block.callCount).toBe(4); 63 | }); 64 | }); 65 | it("sends parsedSlyAttributeName with start & end of the attribute when parsing a line"); 66 | it("sends correct number of events when a line only is changed (propagateLineChanges)", function () { 67 | var promise, 68 | changedLine = "