ember-style-modifier 0.5.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,226 @@
1
+ # This file was autogenerated by create-github-actions-setup-for-ember-addons.
2
+ #
3
+ # You can upgrade the GitHub Actions workflow to the latest blueprints used
4
+ # by Create GitHub Actions setup for Ember Addons by running it again:
5
+ #
6
+ # - `yarn create github-actions-setup-for-ember-addons` if using yarn and
7
+ # - `npm init github-actions-setup-for-ember-addons` if using NPM.
8
+ #
9
+ # See https://github.com/jelhan/create-github-actions-setup-for-ember-addon for
10
+ # details.
11
+ #
12
+ # The following lines contain the configuration used in the last run. Please do
13
+ # not change them. Doing so could break upgrade flow.
14
+ #
15
+ #$ browsers:
16
+ #$ - chrome
17
+ #$ emberTryScenarios:
18
+ #$ - scenario: ember-lts-3.24
19
+ #$ - scenario: ember-lts-3.28
20
+ #$ - scenario: ember-release
21
+ #$ - scenario: ember-beta
22
+ #$ - scenario: ember-canary
23
+ #$ - scenario: ember-default-with-jquery
24
+ #$ - scenario: ember-classic
25
+ #$ - scenario: no-deprecations
26
+ #$ - scenario: ember-release-no-deprecations
27
+ #$ - scenario: embroider-safe
28
+ #$ - scenario: embroider-optimized
29
+ #$ nodeVersion: 12.x
30
+ #$ packageManager: yarn
31
+ #
32
+
33
+ name: CI
34
+
35
+ on:
36
+ push:
37
+ branches:
38
+ - master
39
+ pull_request:
40
+
41
+ env:
42
+ NODE_VERSION: '12.x'
43
+
44
+ jobs:
45
+ lint:
46
+ name: Lint
47
+ runs-on: ubuntu-latest
48
+ steps:
49
+ - uses: actions/checkout@v3
50
+ with:
51
+ fetch-depth: 1
52
+
53
+ - uses: actions/setup-node@v2-beta
54
+ with:
55
+ node-version: '${{ env.NODE_VERSION }}'
56
+
57
+ - name: Get package manager's global cache path
58
+ id: global-cache-dir-path
59
+ run: echo "::set-output name=dir::$(yarn cache dir)"
60
+
61
+ - name: Cache package manager's global cache and node_modules
62
+ id: cache-dependencies
63
+ uses: actions/cache@v3
64
+ with:
65
+ path: |
66
+ ${{ steps.global-cache-dir-path.outputs.dir }}
67
+ node_modules
68
+ key: ${{ runner.os }}-${{ matrix.node-version }}-${{
69
+ hashFiles('**/yarn.lock'
70
+ ) }}
71
+ restore-keys: |
72
+ ${{ runner.os }}-${{ matrix.node-version }}-
73
+
74
+ - name: Install Dependencies
75
+ run: yarn install --frozen-lockfile
76
+ if: |
77
+ steps.cache-dependencies.outputs.cache-hit != 'true'
78
+
79
+ - name: Lint
80
+ run: yarn lint
81
+
82
+
83
+ test:
84
+ name: Tests
85
+ runs-on: ${{ matrix.os }}
86
+ needs: lint
87
+
88
+ strategy:
89
+ matrix:
90
+ os: [ubuntu-latest]
91
+ browser: [chrome]
92
+
93
+ steps:
94
+ - uses: actions/checkout@v3
95
+ with:
96
+ fetch-depth: 1
97
+
98
+ - uses: actions/setup-node@v2-beta
99
+ with:
100
+ node-version: '${{ env.NODE_VERSION }}'
101
+
102
+ - name: Get package manager's global cache path
103
+ id: global-cache-dir-path
104
+ run: echo "::set-output name=dir::$(yarn cache dir)"
105
+
106
+ - name: Cache package manager's global cache and node_modules
107
+ id: cache-dependencies
108
+ uses: actions/cache@v3
109
+ with:
110
+ path: |
111
+ ${{ steps.global-cache-dir-path.outputs.dir }}
112
+ node_modules
113
+ key: ${{ runner.os }}-${{ matrix.node-version }}-${{
114
+ hashFiles('**/yarn.lock'
115
+ ) }}
116
+ restore-keys: |
117
+ ${{ runner.os }}-${{ matrix.node-version }}-
118
+
119
+ - name: Install Dependencies
120
+ run: yarn install --frozen-lockfile
121
+ if: |
122
+ steps.cache-dependencies.outputs.cache-hit != 'true'
123
+
124
+ - name: Test
125
+ run: yarn test:ember --launch ${{ matrix.browser }}
126
+
127
+
128
+ floating-dependencies:
129
+ name: Floating Dependencies
130
+ runs-on: ${{ matrix.os }}
131
+ needs: lint
132
+
133
+ strategy:
134
+ matrix:
135
+ os: [ubuntu-latest]
136
+ browser: [chrome]
137
+
138
+ steps:
139
+ - uses: actions/checkout@v3
140
+ with:
141
+ fetch-depth: 1
142
+
143
+ - uses: actions/setup-node@v2-beta
144
+ with:
145
+ node-version: '${{ env.NODE_VERSION }}'
146
+
147
+ - name: Get package manager's global cache path
148
+ id: global-cache-dir-path
149
+ run: echo "::set-output name=dir::$(yarn cache dir)"
150
+
151
+ - name: Cache package manager's global cache and node_modules
152
+ id: cache-dependencies
153
+ uses: actions/cache@v3
154
+ with:
155
+ path: |
156
+ ${{ steps.global-cache-dir-path.outputs.dir }}
157
+ node_modules
158
+ key: ${{ runner.os }}-${{ matrix.node-version }}-floating-deps
159
+ restore-keys: |
160
+ ${{ runner.os }}-${{ matrix.node-version }}-
161
+
162
+ - name: Install Dependencies
163
+ run: yarn install --no-lockfile --non-interactive
164
+
165
+ - name: Test
166
+ run: yarn test:ember --launch ${{ matrix.browser }}
167
+
168
+
169
+ try-scenarios:
170
+ name: Tests - ${{ matrix.ember-try-scenario }}
171
+ runs-on: ubuntu-latest
172
+ continue-on-error: true
173
+ needs: test
174
+
175
+ strategy:
176
+ fail-fast: true
177
+ matrix:
178
+ ember-try-scenario: [
179
+ ember-lts-3.24,
180
+ ember-lts-3.28,
181
+ ember-release,
182
+ ember-beta,
183
+ ember-canary,
184
+ ember-default-with-jquery,
185
+ ember-classic,
186
+ no-deprecations,
187
+ ember-release-no-deprecations,
188
+ embroider-safe,
189
+ embroider-optimized
190
+ ]
191
+
192
+ steps:
193
+ - uses: actions/checkout@v3
194
+ with:
195
+ fetch-depth: 1
196
+
197
+ - uses: actions/setup-node@v2-beta
198
+ with:
199
+ node-version: '${{ env.NODE_VERSION }}'
200
+
201
+ - name: Get package manager's global cache path
202
+ id: global-cache-dir-path
203
+ run: echo "::set-output name=dir::$(yarn cache dir)"
204
+
205
+ - name: Cache package manager's global cache and node_modules
206
+ id: cache-dependencies
207
+ uses: actions/cache@v3
208
+ with:
209
+ path: |
210
+ ${{ steps.global-cache-dir-path.outputs.dir }}
211
+ node_modules
212
+ key: ${{ runner.os }}-${{ matrix.node-version }}-${{
213
+ hashFiles('**/yarn.lock'
214
+ ) }}
215
+ restore-keys: |
216
+ ${{ runner.os }}-${{ matrix.node-version }}-
217
+
218
+ - name: Install Dependencies
219
+ run: yarn install --frozen-lockfile
220
+ if: |
221
+ steps.cache-dependencies.outputs.cache-hit != 'true'
222
+
223
+ - name: Test
224
+ env:
225
+ EMBER_TRY_SCENARIO: ${{ matrix.ember-try-scenario }}
226
+ run: node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO
@@ -0,0 +1,14 @@
1
+ {
2
+ "git": {
3
+ "tagName": "v${version}"
4
+ },
5
+ "github": {
6
+ "release": true,
7
+ "tokenRef": "GITHUB_AUTH"
8
+ },
9
+ "plugins": {
10
+ "release-it-lerna-changelog": {
11
+ "infile": "CHANGELOG.md"
12
+ }
13
+ }
14
+ }
package/README.md CHANGED
@@ -9,7 +9,9 @@ This allows to set custom CSS of an element without requiring a [Content Securit
9
9
 
10
10
  ## Compatibility
11
11
 
12
- It supports the same versions as [`ember-modifier-manager-polyfill`](https://github.com/rwjblue/ember-modifier-manager-polyfill#compatibility) does.
12
+ * Ember.js v3.24 or above
13
+ * Ember CLI v3.24 or above
14
+ * Node.js v12 or above
13
15
 
14
16
  ## Installation
15
17
 
@@ -21,24 +21,24 @@ export default class StyleModifier extends Modifier {
21
21
  *
22
22
  * This data structure is slightly faster to process than an object / dictionary.
23
23
  */
24
- get styles() {
25
- const { positional, named } = this.args;
26
-
24
+ getStyles(positional, named) {
27
25
  // This is a workaround for the missing `Array#flat` in IE11.
28
26
  return [].concat(
29
- ...[...positional.filter(isObject), named].map(obj =>
27
+ ...[...positional.filter(isObject), named].map((obj) =>
30
28
  Object.entries(obj).map(([k, v]) => [dasherize(k), v])
31
29
  )
32
30
  );
33
31
  }
34
32
 
35
- setStyles(newStyles) {
33
+ setStyles(element, newStyles) {
36
34
  const rulesToRemove = this._oldStyles || new Set();
37
35
 
38
36
  newStyles.forEach(([property, value]) => {
39
37
  assert(
40
- `Your given value for property '${property}' is ${value} (${typeOf(value)}). ` +
41
- 'Accepted types are string and undefined. Please change accordingly.',
38
+ `Your given value for property '${property}' is ${value} (${typeOf(
39
+ value
40
+ )}). ` +
41
+ 'Accepted types are string and undefined. Please change accordingly.',
42
42
  typeof value === 'undefined' || typeOf(value) === 'string'
43
43
  );
44
44
 
@@ -54,22 +54,20 @@ export default class StyleModifier extends Modifier {
54
54
  property = dasherize(property);
55
55
 
56
56
  // update CSSOM
57
- this.element.style.setProperty(property, value, priority);
57
+ element.style.setProperty(property, value, priority);
58
58
 
59
59
  // should not remove rules that have been updated in this cycle
60
60
  rulesToRemove.delete(property);
61
61
  });
62
62
 
63
63
  // remove rules that were present in last cycle but aren't present in this one
64
- rulesToRemove.forEach(rule => this.element.style.removeProperty(rule));
64
+ rulesToRemove.forEach((rule) => element.style.removeProperty(rule));
65
65
 
66
66
  // cache styles that in this rendering cycle for the next one
67
- this._oldStyles = new Set(
68
- newStyles.map(e => e[0])
69
- );
67
+ this._oldStyles = new Set(newStyles.map((e) => e[0]));
70
68
  }
71
69
 
72
- didReceiveArguments() {
73
- this.setStyles(this.styles);
70
+ modify(element, positional, named) {
71
+ this.setStyles(element, this.getStyles(positional, named));
74
72
  }
75
73
  }
@@ -1,5 +1,5 @@
1
1
  'use strict';
2
2
 
3
- module.exports = function(/* environment, appConfig */) {
4
- return { };
3
+ module.exports = function (/* environment, appConfig */) {
4
+ return {};
5
5
  };
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use strict';
2
2
 
3
3
  module.exports = {
4
- name: require('./package').name
4
+ name: require('./package').name,
5
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-style-modifier",
3
- "version": "0.5.0",
3
+ "version": "0.8.0",
4
4
  "description": "{{style}} modifier to set an element's style using the CSSStyleDeclaration API.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -13,67 +13,75 @@
13
13
  "test": "tests"
14
14
  },
15
15
  "scripts": {
16
- "build": "ember build",
16
+ "build": "ember build --environment=production",
17
+ "lint": "npm-run-all --aggregate-output --continue-on-error --parallel \"lint:!(fix)\"",
18
+ "lint:fix": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*:fix",
17
19
  "lint:hbs": "ember-template-lint .",
18
- "lint:js": "eslint .",
20
+ "lint:hbs:fix": "ember-template-lint . --fix",
21
+ "lint:js": "eslint . --cache",
19
22
  "release": "release-it",
23
+ "lint:js:fix": "eslint . --fix",
20
24
  "start": "ember serve",
21
- "test": "ember test",
22
- "test:all": "ember try:each"
25
+ "test": "npm-run-all lint test:*",
26
+ "test:ember": "ember test",
27
+ "test:ember-compatibility": "ember try:each"
23
28
  },
24
29
  "dependencies": {
25
- "ember-cli-babel": "^7.11.1",
26
- "ember-modifier": "^1.0.2"
30
+ "ember-cli-babel": "^7.26.6",
31
+ "ember-modifier": "^3.2.7"
27
32
  },
28
33
  "devDependencies": {
29
- "@ember/optional-features": "^1.0.0",
30
- "babel-eslint": "^10.0.3",
34
+ "@ember/optional-features": "^2.0.0",
35
+ "@ember/test-helpers": "^2.4.2",
36
+ "@embroider/test-setup": "^1.0.0",
37
+ "@glimmer/component": "^1.0.4",
38
+ "@glimmer/tracking": "^1.0.4",
39
+ "babel-eslint": "^10.1.0",
31
40
  "broccoli-asset-rev": "^3.0.0",
32
- "ember-cli": "~3.14.0",
33
- "ember-cli-content-security-policy": "^1.1.1",
34
- "ember-cli-dependency-checker": "^3.1.0",
35
- "ember-cli-eslint": "^5.1.0",
36
- "ember-cli-htmlbars": "^4.0.5",
37
- "ember-cli-inject-live-reload": "^2.0.1",
41
+ "ember-auto-import": "^2.2.3",
42
+ "ember-cli": "~4.3.0",
43
+ "ember-cli-content-security-policy": "^2.0.0-1",
44
+ "ember-cli-dependency-checker": "^3.2.0",
45
+ "ember-cli-htmlbars": "^6.0.0",
46
+ "ember-cli-inject-live-reload": "^2.1.0",
38
47
  "ember-cli-sri": "^2.1.1",
39
- "ember-cli-template-lint": "^1.0.0-beta.3",
40
- "ember-cli-uglify": "^3.0.0",
48
+ "ember-cli-terser": "^4.0.2",
41
49
  "ember-disable-prototype-extensions": "^1.1.3",
42
- "ember-export-application-global": "^2.0.0",
43
- "ember-load-initializers": "^2.1.0",
44
- "ember-maybe-import-regenerator": "^0.1.6",
45
- "ember-qunit": "^4.5.1",
46
- "ember-resolver": "^5.3.0",
47
- "ember-source": "~3.14.1",
48
- "ember-source-channel-url": "^2.0.1",
49
- "ember-try": "^1.2.1",
50
- "eslint-plugin-ember": "^7.1.0",
51
- "eslint-plugin-node": "^10.0.0",
50
+ "ember-export-application-global": "^2.0.1",
51
+ "ember-load-initializers": "^2.1.2",
52
+ "ember-maybe-import-regenerator": "^1.0.0",
53
+ "ember-page-title": "^7.0.0",
54
+ "ember-qunit": "^5.1.4",
55
+ "ember-resolver": "^8.0.2",
56
+ "ember-source": "~3.28.0",
57
+ "ember-source-channel-url": "^3.0.0",
58
+ "ember-template-lint": "^3.6.0",
59
+ "ember-try": "^2.0.0",
60
+ "eslint": "^7.32.0",
61
+ "eslint-config-prettier": "^8.3.0",
62
+ "eslint-plugin-ember": "^10.5.4",
63
+ "eslint-plugin-node": "^11.1.0",
64
+ "eslint-plugin-prettier": "^4.0.0",
65
+ "eslint-plugin-qunit": "^7.0.0",
52
66
  "loader.js": "^4.7.0",
53
- "qunit-dom": "^0.9.0",
54
- "release-it": "^12.2.1",
55
- "release-it-lerna-changelog": "^1.0.3"
67
+ "npm-run-all": "^4.1.5",
68
+ "prettier": "^2.3.2",
69
+ "qunit": "^2.16.0",
70
+ "qunit-dom": "^2.0.0",
71
+ "release-it": "^14.0.0",
72
+ "release-it-lerna-changelog": "^4.0.0",
73
+ "webpack": "^5.60.0"
56
74
  },
57
75
  "engines": {
58
- "node": "8.* || 10.* || >= 12.*"
76
+ "node": "12.* || 14.* || >= 16"
59
77
  },
60
78
  "publishConfig": {
61
79
  "registry": "https://registry.npmjs.org"
62
80
  },
81
+ "ember": {
82
+ "edition": "octane"
83
+ },
63
84
  "ember-addon": {
64
85
  "configPath": "tests/dummy/config"
65
- },
66
- "release-it": {
67
- "plugins": {
68
- "release-it-lerna-changelog": {
69
- "infile": "CHANGELOG.md"
70
- }
71
- },
72
- "git": {
73
- "tagName": "v${version}"
74
- },
75
- "github": {
76
- "release": true
77
- }
78
86
  }
79
87
  }
package/renovate.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": [
3
+ "config:base"
4
+ ],
5
+ "rangeStrategy": "replace"
6
+ }
package/CHANGELOG.md DELETED
@@ -1,48 +0,0 @@
1
- Must provide GITHUB_AUTH
2
-
3
- ## v0.4.1 (2019-03-28)
4
-
5
- #### :rocket: Enhancement
6
- * [#10](https://github.com/jelhan/ember-style-modifier/pull/10) better assertion message for wrong value type ([@jelhan](https://github.com/jelhan))
7
-
8
- #### Committers: 1
9
- - Jeldrik Hanschke ([@jelhan](https://github.com/jelhan))
10
-
11
-
12
- ## v0.4.0 (2019-03-18)
13
-
14
- #### :house: Internal
15
- * [#8](https://github.com/jelhan/ember-style-modifier/pull/8) refactor: drop ember-functional-modifiers ([@buschtoens](https://github.com/buschtoens))
16
-
17
- #### Committers: 1
18
- - Jan Buschtöns ([@buschtoens](https://github.com/buschtoens))
19
-
20
-
21
- ## v0.3.0 (2019-03-13)
22
-
23
- #### :rocket: Enhancement
24
- * [#6](https://github.com/jelhan/ember-style-modifier/pull/6) support setting CSS rules using a POJO ([@jelhan](https://github.com/jelhan))
25
-
26
- #### Committers: 1
27
- - Jeldrik Hanschke ([@jelhan](https://github.com/jelhan))
28
-
29
-
30
- ## v0.2.0 (2019-03-12)
31
-
32
- #### :boom: Breaking Change
33
- * [#4](https://github.com/jelhan/ember-style-modifier/pull/4) support a more compact style for declaring CSS rules ([@jelhan](https://github.com/jelhan))
34
-
35
- #### :rocket: Enhancement
36
- * [#4](https://github.com/jelhan/ember-style-modifier/pull/4) support a more compact style for declaring CSS rules ([@jelhan](https://github.com/jelhan))
37
-
38
- #### Committers: 1
39
- - Jeldrik Hanschke ([@jelhan](https://github.com/jelhan))
40
-
41
-
42
- ## v0.1.0 (2019-03-11)
43
-
44
- Initial proof of concept
45
-
46
- #### Committers: 1
47
- - Jeldrik Hanschke ([@jelhan](https://github.com/jelhan))
48
- -
package/RELEASE.md DELETED
@@ -1,47 +0,0 @@
1
- # Release
2
-
3
- Releases are mostly automated using
4
- [release-it](https://github.com/release-it/release-it/) and
5
- [lerna-changelog](https://github.com/lerna/lerna-changelog/).
6
-
7
-
8
- ## Preparation
9
-
10
- Since the majority of the actual release process is automated, the primary
11
- remaining task prior to releasing is confirming that all pull requests that
12
- have been merged since the last release have been labeled with the appropriate
13
- `lerna-changelog` labels and the titles have been updated to ensure they
14
- represent something that would make sense to our users. Some great information
15
- on why this is important can be found at
16
- [keepachangelog.com](https://keepachangelog.com/en/1.0.0/), but the overall
17
- guiding principles here is that changelogs are for humans, not machines.
18
-
19
- When reviewing merged PR's the labels to be used are:
20
-
21
- * breaking - Used when the PR is considered a breaking change.
22
- * enhancement - Used when the PR adds a new feature or enhancement.
23
- * bug - Used when the PR fixes a bug included in a previous release.
24
- * documentation - Used when the PR adds or updates documentation.
25
- * internal - Used for internal changes that still require a mention in the
26
- changelog/release notes.
27
-
28
-
29
- ## Release
30
-
31
- Once the prep work is completed, the actual release is straight forward:
32
-
33
- * Firste ensure that you have installed the projects dependencies:
34
-
35
- ```
36
- yarn install
37
- ```
38
-
39
- * Than do your release:
40
-
41
- ```
42
- yarn release
43
- ```
44
-
45
- [release-it](https://github.com/release-it/release-it/) manages the actual
46
- release process. It will prompt you through the process of choosing the version
47
- number, tagging, pushing the tag and commits, etc.
package/config/release.js DELETED
@@ -1,21 +0,0 @@
1
- /* jshint node:true */
2
- // var RSVP = require('rsvp');
3
-
4
- // For details on each option run `ember help release`
5
- module.exports = {
6
- // local: true,
7
- // remote: 'some_remote',
8
- // annotation: "Release %@",
9
- // message: "Bumped version to %@",
10
- // manifest: [ 'package.json', 'bower.json', 'someconfig.json' ],
11
- // publish: true,
12
- // strategy: 'date',
13
- // format: 'YYYY-MM-DD',
14
- // timezone: 'America/Los_Angeles',
15
- //
16
- // beforeCommit: function(project, versions) {
17
- // return new RSVP.Promise(function(resolve, reject) {
18
- // // Do custom things here...
19
- // });
20
- // }
21
- };
package/jsconfig.json DELETED
@@ -1 +0,0 @@
1
- {"compilerOptions":{"target":"es6","experimentalDecorators":true},"exclude":["node_modules","bower_components","tmp","vendor",".git","dist"]}