ember-sortable 4.0.3 → 5.0.1
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.
- package/README.md +13 -7
- package/addon-main.js +2 -0
- package/dist/_app_/modifiers/sortable-group.js +1 -0
- package/dist/_app_/modifiers/sortable-handle.js +1 -0
- package/dist/_app_/modifiers/sortable-item.js +1 -0
- package/dist/_app_/services/ember-sortable-internal-state.js +1 -0
- package/dist/_rollupPluginBabelHelpers-839d0adb.js +63 -0
- package/dist/_rollupPluginBabelHelpers-839d0adb.js.map +1 -0
- package/{addon → dist}/modifiers/sortable-group.js +44 -111
- package/dist/modifiers/sortable-group.js.map +1 -0
- package/{addon → dist}/modifiers/sortable-handle.js +9 -3
- package/dist/modifiers/sortable-handle.js.map +1 -0
- package/{addon → dist}/modifiers/sortable-item.js +69 -151
- package/dist/modifiers/sortable-item.js.map +1 -0
- package/{addon/services/ember-sortable.js → dist/services/ember-sortable-internal-state.js} +22 -21
- package/dist/services/ember-sortable-internal-state.js.map +1 -0
- package/{addon → dist}/system/scroll-container.js +8 -7
- package/dist/system/scroll-container.js.map +1 -0
- package/{addon → dist}/system/scroll-parent.js +9 -7
- package/dist/system/scroll-parent.js.map +1 -0
- package/{addon-test-support → dist/test-support}/helpers/drag.js +13 -21
- package/dist/test-support/helpers/drag.js.map +1 -0
- package/{addon-test-support → dist/test-support}/helpers/reorder.js +11 -6
- package/dist/test-support/helpers/reorder.js.map +1 -0
- package/dist/test-support/index.js +5 -0
- package/dist/test-support/index.js.map +1 -0
- package/dist/test-support/utils/keyboard.js +33 -0
- package/dist/test-support/utils/keyboard.js.map +1 -0
- package/{addon-test-support → dist/test-support}/utils/offset.js +5 -3
- package/dist/test-support/utils/offset.js.map +1 -0
- package/dist/utils/constant.js +12 -0
- package/dist/utils/constant.js.map +1 -0
- package/{addon → dist}/utils/coordinate.js +5 -4
- package/dist/utils/coordinate.js.map +1 -0
- package/{addon → dist}/utils/css-calculation.js +5 -3
- package/dist/utils/css-calculation.js.map +1 -0
- package/{addon → dist}/utils/defaults.js +24 -12
- package/dist/utils/defaults.js.map +1 -0
- package/dist/utils/keyboard.js +33 -0
- package/dist/utils/keyboard.js.map +1 -0
- package/package.json +45 -65
- package/.huskyrc +0 -5
- package/CHANGELOG.md +0 -755
- package/CODE_OF_CONDUCT.md +0 -6
- package/MIGRATION_GUIDE_MODIFIERS.md +0 -95
- package/MIGRATION_GUIDE_V2.md +0 -120
- package/Makefile +0 -24
- package/RELEASE.md +0 -60
- package/V2_MIGRATION_RFC.md +0 -1100
- package/addon/utils/constant.js +0 -9
- package/addon/utils/keyboard.js +0 -32
- package/addon-test-support/helpers/index.js +0 -4
- package/addon-test-support/utils/keyboard.js +0 -32
- package/app/modifiers/sortable-group.js +0 -1
- package/app/modifiers/sortable-handle.js +0 -1
- package/app/modifiers/sortable-item.js +0 -1
- package/app/services/ember-sortable-internal-state.js +0 -1
- package/config/environment.js +0 -5
- package/demo.gif +0 -0
- package/index.js +0 -5
package/CODE_OF_CONDUCT.md
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
# Code Of Conduct
|
|
2
|
-
|
|
3
|
-
The `ember-sortable` core team and and the broader `Ember` community are committed to everyone having a safe and inclusive experience.
|
|
4
|
-
|
|
5
|
-
- Our **Community Guidelines / Code of Conduct** can be found at [emberjs.com/guidelines](https://emberjs.com/guidelines/)
|
|
6
|
-
- A history of updates to this page is located at [https://github.com/emberjs/website/commits/master/source/guidelines.html.erb](https://github.com/emberjs/website/commits/master/source/guidelines.html.erb)
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# Ember-sortable
|
|
2
|
-
|
|
3
|
-
## Migration Guide (Components -> Modifiers)
|
|
4
|
-
|
|
5
|
-
To use modifiers, you must use angle-bracket syntax
|
|
6
|
-
|
|
7
|
-
### New Root component
|
|
8
|
-
|
|
9
|
-
1. Instead of using `sortable-group` as a component, use `sortable-group` as a modifier
|
|
10
|
-
any element. You no longer need to tell `sortable-group` about the models, so the `each`
|
|
11
|
-
uses the models directly.
|
|
12
|
-
|
|
13
|
-
**Old Component**
|
|
14
|
-
|
|
15
|
-
```hbs
|
|
16
|
-
{{#sortable-group model=model.items onChange=(action "reorderItems") as |group|}}
|
|
17
|
-
{{#each group.model as |item|}}
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
**New Component**
|
|
21
|
-
|
|
22
|
-
```hbs
|
|
23
|
-
<ol {{sortable-group onChange=(action "reorderItems")}}>
|
|
24
|
-
{{#each model.items as |item|}}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
2. Each `item` can be represented by any dom element or component using angle-bracket syntax
|
|
28
|
-
|
|
29
|
-
**Old Component**
|
|
30
|
-
|
|
31
|
-
```hbs
|
|
32
|
-
{{#sortable-group model=model.items onChange=(action 'reorderItems') as |group|}}
|
|
33
|
-
{{#each group.model as |item|}}
|
|
34
|
-
{{#group.item model=item}}
|
|
35
|
-
{{item.name}}
|
|
36
|
-
{{/group.item}}
|
|
37
|
-
{{/each}}
|
|
38
|
-
{{/sortable-group}}
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
**New Component with modifier**
|
|
42
|
-
|
|
43
|
-
```hbs
|
|
44
|
-
<ol {{sortable-group onChange=(action 'reorderItems')}}>
|
|
45
|
-
{{#each model.items as |item|}}
|
|
46
|
-
<li {{sortable-item model=item}}>
|
|
47
|
-
{{item.name}}
|
|
48
|
-
</li>
|
|
49
|
-
{{/each}}
|
|
50
|
-
</ol>
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
3. The Handle is also any element with a `sortable-handle` applied to it.
|
|
54
|
-
|
|
55
|
-
**Old Component**
|
|
56
|
-
|
|
57
|
-
```hbs
|
|
58
|
-
{{#sortable-group model=model.items onChange=(action "reorderItems") as |group|}}
|
|
59
|
-
{{#each group.model as |modelItem|}}
|
|
60
|
-
{{#group.item model=modelItem as|item|}}
|
|
61
|
-
{{modelItem.name}}
|
|
62
|
-
{{#item.handle}}
|
|
63
|
-
<span class="handle">↕</span>
|
|
64
|
-
{{/item.handle}}
|
|
65
|
-
{{/group.item}}
|
|
66
|
-
{{/each}}
|
|
67
|
-
{{/sortable-group}}
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
**New Component with modifier**
|
|
71
|
-
|
|
72
|
-
```hbs
|
|
73
|
-
<ol {{sortable-group onChange=(action 'reorderItems')}}>
|
|
74
|
-
{{#each model.items as |item|}}
|
|
75
|
-
<li {{sortable-item model=item}}>
|
|
76
|
-
{{item.name}}
|
|
77
|
-
<span class='handle' {{sortable-handle}}>↕</span>
|
|
78
|
-
</li>
|
|
79
|
-
{{/each}}
|
|
80
|
-
</ol>
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
4. The modifier `groupModel` property is no longer supported. The equivalent can
|
|
84
|
-
be accomplished by the `action` helper or the new `fn` helper.
|
|
85
|
-
|
|
86
|
-
```hbs
|
|
87
|
-
<ol {{sortable-group onChange=(action 'reorderItems' model)}}>
|
|
88
|
-
{{#each model.items as |item|}}
|
|
89
|
-
<li {{sortable-item model=item}}>
|
|
90
|
-
{{item.name}}
|
|
91
|
-
<span class='handle' {{sortable-handle}}>↕</span>
|
|
92
|
-
</li>
|
|
93
|
-
{{/each}}
|
|
94
|
-
</ol>
|
|
95
|
-
```
|
package/MIGRATION_GUIDE_V2.md
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
# Ember-sortable
|
|
2
|
-
|
|
3
|
-
## Migration Guide (v1 -> v2)
|
|
4
|
-
|
|
5
|
-
[High Order Components](#Higher Order Components) or [Modifiers](/MIGRATION_GUIDE_MODIFIERS.md)
|
|
6
|
-
|
|
7
|
-
### Higher Order Components
|
|
8
|
-
|
|
9
|
-
`Ember-sortable` can now be built using [higher order components](https://v4.chriskrycho.com/2018/higher-order-components-in-emberjs.html)
|
|
10
|
-
|
|
11
|
-
1. The array of models are now yielded out by `sortable-group`
|
|
12
|
-
|
|
13
|
-
**V1**
|
|
14
|
-
|
|
15
|
-
```hbs
|
|
16
|
-
{{#sortable-group onChange=(action "reorderItems") as |group|}}
|
|
17
|
-
{{#each model.items as |item|}}
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
**V2**
|
|
21
|
-
|
|
22
|
-
```hbs
|
|
23
|
-
{{#sortable-group model=model.items onChange=(action "reorderItems") as |group|}}
|
|
24
|
-
{{#each group.model as |item|}}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
2. Each `item` can be represented by the yielded `sortable-item` instead of directly using `sortable-item` and passing the `group` manually.
|
|
28
|
-
|
|
29
|
-
**V1**
|
|
30
|
-
|
|
31
|
-
```hbs
|
|
32
|
-
{{#sortable-group onChange=(action 'reorderItems') as |group|}}
|
|
33
|
-
{{#each model.items as |item|}}
|
|
34
|
-
{{#sortable-item model=item group=group handle='.handle'}}
|
|
35
|
-
{{item.name}}
|
|
36
|
-
<span class='handle'>↕</span>
|
|
37
|
-
{{/sortable-item}}
|
|
38
|
-
{{/each}}
|
|
39
|
-
{{/sortable-group}}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
**V2**
|
|
43
|
-
|
|
44
|
-
```hbs
|
|
45
|
-
{{#sortable-group model=model.items onChange=(action 'reorderItems') as |group|}}
|
|
46
|
-
{{#each group.model as |item|}}
|
|
47
|
-
{{#group.item model=item}}
|
|
48
|
-
...
|
|
49
|
-
{{/group.item}}
|
|
50
|
-
{{/each}}
|
|
51
|
-
{{/sortable-group}}
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
3. It is recommended to use the yielded `sortable-handle` instead of referencing `handle` by `class`, as it guarantees accessibility support.
|
|
55
|
-
|
|
56
|
-
**V1**
|
|
57
|
-
|
|
58
|
-
```hbs
|
|
59
|
-
{{#sortable-group onChange=(action 'reorderItems') as |group|}}
|
|
60
|
-
{{#each model.items as |item|}}
|
|
61
|
-
{{#sortable-item model=item group=group handle='.handle'}}
|
|
62
|
-
{{item.name}}
|
|
63
|
-
<span class='handle'>↕</span>
|
|
64
|
-
{{/sortable-item}}
|
|
65
|
-
{{/each}}
|
|
66
|
-
{{/sortable-group}}
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
**V2**
|
|
70
|
-
|
|
71
|
-
```hbs
|
|
72
|
-
{{#sortable-group model=model.items onChange=(action "reorderItems") as |group|}}
|
|
73
|
-
{{#each group.model as |modelItem|}}
|
|
74
|
-
{{#group.item model=item as|item|}}
|
|
75
|
-
{{modelItem.name}}
|
|
76
|
-
{{#item.handle}}
|
|
77
|
-
<span class="handle">↕</span>
|
|
78
|
-
{{/item.handle}}
|
|
79
|
-
{{/group.item}}
|
|
80
|
-
{{/each}}
|
|
81
|
-
{{/sortable-group}}
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
4. `groupModel` is still supported via `groupModel` instead of `model`
|
|
85
|
-
|
|
86
|
-
**V1**
|
|
87
|
-
|
|
88
|
-
```hbs
|
|
89
|
-
{{#sortable-group model=model onChange=(action "reorderItems") as |group|}}
|
|
90
|
-
{{#each model.items as |item|}}
|
|
91
|
-
...
|
|
92
|
-
{{/sortable-group}}
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
**V2**
|
|
96
|
-
|
|
97
|
-
```hbs
|
|
98
|
-
{{#sortable-group groupModel=model model=model.items onChange=(action "reorderItems") as |group|}}
|
|
99
|
-
{{#each group.model as |item|}}
|
|
100
|
-
...
|
|
101
|
-
{{/sortable-group}}
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### Modifiers
|
|
105
|
-
|
|
106
|
-
### Accessibility support
|
|
107
|
-
|
|
108
|
-
1. Keyboard navigation is built into `ember-sortable`.
|
|
109
|
-
2. `a11yItemName`, `a11yAnnouncementConfig`, `itemVisualClass`, `handleVisualClass` can be supplied to enhance the accessibility experience.
|
|
110
|
-
3. Refer to [Accessibility Section](/README.md#Accessibility) for more details.
|
|
111
|
-
|
|
112
|
-
```hbs
|
|
113
|
-
{{#sortable-group a11yAnnouncementConfig=a11yAnnouncementConfig a11yItemName="spanish number" itemVisualClass=itemVisualClass handleVisualClass=handleVisualClass onChange=(action "update") model=model.items as |group|}}
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
### Testing
|
|
117
|
-
|
|
118
|
-
1. The `drag` and `reorder` test helpers are no longer global `async` helpers. They are now importable.
|
|
119
|
-
|
|
120
|
-
Refer to [Testing Section](/README.md#Testing) for more details.
|
package/Makefile
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
demo:
|
|
2
|
-
@echo ""
|
|
3
|
-
@echo "===> Checking out gh-pages"
|
|
4
|
-
@echo ""
|
|
5
|
-
git checkout gh-pages
|
|
6
|
-
git reset --hard master
|
|
7
|
-
@echo ""
|
|
8
|
-
@echo "===> Building demo"
|
|
9
|
-
@echo ""
|
|
10
|
-
ember build -e production -o demo
|
|
11
|
-
@echo ""
|
|
12
|
-
@echo "===> Committing demo"
|
|
13
|
-
@echo ""
|
|
14
|
-
git add demo
|
|
15
|
-
git commit -m "Build demo" --no-verify
|
|
16
|
-
@echo ""
|
|
17
|
-
@echo "===> Pushing gh-pages"
|
|
18
|
-
@echo ""
|
|
19
|
-
git push origin gh-pages -f --no-verify
|
|
20
|
-
@echo ""
|
|
21
|
-
@echo "===> Cleaning up"
|
|
22
|
-
@echo ""
|
|
23
|
-
git checkout master
|
|
24
|
-
rm -rf demo
|
package/RELEASE.md
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# Release Process
|
|
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
|
-
## Preparation
|
|
8
|
-
|
|
9
|
-
Since the majority of the actual release process is automated, the primary
|
|
10
|
-
remaining task prior to releasing is confirming that all pull requests that
|
|
11
|
-
have been merged since the last release have been labeled with the appropriate
|
|
12
|
-
`lerna-changelog` labels and the titles have been updated to ensure they
|
|
13
|
-
represent something that would make sense to our users. Some great information
|
|
14
|
-
on why this is important can be found at
|
|
15
|
-
[keepachangelog.com](https://keepachangelog.com/en/1.0.0/), but the overall
|
|
16
|
-
guiding principle here is that changelogs are for humans, not machines.
|
|
17
|
-
|
|
18
|
-
When reviewing merged PR's the labels to be used are:
|
|
19
|
-
|
|
20
|
-
* breaking - Used when the PR is considered a breaking change.
|
|
21
|
-
* enhancement - Used when the PR adds a new feature or enhancement.
|
|
22
|
-
* bug - Used when the PR fixes a bug included in a previous release.
|
|
23
|
-
* documentation - Used when the PR adds or updates documentation.
|
|
24
|
-
* internal - Used for internal changes that still require a mention in the
|
|
25
|
-
changelog/release notes.
|
|
26
|
-
|
|
27
|
-
## Release
|
|
28
|
-
|
|
29
|
-
Once the prep work is completed, the actual release is straight forward:
|
|
30
|
-
|
|
31
|
-
* First, ensure that you have installed your projects dependencies:
|
|
32
|
-
|
|
33
|
-
```sh
|
|
34
|
-
yarn install
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
* Second, ensure that you have obtained a
|
|
38
|
-
[GitHub personal access token][generate-token] with the `repo` scope (no
|
|
39
|
-
other permissions are needed). Make sure the token is available as the
|
|
40
|
-
`GITHUB_AUTH` environment variable.
|
|
41
|
-
|
|
42
|
-
For instance:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
export GITHUB_AUTH=abc123def456
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
[generate-token]: https://github.com/settings/tokens/new?scopes=repo&description=GITHUB_AUTH+env+variable
|
|
49
|
-
|
|
50
|
-
* And last (but not least 😁) do your release.
|
|
51
|
-
|
|
52
|
-
```sh
|
|
53
|
-
npx release-it
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
[release-it](https://github.com/release-it/release-it/) manages the actual
|
|
57
|
-
release process. It will prompt you to to choose the version number after which
|
|
58
|
-
you will have the chance to hand tweak the changelog to be used (for the
|
|
59
|
-
`CHANGELOG.md` and GitHub release), then `release-it` continues on to tagging,
|
|
60
|
-
pushing the tag and commits, etc.
|