diff --git a/.eslintrc.json b/.eslintrc.json
index 3a1f3cb..38a8d42 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -10,21 +10,29 @@
"html"
],
"rules": {
+ "padded-blocks": "off",
"brace-style": "off",
- "new-cap": ["error", { "capIsNewExceptions": ["Polymer"] }],
+ "new-cap": [
+ "error",
+ {
+ "capIsNewExceptions": ["Polymer"],
+ "capIsNewExceptionPattern": "^Etools.."
+ }
+ ],
"no-var": "off",
- "operator-linebreak": 1,
- "no-trailing-spaces": 1,
- "valid-jsdoc": 0,
- "camelcase": 1,
- "guard-for-in": 0,
- "comma-dangle": 0,
- "prefer-spread": 0,
- "linebreak-style": 0,
"require-jsdoc": "off",
- "max-len": ["error", 120, 4]
+ "valid-jsdoc": "off",
+ "comma-dangle": ["error", "never"],
+ "max-len": ["error", { "code": 120 }],
+ "camelcase": ["error", {"properties": "never"}],
+ "arrow-parens": [2, "as-needed", { "requireForBlockBody": true }]
},
"globals": {
- "Polymer": true
+ "moment": true,
+ "Promise": true,
+ "Polymer": true,
+ "EtoolsLogsLevel": true,
+ "EtoolsLogsMixin": true,
+ "_": true
}
-}
\ No newline at end of file
+}
diff --git a/README.md b/README.md
index 87ed475..7ab33a6 100644
--- a/README.md
+++ b/README.md
@@ -3,11 +3,10 @@
A collection of Polymer behaviors used in etools apps.
## Behaviors list
-### EtoolsLogsBehavior
+### EtoolsLogsMixin
Can be used to log errors, warnings and other info like this.
```javascript
-behaviors: [EtoolsLogsBehavior],
this.logError('some error msg...', null);
this.logWarn('some warning msg...', 'some page section');
@@ -30,7 +29,6 @@ To configure the logging level in your app config do this:
window.EtoolsLogsLevel = window.EtoolsLogsLevel || 'INFO';
```
-TODO: add other behaviors from PMP App
## Install
```bash
diff --git a/analysis.json b/analysis.json
new file mode 100644
index 0000000..137db28
--- /dev/null
+++ b/analysis.json
@@ -0,0 +1,411 @@
+{
+ "schema_version": "1.0.0",
+ "elements": [
+ {
+ "description": "",
+ "summary": "",
+ "path": "demo\\etools-behaviors-demo-helper.html",
+ "properties": [],
+ "methods": [
+ {
+ "name": "ready",
+ "description": "",
+ "privacy": "protected",
+ "sourceRange": {
+ "start": {
+ "line": 14,
+ "column": 6
+ },
+ "end": {
+ "line": 19,
+ "column": 7
+ }
+ },
+ "metadata": {},
+ "params": []
+ }
+ ],
+ "staticMethods": [],
+ "demos": [],
+ "metadata": {},
+ "sourceRange": {
+ "start": {
+ "line": 11,
+ "column": 4
+ },
+ "end": {
+ "line": 20,
+ "column": 5
+ }
+ },
+ "privacy": "public",
+ "superclass": "HTMLElement",
+ "name": "EtoolsBehaviorsDemoHelper",
+ "attributes": [],
+ "events": [],
+ "styling": {
+ "cssVariables": [],
+ "selectors": []
+ },
+ "slots": [],
+ "tagname": "etools-behaviors-demo-helper"
+ },
+ {
+ "description": "",
+ "summary": "",
+ "path": "demo\\etools-behaviors-demo-helper.html",
+ "properties": [],
+ "methods": [
+ {
+ "name": "ready",
+ "description": "",
+ "privacy": "protected",
+ "sourceRange": {
+ "start": {
+ "line": 39,
+ "column": 8
+ },
+ "end": {
+ "line": 44,
+ "column": 9
+ }
+ },
+ "metadata": {},
+ "params": []
+ }
+ ],
+ "staticMethods": [],
+ "demos": [],
+ "metadata": {},
+ "sourceRange": {
+ "start": {
+ "line": 36,
+ "column": 6
+ },
+ "end": {
+ "line": 45,
+ "column": 7
+ }
+ },
+ "privacy": "public",
+ "superclass": "HTMLElement",
+ "name": "DemoMixinFactory",
+ "attributes": [],
+ "events": [],
+ "styling": {
+ "cssVariables": [],
+ "selectors": []
+ },
+ "slots": [],
+ "tagname": "demo-mixin-factory"
+ }
+ ],
+ "mixins": [
+ {
+ "description": "Can be used to log errors, warnings and other info like this.\n\nEach method can have 3 args:\n- the message you want to log\n- a prefix for log message\n- additional data, anything\n\n## Available logging levels (the levels are cumulative)\n- OFF (default)\n- ERROR - only errors will be displayed\n- WARN - errors and warning will be displayed\n- INFO - errors, warning and info logs displayed\n\nTo configure the logging level in your app config do this:\nwindow.EtoolsLogsLevel = window.EtoolsLogsLevel || 'INFO';",
+ "summary": "",
+ "path": "etools-logs-mixin.html",
+ "properties": [
+ {
+ "name": "etoolsLogsLevel",
+ "type": "string",
+ "description": "Available log levels:\n OFF\n ERROR\n WARN\n INFO",
+ "privacy": "public",
+ "sourceRange": {
+ "start": {
+ "line": 35,
+ "column": 12
+ },
+ "end": {
+ "line": 38,
+ "column": 13
+ }
+ },
+ "metadata": {
+ "polymer": {}
+ },
+ "defaultValue": "\"\""
+ }
+ ],
+ "methods": [
+ {
+ "name": "_getLogLevel",
+ "description": "",
+ "privacy": "protected",
+ "sourceRange": {
+ "start": {
+ "line": 42,
+ "column": 6
+ },
+ "end": {
+ "line": 49,
+ "column": 7
+ }
+ },
+ "metadata": {},
+ "params": []
+ },
+ {
+ "name": "_initAndGetLogLevel",
+ "description": "",
+ "privacy": "protected",
+ "sourceRange": {
+ "start": {
+ "line": 51,
+ "column": 6
+ },
+ "end": {
+ "line": 56,
+ "column": 7
+ }
+ },
+ "metadata": {},
+ "params": [
+ {
+ "name": "forceLevelInit"
+ }
+ ]
+ },
+ {
+ "name": "_getEtoolsLogMessages",
+ "description": "",
+ "privacy": "protected",
+ "sourceRange": {
+ "start": {
+ "line": 58,
+ "column": 6
+ },
+ "end": {
+ "line": 67,
+ "column": 7
+ }
+ },
+ "metadata": {},
+ "params": [
+ {
+ "name": "logPrefix"
+ },
+ {
+ "name": "message"
+ },
+ {
+ "name": "messagePrefix"
+ }
+ ]
+ },
+ {
+ "name": "_canLog",
+ "description": "",
+ "privacy": "protected",
+ "sourceRange": {
+ "start": {
+ "line": 69,
+ "column": 6
+ },
+ "end": {
+ "line": 71,
+ "column": 7
+ }
+ },
+ "metadata": {},
+ "params": [
+ {
+ "name": "levels"
+ },
+ {
+ "name": "forceLevelInit"
+ }
+ ]
+ },
+ {
+ "name": "logError",
+ "description": "",
+ "privacy": "public",
+ "sourceRange": {
+ "start": {
+ "line": 73,
+ "column": 6
+ },
+ "end": {
+ "line": 77,
+ "column": 7
+ }
+ },
+ "metadata": {},
+ "params": [
+ {
+ "name": "message"
+ },
+ {
+ "name": "messagePrefix"
+ },
+ {
+ "name": "other"
+ },
+ {
+ "name": "forceLevelInit"
+ }
+ ]
+ },
+ {
+ "name": "logWarn",
+ "description": "",
+ "privacy": "public",
+ "sourceRange": {
+ "start": {
+ "line": 79,
+ "column": 6
+ },
+ "end": {
+ "line": 83,
+ "column": 7
+ }
+ },
+ "metadata": {},
+ "params": [
+ {
+ "name": "message"
+ },
+ {
+ "name": "messagePrefix"
+ },
+ {
+ "name": "other"
+ },
+ {
+ "name": "forceLevelInit"
+ }
+ ]
+ },
+ {
+ "name": "logInfo",
+ "description": "",
+ "privacy": "public",
+ "sourceRange": {
+ "start": {
+ "line": 85,
+ "column": 6
+ },
+ "end": {
+ "line": 89,
+ "column": 7
+ }
+ },
+ "metadata": {},
+ "params": [
+ {
+ "name": "message"
+ },
+ {
+ "name": "messagePrefix"
+ },
+ {
+ "name": "other"
+ },
+ {
+ "name": "forceLevelInit"
+ }
+ ]
+ }
+ ],
+ "staticMethods": [],
+ "demos": [
+ {
+ "url": "demo/demo-logs.html",
+ "description": ""
+ }
+ ],
+ "metadata": {},
+ "sourceRange": {
+ "start": {
+ "line": 24,
+ "column": 4
+ },
+ "end": {
+ "line": 90,
+ "column": 7
+ }
+ },
+ "privacy": "public",
+ "name": "EtoolsLogsMixin",
+ "attributes": [
+ {
+ "name": "etools-logs-level",
+ "description": "Available log levels:\n OFF\n ERROR\n WARN\n INFO",
+ "sourceRange": {
+ "start": {
+ "line": 35,
+ "column": 12
+ },
+ "end": {
+ "line": 38,
+ "column": 13
+ }
+ },
+ "metadata": {},
+ "type": "string"
+ }
+ ],
+ "events": [],
+ "styling": {
+ "cssVariables": [],
+ "selectors": []
+ },
+ "slots": []
+ }
+ ],
+ "classes": [
+ {
+ "description": "Offers easier syntax for applying multiple mixins",
+ "summary": "",
+ "path": "etools-mixin-factory.html",
+ "properties": [],
+ "methods": [
+ {
+ "name": "combineMixins",
+ "description": "",
+ "privacy": "public",
+ "sourceRange": {
+ "start": {
+ "line": 5,
+ "column": 6
+ },
+ "end": {
+ "line": 21,
+ "column": 7
+ }
+ },
+ "metadata": {},
+ "params": [
+ {
+ "name": "mixinsArray"
+ },
+ {
+ "name": "superClass"
+ }
+ ]
+ }
+ ],
+ "staticMethods": [],
+ "demos": [
+ {
+ "url": "demo/demo-mixin-factory.html",
+ "description": ""
+ }
+ ],
+ "metadata": {},
+ "sourceRange": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 22,
+ "column": 5
+ }
+ },
+ "privacy": "public",
+ "name": "EtoolsMixinFactory"
+ }
+ ]
+}
diff --git a/bower.json b/bower.json
index 45073b4..969dc64 100644
--- a/bower.json
+++ b/bower.json
@@ -1,16 +1,16 @@
{
"name": "etools-behaviors",
"description": "Common behaviors",
- "version": "1.0.3",
+ "version": "2.0.0",
"license": "https://github.com/unicef-polymer/etools-behaviors/blob/master/LICENSE.md",
"main": "etools-behaviors-demo-helper",
"dependencies": {
- "polymer": "Polymer/polymer#^1.4.0"
+ "polymer": "Polymer/polymer#^2.0.0"
},
"devDependencies": {
- "iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
- "iron-demo-helpers": "PolymerElements/iron-demo-helpers#^1.0.0",
- "web-component-tester": "^4.0.0",
- "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
+ "iron-component-page": "PolymerElements/iron-component-page#^3.0.0",
+ "web-component-tester": "^6.0.0",
+ "webcomponentsjs": "webcomponents/webcomponentsjs#^1.0.0",
+ "paper-styles": "PolymerElements/paper-styles#^2.0.0"
}
}
diff --git a/demo/demo-helper.html b/demo/demo-helper.html
deleted file mode 100644
index 366eef9..0000000
--- a/demo/demo-helper.html
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
Check browser console
-