commit dist folder as it's used by javascript modules

This commit is contained in:
simonox 2023-02-27 15:43:31 +01:00
parent 821635f808
commit ab9ffd68d7
359 changed files with 107503 additions and 1 deletions

1
.gitignore vendored
View file

@ -24,7 +24,6 @@ result
/flow_backup.json
# Mkdocs
dist
docs/_*
site

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,555 @@
/*!
* gridstack 0.6.4 extra CSS for [2-11] columns (non default)
* https://gridstackjs.com/
* (c) 2014-2020 Alain Dumesny, Dylan Weiss, Pavel Reznikov
* gridstack.js may be freely distributed under the MIT license.
*/
.grid-stack.grid-stack-2 > .grid-stack-item {
min-width: 50%; }
.grid-stack.grid-stack-2 > .grid-stack-item[data-gs-width='1'] {
width: 50%; }
.grid-stack.grid-stack-2 > .grid-stack-item[data-gs-x='1'] {
left: 50%; }
.grid-stack.grid-stack-2 > .grid-stack-item[data-gs-min-width='1'] {
min-width: 50%; }
.grid-stack.grid-stack-2 > .grid-stack-item[data-gs-max-width='1'] {
max-width: 50%; }
.grid-stack.grid-stack-2 > .grid-stack-item[data-gs-width='2'] {
width: 100%; }
.grid-stack.grid-stack-2 > .grid-stack-item[data-gs-x='2'] {
left: 100%; }
.grid-stack.grid-stack-2 > .grid-stack-item[data-gs-min-width='2'] {
min-width: 100%; }
.grid-stack.grid-stack-2 > .grid-stack-item[data-gs-max-width='2'] {
max-width: 100%; }
.grid-stack.grid-stack-3 > .grid-stack-item {
min-width: 33.3333333333%; }
.grid-stack.grid-stack-3 > .grid-stack-item[data-gs-width='1'] {
width: 33.3333333333%; }
.grid-stack.grid-stack-3 > .grid-stack-item[data-gs-x='1'] {
left: 33.3333333333%; }
.grid-stack.grid-stack-3 > .grid-stack-item[data-gs-min-width='1'] {
min-width: 33.3333333333%; }
.grid-stack.grid-stack-3 > .grid-stack-item[data-gs-max-width='1'] {
max-width: 33.3333333333%; }
.grid-stack.grid-stack-3 > .grid-stack-item[data-gs-width='2'] {
width: 66.6666666667%; }
.grid-stack.grid-stack-3 > .grid-stack-item[data-gs-x='2'] {
left: 66.6666666667%; }
.grid-stack.grid-stack-3 > .grid-stack-item[data-gs-min-width='2'] {
min-width: 66.6666666667%; }
.grid-stack.grid-stack-3 > .grid-stack-item[data-gs-max-width='2'] {
max-width: 66.6666666667%; }
.grid-stack.grid-stack-3 > .grid-stack-item[data-gs-width='3'] {
width: 100%; }
.grid-stack.grid-stack-3 > .grid-stack-item[data-gs-x='3'] {
left: 100%; }
.grid-stack.grid-stack-3 > .grid-stack-item[data-gs-min-width='3'] {
min-width: 100%; }
.grid-stack.grid-stack-3 > .grid-stack-item[data-gs-max-width='3'] {
max-width: 100%; }
.grid-stack.grid-stack-4 > .grid-stack-item {
min-width: 25%; }
.grid-stack.grid-stack-4 > .grid-stack-item[data-gs-width='1'] {
width: 25%; }
.grid-stack.grid-stack-4 > .grid-stack-item[data-gs-x='1'] {
left: 25%; }
.grid-stack.grid-stack-4 > .grid-stack-item[data-gs-min-width='1'] {
min-width: 25%; }
.grid-stack.grid-stack-4 > .grid-stack-item[data-gs-max-width='1'] {
max-width: 25%; }
.grid-stack.grid-stack-4 > .grid-stack-item[data-gs-width='2'] {
width: 50%; }
.grid-stack.grid-stack-4 > .grid-stack-item[data-gs-x='2'] {
left: 50%; }
.grid-stack.grid-stack-4 > .grid-stack-item[data-gs-min-width='2'] {
min-width: 50%; }
.grid-stack.grid-stack-4 > .grid-stack-item[data-gs-max-width='2'] {
max-width: 50%; }
.grid-stack.grid-stack-4 > .grid-stack-item[data-gs-width='3'] {
width: 75%; }
.grid-stack.grid-stack-4 > .grid-stack-item[data-gs-x='3'] {
left: 75%; }
.grid-stack.grid-stack-4 > .grid-stack-item[data-gs-min-width='3'] {
min-width: 75%; }
.grid-stack.grid-stack-4 > .grid-stack-item[data-gs-max-width='3'] {
max-width: 75%; }
.grid-stack.grid-stack-4 > .grid-stack-item[data-gs-width='4'] {
width: 100%; }
.grid-stack.grid-stack-4 > .grid-stack-item[data-gs-x='4'] {
left: 100%; }
.grid-stack.grid-stack-4 > .grid-stack-item[data-gs-min-width='4'] {
min-width: 100%; }
.grid-stack.grid-stack-4 > .grid-stack-item[data-gs-max-width='4'] {
max-width: 100%; }
.grid-stack.grid-stack-5 > .grid-stack-item {
min-width: 20%; }
.grid-stack.grid-stack-5 > .grid-stack-item[data-gs-width='1'] {
width: 20%; }
.grid-stack.grid-stack-5 > .grid-stack-item[data-gs-x='1'] {
left: 20%; }
.grid-stack.grid-stack-5 > .grid-stack-item[data-gs-min-width='1'] {
min-width: 20%; }
.grid-stack.grid-stack-5 > .grid-stack-item[data-gs-max-width='1'] {
max-width: 20%; }
.grid-stack.grid-stack-5 > .grid-stack-item[data-gs-width='2'] {
width: 40%; }
.grid-stack.grid-stack-5 > .grid-stack-item[data-gs-x='2'] {
left: 40%; }
.grid-stack.grid-stack-5 > .grid-stack-item[data-gs-min-width='2'] {
min-width: 40%; }
.grid-stack.grid-stack-5 > .grid-stack-item[data-gs-max-width='2'] {
max-width: 40%; }
.grid-stack.grid-stack-5 > .grid-stack-item[data-gs-width='3'] {
width: 60%; }
.grid-stack.grid-stack-5 > .grid-stack-item[data-gs-x='3'] {
left: 60%; }
.grid-stack.grid-stack-5 > .grid-stack-item[data-gs-min-width='3'] {
min-width: 60%; }
.grid-stack.grid-stack-5 > .grid-stack-item[data-gs-max-width='3'] {
max-width: 60%; }
.grid-stack.grid-stack-5 > .grid-stack-item[data-gs-width='4'] {
width: 80%; }
.grid-stack.grid-stack-5 > .grid-stack-item[data-gs-x='4'] {
left: 80%; }
.grid-stack.grid-stack-5 > .grid-stack-item[data-gs-min-width='4'] {
min-width: 80%; }
.grid-stack.grid-stack-5 > .grid-stack-item[data-gs-max-width='4'] {
max-width: 80%; }
.grid-stack.grid-stack-5 > .grid-stack-item[data-gs-width='5'] {
width: 100%; }
.grid-stack.grid-stack-5 > .grid-stack-item[data-gs-x='5'] {
left: 100%; }
.grid-stack.grid-stack-5 > .grid-stack-item[data-gs-min-width='5'] {
min-width: 100%; }
.grid-stack.grid-stack-5 > .grid-stack-item[data-gs-max-width='5'] {
max-width: 100%; }
.grid-stack.grid-stack-6 > .grid-stack-item {
min-width: 16.6666666667%; }
.grid-stack.grid-stack-6 > .grid-stack-item[data-gs-width='1'] {
width: 16.6666666667%; }
.grid-stack.grid-stack-6 > .grid-stack-item[data-gs-x='1'] {
left: 16.6666666667%; }
.grid-stack.grid-stack-6 > .grid-stack-item[data-gs-min-width='1'] {
min-width: 16.6666666667%; }
.grid-stack.grid-stack-6 > .grid-stack-item[data-gs-max-width='1'] {
max-width: 16.6666666667%; }
.grid-stack.grid-stack-6 > .grid-stack-item[data-gs-width='2'] {
width: 33.3333333333%; }
.grid-stack.grid-stack-6 > .grid-stack-item[data-gs-x='2'] {
left: 33.3333333333%; }
.grid-stack.grid-stack-6 > .grid-stack-item[data-gs-min-width='2'] {
min-width: 33.3333333333%; }
.grid-stack.grid-stack-6 > .grid-stack-item[data-gs-max-width='2'] {
max-width: 33.3333333333%; }
.grid-stack.grid-stack-6 > .grid-stack-item[data-gs-width='3'] {
width: 50%; }
.grid-stack.grid-stack-6 > .grid-stack-item[data-gs-x='3'] {
left: 50%; }
.grid-stack.grid-stack-6 > .grid-stack-item[data-gs-min-width='3'] {
min-width: 50%; }
.grid-stack.grid-stack-6 > .grid-stack-item[data-gs-max-width='3'] {
max-width: 50%; }
.grid-stack.grid-stack-6 > .grid-stack-item[data-gs-width='4'] {
width: 66.6666666667%; }
.grid-stack.grid-stack-6 > .grid-stack-item[data-gs-x='4'] {
left: 66.6666666667%; }
.grid-stack.grid-stack-6 > .grid-stack-item[data-gs-min-width='4'] {
min-width: 66.6666666667%; }
.grid-stack.grid-stack-6 > .grid-stack-item[data-gs-max-width='4'] {
max-width: 66.6666666667%; }
.grid-stack.grid-stack-6 > .grid-stack-item[data-gs-width='5'] {
width: 83.3333333333%; }
.grid-stack.grid-stack-6 > .grid-stack-item[data-gs-x='5'] {
left: 83.3333333333%; }
.grid-stack.grid-stack-6 > .grid-stack-item[data-gs-min-width='5'] {
min-width: 83.3333333333%; }
.grid-stack.grid-stack-6 > .grid-stack-item[data-gs-max-width='5'] {
max-width: 83.3333333333%; }
.grid-stack.grid-stack-6 > .grid-stack-item[data-gs-width='6'] {
width: 100%; }
.grid-stack.grid-stack-6 > .grid-stack-item[data-gs-x='6'] {
left: 100%; }
.grid-stack.grid-stack-6 > .grid-stack-item[data-gs-min-width='6'] {
min-width: 100%; }
.grid-stack.grid-stack-6 > .grid-stack-item[data-gs-max-width='6'] {
max-width: 100%; }
.grid-stack.grid-stack-7 > .grid-stack-item {
min-width: 14.2857142857%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-width='1'] {
width: 14.2857142857%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-x='1'] {
left: 14.2857142857%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-min-width='1'] {
min-width: 14.2857142857%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-max-width='1'] {
max-width: 14.2857142857%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-width='2'] {
width: 28.5714285714%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-x='2'] {
left: 28.5714285714%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-min-width='2'] {
min-width: 28.5714285714%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-max-width='2'] {
max-width: 28.5714285714%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-width='3'] {
width: 42.8571428571%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-x='3'] {
left: 42.8571428571%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-min-width='3'] {
min-width: 42.8571428571%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-max-width='3'] {
max-width: 42.8571428571%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-width='4'] {
width: 57.1428571429%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-x='4'] {
left: 57.1428571429%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-min-width='4'] {
min-width: 57.1428571429%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-max-width='4'] {
max-width: 57.1428571429%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-width='5'] {
width: 71.4285714286%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-x='5'] {
left: 71.4285714286%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-min-width='5'] {
min-width: 71.4285714286%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-max-width='5'] {
max-width: 71.4285714286%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-width='6'] {
width: 85.7142857143%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-x='6'] {
left: 85.7142857143%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-min-width='6'] {
min-width: 85.7142857143%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-max-width='6'] {
max-width: 85.7142857143%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-width='7'] {
width: 100%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-x='7'] {
left: 100%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-min-width='7'] {
min-width: 100%; }
.grid-stack.grid-stack-7 > .grid-stack-item[data-gs-max-width='7'] {
max-width: 100%; }
.grid-stack.grid-stack-8 > .grid-stack-item {
min-width: 12.5%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-width='1'] {
width: 12.5%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-x='1'] {
left: 12.5%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-min-width='1'] {
min-width: 12.5%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-max-width='1'] {
max-width: 12.5%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-width='2'] {
width: 25%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-x='2'] {
left: 25%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-min-width='2'] {
min-width: 25%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-max-width='2'] {
max-width: 25%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-width='3'] {
width: 37.5%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-x='3'] {
left: 37.5%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-min-width='3'] {
min-width: 37.5%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-max-width='3'] {
max-width: 37.5%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-width='4'] {
width: 50%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-x='4'] {
left: 50%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-min-width='4'] {
min-width: 50%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-max-width='4'] {
max-width: 50%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-width='5'] {
width: 62.5%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-x='5'] {
left: 62.5%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-min-width='5'] {
min-width: 62.5%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-max-width='5'] {
max-width: 62.5%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-width='6'] {
width: 75%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-x='6'] {
left: 75%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-min-width='6'] {
min-width: 75%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-max-width='6'] {
max-width: 75%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-width='7'] {
width: 87.5%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-x='7'] {
left: 87.5%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-min-width='7'] {
min-width: 87.5%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-max-width='7'] {
max-width: 87.5%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-width='8'] {
width: 100%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-x='8'] {
left: 100%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-min-width='8'] {
min-width: 100%; }
.grid-stack.grid-stack-8 > .grid-stack-item[data-gs-max-width='8'] {
max-width: 100%; }
.grid-stack.grid-stack-9 > .grid-stack-item {
min-width: 11.1111111111%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-width='1'] {
width: 11.1111111111%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-x='1'] {
left: 11.1111111111%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-min-width='1'] {
min-width: 11.1111111111%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-max-width='1'] {
max-width: 11.1111111111%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-width='2'] {
width: 22.2222222222%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-x='2'] {
left: 22.2222222222%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-min-width='2'] {
min-width: 22.2222222222%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-max-width='2'] {
max-width: 22.2222222222%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-width='3'] {
width: 33.3333333333%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-x='3'] {
left: 33.3333333333%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-min-width='3'] {
min-width: 33.3333333333%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-max-width='3'] {
max-width: 33.3333333333%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-width='4'] {
width: 44.4444444444%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-x='4'] {
left: 44.4444444444%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-min-width='4'] {
min-width: 44.4444444444%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-max-width='4'] {
max-width: 44.4444444444%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-width='5'] {
width: 55.5555555556%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-x='5'] {
left: 55.5555555556%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-min-width='5'] {
min-width: 55.5555555556%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-max-width='5'] {
max-width: 55.5555555556%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-width='6'] {
width: 66.6666666667%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-x='6'] {
left: 66.6666666667%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-min-width='6'] {
min-width: 66.6666666667%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-max-width='6'] {
max-width: 66.6666666667%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-width='7'] {
width: 77.7777777778%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-x='7'] {
left: 77.7777777778%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-min-width='7'] {
min-width: 77.7777777778%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-max-width='7'] {
max-width: 77.7777777778%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-width='8'] {
width: 88.8888888889%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-x='8'] {
left: 88.8888888889%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-min-width='8'] {
min-width: 88.8888888889%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-max-width='8'] {
max-width: 88.8888888889%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-width='9'] {
width: 100%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-x='9'] {
left: 100%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-min-width='9'] {
min-width: 100%; }
.grid-stack.grid-stack-9 > .grid-stack-item[data-gs-max-width='9'] {
max-width: 100%; }
.grid-stack.grid-stack-10 > .grid-stack-item {
min-width: 10%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-width='1'] {
width: 10%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-x='1'] {
left: 10%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-min-width='1'] {
min-width: 10%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-max-width='1'] {
max-width: 10%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-width='2'] {
width: 20%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-x='2'] {
left: 20%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-min-width='2'] {
min-width: 20%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-max-width='2'] {
max-width: 20%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-width='3'] {
width: 30%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-x='3'] {
left: 30%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-min-width='3'] {
min-width: 30%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-max-width='3'] {
max-width: 30%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-width='4'] {
width: 40%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-x='4'] {
left: 40%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-min-width='4'] {
min-width: 40%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-max-width='4'] {
max-width: 40%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-width='5'] {
width: 50%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-x='5'] {
left: 50%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-min-width='5'] {
min-width: 50%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-max-width='5'] {
max-width: 50%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-width='6'] {
width: 60%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-x='6'] {
left: 60%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-min-width='6'] {
min-width: 60%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-max-width='6'] {
max-width: 60%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-width='7'] {
width: 70%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-x='7'] {
left: 70%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-min-width='7'] {
min-width: 70%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-max-width='7'] {
max-width: 70%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-width='8'] {
width: 80%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-x='8'] {
left: 80%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-min-width='8'] {
min-width: 80%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-max-width='8'] {
max-width: 80%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-width='9'] {
width: 90%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-x='9'] {
left: 90%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-min-width='9'] {
min-width: 90%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-max-width='9'] {
max-width: 90%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-width='10'] {
width: 100%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-x='10'] {
left: 100%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-min-width='10'] {
min-width: 100%; }
.grid-stack.grid-stack-10 > .grid-stack-item[data-gs-max-width='10'] {
max-width: 100%; }
.grid-stack.grid-stack-11 > .grid-stack-item {
min-width: 9.0909090909%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-width='1'] {
width: 9.0909090909%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-x='1'] {
left: 9.0909090909%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-min-width='1'] {
min-width: 9.0909090909%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-max-width='1'] {
max-width: 9.0909090909%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-width='2'] {
width: 18.1818181818%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-x='2'] {
left: 18.1818181818%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-min-width='2'] {
min-width: 18.1818181818%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-max-width='2'] {
max-width: 18.1818181818%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-width='3'] {
width: 27.2727272727%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-x='3'] {
left: 27.2727272727%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-min-width='3'] {
min-width: 27.2727272727%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-max-width='3'] {
max-width: 27.2727272727%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-width='4'] {
width: 36.3636363636%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-x='4'] {
left: 36.3636363636%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-min-width='4'] {
min-width: 36.3636363636%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-max-width='4'] {
max-width: 36.3636363636%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-width='5'] {
width: 45.4545454545%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-x='5'] {
left: 45.4545454545%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-min-width='5'] {
min-width: 45.4545454545%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-max-width='5'] {
max-width: 45.4545454545%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-width='6'] {
width: 54.5454545455%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-x='6'] {
left: 54.5454545455%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-min-width='6'] {
min-width: 54.5454545455%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-max-width='6'] {
max-width: 54.5454545455%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-width='7'] {
width: 63.6363636364%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-x='7'] {
left: 63.6363636364%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-min-width='7'] {
min-width: 63.6363636364%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-max-width='7'] {
max-width: 63.6363636364%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-width='8'] {
width: 72.7272727273%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-x='8'] {
left: 72.7272727273%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-min-width='8'] {
min-width: 72.7272727273%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-max-width='8'] {
max-width: 72.7272727273%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-width='9'] {
width: 81.8181818182%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-x='9'] {
left: 81.8181818182%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-min-width='9'] {
min-width: 81.8181818182%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-max-width='9'] {
max-width: 81.8181818182%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-width='10'] {
width: 90.9090909091%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-x='10'] {
left: 90.9090909091%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-min-width='10'] {
min-width: 90.9090909091%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-max-width='10'] {
max-width: 90.9090909091%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-width='11'] {
width: 100%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-x='11'] {
left: 100%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-min-width='11'] {
min-width: 100%; }
.grid-stack.grid-stack-11 > .grid-stack-item[data-gs-max-width='11'] {
max-width: 100%; }

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,105 @@
/** gridstack.js 0.6.4 - IE and older browsers Polyfills for this library @preserve*/
/**
* https://gridstackjs.com/
* (c) 2019-2020 Alain Dumesny
* gridstack.js may be freely distributed under the MIT license.
*/
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN
Number.isNaN = Number.isNaN || function isNaN(input) {
return typeof input === 'number' && input !== input;
}
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find
if (!Array.prototype.find) {
Object.defineProperty(Array.prototype, 'find', {
value: function (predicate) {
// 1. Let O be ? ToObject(this value).
if (this == null) {
throw TypeError('"this" is null or not defined');
}
var o = Object(this);
// 2. Let len be ? ToLength(? Get(O, "length")).
var len = o.length >>> 0;
// 3. If IsCallable(predicate) is false, throw a TypeError exception.
if (typeof predicate !== 'function') {
throw TypeError('predicate must be a function');
}
// 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
var thisArg = arguments[1];
// 5. Let k be 0.
var k = 0;
// 6. Repeat, while k < len
while (k < len) {
// a. Let Pk be ! ToString(k).
// b. Let kValue be ? Get(O, Pk).
// c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
// d. If testResult is true, return kValue.
var kValue = o[k];
if (predicate.call(thisArg, kValue, k, o)) {
return kValue;
}
// e. Increase k by 1.
k++;
}
// 7. Return undefined.
return undefined;
},
configurable: true,
writable: true
});
}
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex
if (!Array.prototype.findIndex) {
Object.defineProperty(Array.prototype, 'findIndex', {
value: function(predicate) {
// 1. Let O be ? ToObject(this value).
if (this == null) {
throw new TypeError('"this" is null or not defined');
}
var o = Object(this);
// 2. Let len be ? ToLength(? Get(O, "length")).
var len = o.length >>> 0;
// 3. If IsCallable(predicate) is false, throw a TypeError exception.
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
// 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
var thisArg = arguments[1];
// 5. Let k be 0.
var k = 0;
// 6. Repeat, while k < len
while (k < len) {
// a. Let Pk be ! ToString(k).
// b. Let kValue be ? Get(O, Pk).
// c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
// d. If testResult is true, return k.
var kValue = o[k];
if (predicate.call(thisArg, kValue, k, o)) {
return k;
}
// e. Increase k by 1.
k++;
}
// 7. Return -1.
return -1;
},
configurable: true,
writable: true
});
}

View file

@ -0,0 +1,3 @@
/** gridstack.js 0.6.4 - IE and older browsers Polyfills for this library @preserve*/
Number.isNaN=Number.isNaN||function(r){return"number"==typeof r&&r!=r},Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(r){if(null==this)throw TypeError('"this" is null or not defined');var e=Object(this),t=e.length>>>0;if("function"!=typeof r)throw TypeError("predicate must be a function");for(var n=arguments[1],i=0;i<t;){var o=e[i];if(r.call(n,o,i,e))return o;i++}},configurable:!0,writable:!0}),Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex",{value:function(r){if(null==this)throw new TypeError('"this" is null or not defined');var e=Object(this),t=e.length>>>0;if("function"!=typeof r)throw new TypeError("predicate must be a function");for(var n=arguments[1],i=0;i<t;){var o=e[i];if(r.call(n,o,i,e))return i;i++}return-1},configurable:!0,writable:!0});
//# sourceMappingURL=gridstack.min.map

File diff suppressed because one or more lines are too long

243
software/flow/node_modules/gridstack/dist/gridstack.css generated vendored Normal file
View file

@ -0,0 +1,243 @@
/*!
* required gridstack 0.6.4 CSS for default 12 and 1 columnMode size. Use gridstack-extra.css for others
* https://gridstackjs.com/
* (c) 2014-2020 Alain Dumesny, Dylan Weiss, Pavel Reznikov
* gridstack.js may be freely distributed under the MIT license.
*/
:root .grid-stack-item > .ui-resizable-handle {
filter: none; }
.grid-stack {
position: relative; }
.grid-stack.grid-stack-rtl {
direction: ltr; }
.grid-stack.grid-stack-rtl > .grid-stack-item {
direction: rtl; }
.grid-stack .grid-stack-placeholder > .placeholder-content {
border: 1px dashed lightgray;
margin: 0;
position: absolute;
top: 0;
left: 10px;
right: 10px;
bottom: 0;
width: auto;
z-index: 0 !important;
text-align: center; }
.grid-stack > .grid-stack-item {
min-width: 8.3333333333%;
position: absolute;
padding: 0; }
.grid-stack > .grid-stack-item > .grid-stack-item-content {
margin: 0;
position: absolute;
top: 0;
left: 10px;
right: 10px;
bottom: 0;
width: auto;
overflow-x: hidden;
overflow-y: auto; }
.grid-stack > .grid-stack-item > .ui-resizable-handle {
position: absolute;
font-size: 0.1px;
display: block;
-ms-touch-action: none;
touch-action: none; }
.grid-stack > .grid-stack-item.ui-resizable-disabled > .ui-resizable-handle,
.grid-stack > .grid-stack-item.ui-resizable-autohide > .ui-resizable-handle {
display: none; }
.grid-stack > .grid-stack-item.ui-draggable-dragging, .grid-stack > .grid-stack-item.ui-resizable-resizing {
z-index: 100; }
.grid-stack > .grid-stack-item.ui-draggable-dragging > .grid-stack-item-content,
.grid-stack > .grid-stack-item.ui-draggable-dragging > .grid-stack-item-content, .grid-stack > .grid-stack-item.ui-resizable-resizing > .grid-stack-item-content,
.grid-stack > .grid-stack-item.ui-resizable-resizing > .grid-stack-item-content {
box-shadow: 1px 4px 6px rgba(0, 0, 0, 0.2);
opacity: 0.8; }
.grid-stack > .grid-stack-item > .ui-resizable-se,
.grid-stack > .grid-stack-item > .ui-resizable-sw {
background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjE2cHgiIGhlaWdodD0iMTZweCIgdmlld0JveD0iMCAwIDUxMS42MjYgNTExLjYyNyIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTExLjYyNiA1MTEuNjI3OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxnPgoJPHBhdGggZD0iTTMyOC45MDYsNDAxLjk5NGgtMzYuNTUzVjEwOS42MzZoMzYuNTUzYzQuOTQ4LDAsOS4yMzYtMS44MDksMTIuODQ3LTUuNDI2YzMuNjEzLTMuNjE1LDUuNDIxLTcuODk4LDUuNDIxLTEyLjg0NSAgIGMwLTQuOTQ5LTEuODAxLTkuMjMxLTUuNDI4LTEyLjg1MWwtNzMuMDg3LTczLjA5QzI2NS4wNDQsMS44MDksMjYwLjc2LDAsMjU1LjgxMywwYy00Ljk0OCwwLTkuMjI5LDEuODA5LTEyLjg0Nyw1LjQyNCAgIGwtNzMuMDg4LDczLjA5Yy0zLjYxOCwzLjYxOS01LjQyNCw3LjkwMi01LjQyNCwxMi44NTFjMCw0Ljk0NiwxLjgwNyw5LjIyOSw1LjQyNCwxMi44NDVjMy42MTksMy42MTcsNy45MDEsNS40MjYsMTIuODUsNS40MjYgICBoMzYuNTQ1djI5Mi4zNThoLTM2LjU0MmMtNC45NTIsMC05LjIzNSwxLjgwOC0xMi44NSw1LjQyMWMtMy42MTcsMy42MjEtNS40MjQsNy45MDUtNS40MjQsMTIuODU0ICAgYzAsNC45NDUsMS44MDcsOS4yMjcsNS40MjQsMTIuODQ3bDczLjA4OSw3My4wODhjMy42MTcsMy42MTcsNy44OTgsNS40MjQsMTIuODQ3LDUuNDI0YzQuOTUsMCw5LjIzNC0xLjgwNywxMi44NDktNS40MjQgICBsNzMuMDg3LTczLjA4OGMzLjYxMy0zLjYyLDUuNDIxLTcuOTAxLDUuNDIxLTEyLjg0N2MwLTQuOTQ4LTEuODA4LTkuMjMyLTUuNDIxLTEyLjg1NCAgIEMzMzguMTQyLDQwMy44MDIsMzMzLjg1Nyw0MDEuOTk0LDMyOC45MDYsNDAxLjk5NHoiIGZpbGw9IiM2NjY2NjYiLz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8L3N2Zz4K);
background-repeat: no-repeat;
background-position: center;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg); }
.grid-stack > .grid-stack-item > .ui-resizable-se {
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
transform: rotate(-45deg); }
.grid-stack > .grid-stack-item > .ui-resizable-nw {
cursor: nw-resize;
width: 20px;
height: 20px;
left: 10px;
top: 0; }
.grid-stack > .grid-stack-item > .ui-resizable-n {
cursor: n-resize;
height: 10px;
top: 0;
left: 25px;
right: 25px; }
.grid-stack > .grid-stack-item > .ui-resizable-ne {
cursor: ne-resize;
width: 20px;
height: 20px;
right: 10px;
top: 0; }
.grid-stack > .grid-stack-item > .ui-resizable-e {
cursor: e-resize;
width: 10px;
right: 10px;
top: 15px;
bottom: 15px; }
.grid-stack > .grid-stack-item > .ui-resizable-se {
cursor: se-resize;
width: 20px;
height: 20px;
right: 10px;
bottom: 0; }
.grid-stack > .grid-stack-item > .ui-resizable-s {
cursor: s-resize;
height: 10px;
left: 25px;
bottom: 0;
right: 25px; }
.grid-stack > .grid-stack-item > .ui-resizable-sw {
cursor: sw-resize;
width: 20px;
height: 20px;
left: 10px;
bottom: 0; }
.grid-stack > .grid-stack-item > .ui-resizable-w {
cursor: w-resize;
width: 10px;
left: 10px;
top: 15px;
bottom: 15px; }
.grid-stack > .grid-stack-item.ui-draggable-dragging > .ui-resizable-handle {
display: none !important; }
.grid-stack > .grid-stack-item[data-gs-width='1'] {
width: 8.3333333333%; }
.grid-stack > .grid-stack-item[data-gs-x='1'] {
left: 8.3333333333%; }
.grid-stack > .grid-stack-item[data-gs-min-width='1'] {
min-width: 8.3333333333%; }
.grid-stack > .grid-stack-item[data-gs-max-width='1'] {
max-width: 8.3333333333%; }
.grid-stack > .grid-stack-item[data-gs-width='2'] {
width: 16.6666666667%; }
.grid-stack > .grid-stack-item[data-gs-x='2'] {
left: 16.6666666667%; }
.grid-stack > .grid-stack-item[data-gs-min-width='2'] {
min-width: 16.6666666667%; }
.grid-stack > .grid-stack-item[data-gs-max-width='2'] {
max-width: 16.6666666667%; }
.grid-stack > .grid-stack-item[data-gs-width='3'] {
width: 25%; }
.grid-stack > .grid-stack-item[data-gs-x='3'] {
left: 25%; }
.grid-stack > .grid-stack-item[data-gs-min-width='3'] {
min-width: 25%; }
.grid-stack > .grid-stack-item[data-gs-max-width='3'] {
max-width: 25%; }
.grid-stack > .grid-stack-item[data-gs-width='4'] {
width: 33.3333333333%; }
.grid-stack > .grid-stack-item[data-gs-x='4'] {
left: 33.3333333333%; }
.grid-stack > .grid-stack-item[data-gs-min-width='4'] {
min-width: 33.3333333333%; }
.grid-stack > .grid-stack-item[data-gs-max-width='4'] {
max-width: 33.3333333333%; }
.grid-stack > .grid-stack-item[data-gs-width='5'] {
width: 41.6666666667%; }
.grid-stack > .grid-stack-item[data-gs-x='5'] {
left: 41.6666666667%; }
.grid-stack > .grid-stack-item[data-gs-min-width='5'] {
min-width: 41.6666666667%; }
.grid-stack > .grid-stack-item[data-gs-max-width='5'] {
max-width: 41.6666666667%; }
.grid-stack > .grid-stack-item[data-gs-width='6'] {
width: 50%; }
.grid-stack > .grid-stack-item[data-gs-x='6'] {
left: 50%; }
.grid-stack > .grid-stack-item[data-gs-min-width='6'] {
min-width: 50%; }
.grid-stack > .grid-stack-item[data-gs-max-width='6'] {
max-width: 50%; }
.grid-stack > .grid-stack-item[data-gs-width='7'] {
width: 58.3333333333%; }
.grid-stack > .grid-stack-item[data-gs-x='7'] {
left: 58.3333333333%; }
.grid-stack > .grid-stack-item[data-gs-min-width='7'] {
min-width: 58.3333333333%; }
.grid-stack > .grid-stack-item[data-gs-max-width='7'] {
max-width: 58.3333333333%; }
.grid-stack > .grid-stack-item[data-gs-width='8'] {
width: 66.6666666667%; }
.grid-stack > .grid-stack-item[data-gs-x='8'] {
left: 66.6666666667%; }
.grid-stack > .grid-stack-item[data-gs-min-width='8'] {
min-width: 66.6666666667%; }
.grid-stack > .grid-stack-item[data-gs-max-width='8'] {
max-width: 66.6666666667%; }
.grid-stack > .grid-stack-item[data-gs-width='9'] {
width: 75%; }
.grid-stack > .grid-stack-item[data-gs-x='9'] {
left: 75%; }
.grid-stack > .grid-stack-item[data-gs-min-width='9'] {
min-width: 75%; }
.grid-stack > .grid-stack-item[data-gs-max-width='9'] {
max-width: 75%; }
.grid-stack > .grid-stack-item[data-gs-width='10'] {
width: 83.3333333333%; }
.grid-stack > .grid-stack-item[data-gs-x='10'] {
left: 83.3333333333%; }
.grid-stack > .grid-stack-item[data-gs-min-width='10'] {
min-width: 83.3333333333%; }
.grid-stack > .grid-stack-item[data-gs-max-width='10'] {
max-width: 83.3333333333%; }
.grid-stack > .grid-stack-item[data-gs-width='11'] {
width: 91.6666666667%; }
.grid-stack > .grid-stack-item[data-gs-x='11'] {
left: 91.6666666667%; }
.grid-stack > .grid-stack-item[data-gs-min-width='11'] {
min-width: 91.6666666667%; }
.grid-stack > .grid-stack-item[data-gs-max-width='11'] {
max-width: 91.6666666667%; }
.grid-stack > .grid-stack-item[data-gs-width='12'] {
width: 100%; }
.grid-stack > .grid-stack-item[data-gs-x='12'] {
left: 100%; }
.grid-stack > .grid-stack-item[data-gs-min-width='12'] {
min-width: 100%; }
.grid-stack > .grid-stack-item[data-gs-max-width='12'] {
max-width: 100%; }
.grid-stack.grid-stack-1 > .grid-stack-item {
min-width: 100%; }
.grid-stack.grid-stack-1 > .grid-stack-item[data-gs-width='1'] {
width: 100%; }
.grid-stack.grid-stack-1 > .grid-stack-item[data-gs-x='1'] {
left: 100%; }
.grid-stack.grid-stack-1 > .grid-stack-item[data-gs-min-width='1'] {
min-width: 100%; }
.grid-stack.grid-stack-1 > .grid-stack-item[data-gs-max-width='1'] {
max-width: 100%; }
.grid-stack.grid-stack-animate,
.grid-stack.grid-stack-animate .grid-stack-item {
-webkit-transition: left 0.3s, top 0.3s, height 0.3s, width 0.3s;
-moz-transition: left 0.3s, top 0.3s, height 0.3s, width 0.3s;
-ms-transition: left 0.3s, top 0.3s, height 0.3s, width 0.3s;
-o-transition: left 0.3s, top 0.3s, height 0.3s, width 0.3s;
transition: left 0.3s, top 0.3s, height 0.3s, width 0.3s; }
.grid-stack.grid-stack-animate .grid-stack-item.ui-draggable-dragging,
.grid-stack.grid-stack-animate .grid-stack-item.ui-resizable-resizing,
.grid-stack.grid-stack-animate .grid-stack-item.grid-stack-placeholder {
-webkit-transition: left 0s, top 0s, height 0s, width 0s;
-moz-transition: left 0s, top 0s, height 0s, width 0s;
-ms-transition: left 0s, top 0s, height 0s, width 0s;
-o-transition: left 0s, top 0s, height 0s, width 0s;
transition: left 0s, top 0s, height 0s, width 0s; }

View file

@ -0,0 +1,549 @@
// Type definitions for Gridstack 0.6.4
// Project: https://gridstackjs.com/
// Definitions by: Pascal Senn <https://github.com/PascalSenn>
// Ricky Blankenaufulland <https://github.com/ZoolWay>
// Sl1MBoy <https://github.com/Sl1MBoy>
// John Archer <https://github.com/JohnArcher>
// Alain Dumesny <https://github.com/adumesny>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped initially, but now part of gridstack.js
// TypeScript Version: 2.8
interface JQuery {
gridstack(options: GridstackOptions): JQuery;
data(key: 'gridstack'): GridStack;
}
/* Other items in https://github.com/gridstack/gridstack.js/blob/develop/doc/README.md
* Grid attributes
* Item attributes
* Events
*/
type GridStackElement = string | HTMLElement | JQuery;
interface GridStack {
/**
* Creates new widget and returns it.
*
* Widget will be always placed even if result height is more than actual grid height.
* You need to use willItFit method before calling addWidget for additional check.
* See also `makeWidget()`.
*
* @example
* $('.grid-stack').gridstack();
* var grid = $('.grid-stack').data('gridstack');
* grid.addWidget(el, {width: 3, autoPosition: true});
*
* @param el widget to add
* @param options widget position/size options (optional)
*/
addWidget(el: GridStackElement, options ? : GridstackWidget): JQuery;
/**
* Creates new widget and returns it.
* Legacy: Spelled out version of the widgets options, recommend use new version instead.
*
* @example
* $('.grid-stack').gridstack();
* var grid = $('.grid-stack').data('gridstack');
* grid.addWidget(el, 0, 0, 3, 2, true);
*
* @param el widget to add
* @param x widget position x (optional)
* @param y widget position y (optional)
* @param width widget dimension width (optional)
* @param height widget dimension height (optional)
* @param autoPosition if true then x, y parameters will be ignored and widget will be places on the first available position (optional)
* @param minWidth minimum width allowed during resize/creation (optional)
* @param maxWidth maximum width allowed during resize/creation (optional)
* @param minHeight minimum height allowed during resize/creation (optional)
* @param maxHeight maximum height allowed during resize/creation (optional)
* @param id value for `data-gs-id` (optional)
*/
addWidget(el: GridStackElement, x ? : number, y ? : number, width ? : number, height ? : number, autoPosition ? : boolean,
minWidth ? : number, maxWidth ? : number, minHeight ? : number, maxHeight ? : number, id ? : number | string): JQuery;
/**
* Initializes batch updates. You will see no changes until commit method is called.
*/
batchUpdate(): void;
/**
* Gets current cell height.
*/
cellHeight(): number;
/**
* Update current cell height - see `GridstackOptions.cellHeight` for format.
* This method rebuilds an internal CSS style sheet.
* Note: You can expect performance issues if call this method too often.
*
* @param val the cell height
* @param noUpdate (Optional) if true, styles will not be updated
*
* @example
* grid.cellHeight(grid.cellWidth() * 1.2);
*/
cellHeight(val: number | string, noUpdate ? : boolean): void;
/**
* Gets current cell width.
*/
cellWidth(): number;
/**
* Finishes batch updates. Updates DOM nodes. You must call it after batchUpdate.
*/
commit(): void;
/**
* relayout grid items to reclaim any empty space
*/
compact(): void;
/**
* Destroys a grid instance.
* @param detachGrid if false nodes and grid will not be removed from the DOM (Optional. Default true).
*/
destroy(detachGrid ? : boolean): void;
/**
* Disables widgets moving/resizing. This is a shortcut for:
* @example
* grid.movable('.grid-stack-item', false);
* grid.resizable('.grid-stack-item', false);
*/
disable(): void;
/**
* Enables widgets moving/resizing. This is a shortcut for:
* @example
* grid.movable('.grid-stack-item', true);
* grid.resizable('.grid-stack-item', true);
*/
enable(): void;
/**
* Enables/disables widget moving.
* This is a shortcut for:
* @example
* grid.movable(this.container.children('.' + this.opts.itemClass), doEnable);
*
* @param doEnable
* @param includeNewWidgets will force new widgets to be draggable as per
* doEnable`s value by changing the disableDrag grid option.
*/
enableMove(doEnable: boolean, includeNewWidgets: boolean): void;
/**
* Enables/disables widget resizing
* @param doEnable
* @param includeNewWidgets will force new widgets to be draggable as per
* doEnable`s value by changing the disableResize grid option.
*
* This is a shortcut for:
* @example
* grid.resizable(this.container.children('.' + this.opts.itemClass), doEnable);
*/
enableResize(doEnable: boolean, includeNewWidgets: boolean): void;
/**
* enable/disable floating widgets (default: `false`) See [example](http://gridstackjs.com/demo/float.html)
* @param mode
*/
float(mode: boolean): void;
/**
* get the current float mode
*/
float(): boolean;
/**
* Get the position of the cell under a pixel on screen.
* @param position the position of the pixel to resolve in
* absolute coordinates, as an object with top and left properties
* @param useOffset if true, value will be based on offset vs position (Optional. Default false).
* Useful when grid is within `position: relative` element
*
* Returns an object with properties `x` and `y` i.e. the column and row in the grid.
*/
getCellFromPixel(position: MousePosition, useOffset ? : boolean): CellPosition;
/**
* Checks if specified area is empty.
* @param x the position x.
* @param y the position y.
* @param width the width of to check
* @param height the height of to check
*/
isAreaEmpty(x: number, y: number, width: number, height: number): void;
/**
* Locks/unlocks widget.
* @param el widget to modify.
* @param val if true widget will be locked.
*/
locked(el: GridStackElement, val: boolean): void;
/**
* If you add elements to your gridstack container by hand, you have to tell gridstack afterwards to make them widgets.
* If you want gridstack to add the elements for you, use addWidget instead.
* Makes the given element a widget and returns it.
* @param el widget to convert.
*
* @example
* $('.grid-stack').gridstack();
* $('.grid-stack').append('<div id="gsi-1" data-gs-x="0" data-gs-y="0" data-gs-width="3" data-gs-height="2"
* data-gs-auto-position="true"></div>')
* var grid = $('.grid-stack').data('gridstack');
* grid.makeWidget('gsi-1');
*/
makeWidget(el: GridStackElement): JQuery;
/**
* Set the maxWidth for a widget.
* @param el widget to modify.
* @param val A numeric value of the number of columns
*/
maxWidth(el: GridStackElement, val: number): void;
/**
* Set the minWidth for a widget.
* @param el widget to modify.
* @param val A numeric value of the number of columns
*/
minWidth(el: GridStackElement, val: number): void;
/**
* Set the maxHeight for a widget.
* @param el widget to modify.
* @param val A numeric value of the number of rows
*/
maxHeight(el: GridStackElement, val: number): void;
/**
* Set the minHeight for a widget.
* @param el widget to modify.
* @param val A numeric value of the number of rows
*/
minHeight(el: GridStackElement, val: number): void;
/**
* Enables/Disables moving.
* @param el widget to modify.
* @param val if true widget will be draggable.
*/
movable(el: GridStackElement, val: boolean): void;
/**
* Changes widget position
* @param el widget to modify
* @param x new position x. If value is null or undefined it will be ignored.
* @param y new position y. If value is null or undefined it will be ignored.
*/
move(el: GridStackElement, x: number, y: number): void;
/**
* Removes widget from the grid.
* @param el widget to modify
* @param detachNode if false DOM node won't be removed from the tree (Default? true).
*/
removeWidget(el: GridStackElement, detachNode ? : boolean): void;
/**
* Removes all widgets from the grid.
* @param detachNode if false DOM nodes won't be removed from the tree (Default? true).
*/
removeAll(detachNode ? : boolean): void;
/**
* Changes widget size
* @param el widget to modify
* @param width new dimensions width. If value is null or undefined it will be ignored.
* @param height new dimensions height. If value is null or undefined it will be ignored.
*/
resize(el: GridStackElement, width: number, height: number): void;
/**
* Enables/Disables resizing.
* @param el widget to modify
* @param val if true widget will be resizable.
*/
resizable(el: GridStackElement, val: boolean): void;
/**
* Toggle the grid animation state. Toggles the `grid-stack-animate` class.
* @param doAnimate if true the grid will animate.
*/
setAnimation(doAnimate: boolean): void;
/**
* Modify number of columns in the grid. Will update existing widgets to conform to new number of columns,
* as well as cache the original layout so you can revert back to previous positions without loss.
* Requires `gridstack-extra.css` or `gridstack-extra.min.css` for [1-11],
* else you will need to generate correct CSS (see https://github.com/gridstack/gridstack.js#change-grid-columns)
* @param column - Integer > 0 (default 12).
* @param doNotPropagate if true existing widgets will not be updated (optional)
*/
setColumn(column: number, doNotPropagate ? : boolean): void;
/**
* Toggle the grid static state. Also toggle the grid-stack-static class.
* @param staticValue if true the grid become static.
*/
setStatic(staticValue: boolean): void;
/**
* Updates widget position/size.
* @param el widget to modify
* @param x new position x. If value is null or undefined it will be ignored.
* @param y new position y. If value is null or undefined it will be ignored.
* @param width new dimensions width. If value is null or undefined it will be ignored.
* @param height new dimensions height. If value is null or undefined it will be ignored.
*/
update(el: GridStackElement, x: number, y: number, width: number, height: number): void;
/**
* returns current vertical margin value
*/
verticalMargin(): number;
/**
* Updates the vertical margin - see `GridstackOptions.verticalMargin` for format options.
*
* @param value new vertical margin value
* @param noUpdate (optional) if true, styles will not be updated
*/
verticalMargin(value: number | string, noUpdate ? : boolean): void;
/**
* Returns true if the height of the grid will be less the vertical
* constraint. Always returns true if grid doesn't have height constraint.
* @param x new position x. If value is null or undefined it will be ignored.
* @param y new position y. If value is null or undefined it will be ignored.
* @param width new dimensions width. If value is null or undefined it will be ignored.
* @param height new dimensions height. If value is null or undefined it will be ignored.
* @param autoPosition if true then x, y parameters will be ignored and widget
* will be places on the first available position
*
* @example
* if (grid.willItFit(newNode.x, newNode.y, newNode.width, newNode.height, true)) {
* grid.addWidget(newNode.el, newNode.x, newNode.y, newNode.width, newNode.height, true);
* } else {
* alert('Not enough free space to place the widget');
* }
*/
willItFit(x: number, y: number, width: number, height: number, autoPosition: boolean): boolean;
}
/**
* Defines the coordinates of an object
*/
interface MousePosition {
top: number;
left: number;
}
/**
* Defines the position of a cell inside the grid
*/
interface CellPosition {
x: number;
y: number;
}
/**
* Gridstack Widget creation options
* @param x widget position x (default?: 0)
* @param y widget position y (default?: 0)
* @param width widget dimension width (default?: 1)
* @param height widget dimension height (default?: 1)
* @param autoPosition if true then x, y parameters will be ignored and widget will be places on the first available position (default?: false)
* @param minWidth minimum width allowed during resize/creation (default?: undefined = un-constrained)
* @param maxWidth maximum width allowed during resize/creation (default?: undefined = un-constrained)
* @param minHeight minimum height allowed during resize/creation (default?: undefined = un-constrained)
* @param maxHeight maximum height allowed during resize/creation (default?: undefined = un-constrained)
* @param id value for `data-gs-id` stored on the widget (default?: undefined)
*/
interface GridstackWidget {
x ? : number;
y ? : number;
width ? : number;
height ? : number;
autoPosition ? : boolean;
minWidth ? : number;
maxWidth ? : number;
minHeight ? : number;
maxHeight ? : number;
id ? : number | string;
}
declare namespace GridStackUI {
interface Utils {
/**
* Sorts array of nodes
* @param nodes array to sort
* @param dir 1 for asc, -1 for desc (optional)
* @param width width of the grid. If undefined the width will be calculated automatically (optional).
**/
sort(nodes: HTMLElement[], dir ? : number, width ? : number): void;
}
}
/**
* Gridstack Options
* Defines the options for a Gridstack
*/
interface GridstackOptions {
/**
* accept widgets dragged from other grids or from outside (default: `false`). Can be:
* `true` (uses `'.grid-stack-item'` class filter) or `false`,
* string for explicit class name,
* function returning a boolean. See [example](http://gridstack.github.io/gridstack.js/demo/two.html)
*/
acceptWidgets ? : boolean | string | ((i: number, element: Element) => boolean);
/**
* if true the resizing handles are shown even if the user is not hovering over the widget (default?: false)
*/
alwaysShowResizeHandle ? : boolean;
/**
* turns animation on (default?: true)
*/
animate ? : boolean;
/**
* if false gridstack will not initialize existing items (default?: true)
*/
auto ? : boolean;
/**
* one cell height (default?: 60). Can be:
* an integer (px)
* a string (ex: '100px', '10em', '10rem', '10%')
* 0 or null, in which case the library will not generate styles for rows. Everything must be defined in CSS files.
* 'auto' - height will be calculated to match cell width (initial square grid).
*/
cellHeight ? : number | string;
/**
* (internal?) unit for cellHeight (default? 'px')
*/
cellHeightUnit ? : string;
/** class that implement drag'n'drop functionality for gridstack. If false grid will be static.
* (default?: null - first available plugin will be used)
*/
ddPlugin ? : boolean | null | any;
/** disallows dragging of widgets (default?: false) */
disableDrag ? : boolean;
/** disallows resizing of widgets (default?: false). */
disableResize ? : boolean;
/**
* allows to override jQuery UI draggable options. (default?: { handle?: '.grid-stack-item-content', scroll?: true, appendTo?: 'body', containment: null })
*/
draggable ? : {};
/**
* let user drag nested grid items out of a parent or not (default false)
*/
dragOut ? : boolean;
/**
* draggable handle selector (default?: '.grid-stack-item-content')
*/
handle ? : string;
/** draggable handle class (e.g. 'grid-stack-item-content'). If set 'handle' is ignored (default?: null) */
handleClass ? : string;
/**
* number of columns (default?: 12). Note: IF you change this, CSS also have to change. See https://github.com/gridstack/gridstack.js#change-grid-columns
*/
column ? : number;
/**
* maximum rows amount. Default? is 0 which means no maximum rows
*/
maxRow ? : number;
/**
* enable floating widgets (default?: false) See example (http://gridstack.github.io/gridstack.js/demo/float.html)
*/
float ? : boolean;
/**
* widget class (default?: 'grid-stack-item')
*/
itemClass ? : string;
/**
* minimal width. If window width is less, grid will be shown in one column mode (default?: 768)
*/
minWidth ? : number;
/** disables the onColumnMode when the window width is less than minWidth (default?: false) */
disableOneColumnMode ? : boolean;
/**
* set to true if you want oneColumnMode to use the DOM order and ignore x,y from normal multi column
* layouts during sorting. This enables you to have custom 1 column layout that differ from the rest. (default?: false)
*/
oneColumnModeDomSort?: boolean;
/**
* class for placeholder (default?: 'grid-stack-placeholder')
*/
placeholderClass ? : string;
/** placeholder default content (default?: '') */
placeholderText ? : string;
/**
* allows to override jQuery UI resizable options. (default?: { autoHide?: true, handles?: 'se' })
*/
resizable ? : {};
/**
* if true widgets could be removed by dragging outside of the grid. It could also be a jQuery selector string,
* in this case widgets will be removed by dropping them there (default?: false)
* See example (http://gridstack.github.io/gridstack.js/demo/two.html)
*/
removable ? : boolean | string;
/**
* time in milliseconds before widget is being removed while dragging outside of the grid. (default?: 2000)
*/
removeTimeout ? : number;
/**
* if true turns grid to RTL. Possible values are true, false, 'auto' (default?: 'auto')
* See [example](http://gridstack.github.io/gridstack.js/demo/rtl.html)
*/
rtl ? : boolean | 'auto';
/**
* makes grid static (default?: false).If true widgets are not movable/resizable.
* You don't even need jQueryUI draggable/resizable. A CSS class
* 'grid-stack-static' is also added to the container.
*/
staticGrid ? : boolean;
/**
* vertical gap size (default?: 20). Can be:
* an integer (px)
* a string (ex: '2em', '20px', '2rem')
*/
verticalMargin ? : number | string;
/**
* (internal?) unit for verticalMargin (default? 'px')
*/
verticalMarginUnit ? : string;
}

View file

@ -0,0 +1,89 @@
/** gridstack.js 0.6.4 - JQuery UI Drag&Drop plugin @preserve */
/**
* https://gridstackjs.com/
* (c) 2014-2020 Alain Dumesny, Dylan Weiss, Pavel Reznikov
* gridstack.js may be freely distributed under the MIT license.
*/
(function(factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery', 'gridstack', 'exports'], factory);
} else if (typeof exports !== 'undefined') {
try { jQuery = require('jquery'); } catch (e) {}
try { gridstack = require('gridstack'); } catch (e) {}
factory(jQuery, gridstack.GridStackUI, exports);
} else {
factory(jQuery, GridStackUI, window);
}
})(function($, GridStackUI, scope) {
/**
* @class JQueryUIGridStackDragDropPlugin
* jQuery UI implementation of drag'n'drop gridstack plugin.
*/
function JQueryUIGridStackDragDropPlugin(grid) {
GridStackUI.GridStackDragDropPlugin.call(this, grid);
}
GridStackUI.GridStackDragDropPlugin.registerPlugin(JQueryUIGridStackDragDropPlugin);
JQueryUIGridStackDragDropPlugin.prototype = Object.create(GridStackUI.GridStackDragDropPlugin.prototype);
JQueryUIGridStackDragDropPlugin.prototype.constructor = JQueryUIGridStackDragDropPlugin;
JQueryUIGridStackDragDropPlugin.prototype.resizable = function(el, opts) {
el = $(el);
if (opts === 'disable' || opts === 'enable') {
el.resizable(opts);
} else if (opts === 'option') {
var key = arguments[2];
var value = arguments[3];
el.resizable(opts, key, value);
} else {
var handles = el.data('gs-resize-handles') ? el.data('gs-resize-handles') :
this.grid.opts.resizable.handles;
el.resizable($.extend({}, this.grid.opts.resizable, {
handles: handles
}, {
start: opts.start || function() {},
stop: opts.stop || function() {},
resize: opts.resize || function() {}
}));
}
return this;
};
JQueryUIGridStackDragDropPlugin.prototype.draggable = function(el, opts) {
el = $(el);
if (opts === 'disable' || opts === 'enable') {
el.draggable(opts);
} else {
el.draggable($.extend({}, this.grid.opts.draggable, {
containment: (this.grid.opts.isNested && !this.grid.opts.dragOut) ?
this.grid.container.parent() :
(this.grid.opts.draggable.containment || null),
start: opts.start || function() {},
stop: opts.stop || function() {},
drag: opts.drag || function() {}
}));
}
return this;
};
JQueryUIGridStackDragDropPlugin.prototype.droppable = function(el, opts) {
el = $(el);
el.droppable(opts);
return this;
};
JQueryUIGridStackDragDropPlugin.prototype.isDroppable = function(el, opts) {
el = $(el);
return Boolean(el.data('droppable'));
};
JQueryUIGridStackDragDropPlugin.prototype.on = function(el, eventName, callback) {
$(el).on(eventName, callback);
return this;
};
scope.JQueryUIGridStackDragDropPlugin = JQueryUIGridStackDragDropPlugin;
return JQueryUIGridStackDragDropPlugin;
});

View file

@ -0,0 +1,3 @@
/** gridstack.js 0.6.4 - JQuery UI Drag&Drop plugin @preserve */
!function(t){if("function"==typeof define&&define.amd)define(["jquery","gridstack","exports"],t);else if("undefined"!=typeof exports){try{jQuery=require("jquery")}catch(t){}try{gridstack=require("gridstack")}catch(t){}t(jQuery,gridstack.GridStackUI,exports)}else t(jQuery,GridStackUI,window)}(function(a,e,t){function r(t){e.GridStackDragDropPlugin.call(this,t)}return e.GridStackDragDropPlugin.registerPlugin(r),((r.prototype=Object.create(e.GridStackDragDropPlugin.prototype)).constructor=r).prototype.resizable=function(t,e){if(t=a(t),"disable"===e||"enable"===e)t.resizable(e);else if("option"===e){var r=arguments[2],i=arguments[3];t.resizable(e,r,i)}else{var n=t.data("gs-resize-handles")?t.data("gs-resize-handles"):this.grid.opts.resizable.handles;t.resizable(a.extend({},this.grid.opts.resizable,{handles:n},{start:e.start||function(){},stop:e.stop||function(){},resize:e.resize||function(){}}))}return this},r.prototype.draggable=function(t,e){return t=a(t),"disable"===e||"enable"===e?t.draggable(e):t.draggable(a.extend({},this.grid.opts.draggable,{containment:this.grid.opts.isNested&&!this.grid.opts.dragOut?this.grid.container.parent():this.grid.opts.draggable.containment||null,start:e.start||function(){},stop:e.stop||function(){},drag:e.drag||function(){}})),this},r.prototype.droppable=function(t,e){return(t=a(t)).droppable(e),this},r.prototype.isDroppable=function(t,e){return t=a(t),Boolean(t.data("droppable"))},r.prototype.on=function(t,e,r){return a(t).on(e,r),this},t.JQueryUIGridStackDragDropPlugin=r});
//# sourceMappingURL=gridstack.min.map

2033
software/flow/node_modules/gridstack/dist/gridstack.js generated vendored Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4034
software/flow/node_modules/gridstack/dist/jquery-ui.js generated vendored Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

10598
software/flow/node_modules/gridstack/dist/jquery.js generated vendored Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

10993
software/flow/node_modules/jquery/dist/jquery.js generated vendored Normal file

File diff suppressed because it is too large Load diff

2
software/flow/node_modules/jquery/dist/jquery.min.js generated vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

8894
software/flow/node_modules/jquery/dist/jquery.slim.js generated vendored Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,889 @@
/* */
/* Copyright 2016,2020 JS Foundation and other contributors, https://js.foundation/ */
/* Copyright 2016 IBM Corp. */
/* Copyright 2015 Andrei Tatar */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
/* you may not use this file except in compliance with the License. */
/* You may obtain a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* */
@media(max-width: 959px) {
.md-sidenav-left, md-sidenav {
top: 48px !important;
z-index: 99;
}
}
@media (max-width: 959px) and (min-width: 0) and (orientation: portrait) {
md-toolbar {
min-height: 48px;
height: 48px;
max-height: 48px;
}
}
@media(min-width: 960px) {
.md-sidenav-left, md-sidenav {
top: 64px;
z-index: 99;
}
}
@media(max-width: 660px) {
md-sidenav,
md-sidenav.md-locked-open,
md-sidenav.md-closed.md-locked-open-add-active {
min-width: 64px !important;
width: auto;
max-width: 200px !important;
}
}
@media(min-width: 661px) {
md-sidenav,
md-sidenav.md-locked-open,
md-sidenav.md-closed.md-locked-open-add-active {
min-width: 64px !important;
width: auto;
max-width: 320px !important;
}
}
md-sidenav ng-md-icon {
padding-right: 4px;
}
md-sidenav i {
padding-right: 4px;
}
md-sidenav md-list-item .md-list-item-inner>p {
line-height: 20px;
}
md-card > md-list > md-list-item > div > md-icon > ui-icon > ng-md-icon {
vertical-align:unset !important;
}
md-toast .md-toast-content {
height: auto;
}
md-toast .md-toast-error {
color: rgba(255, 64, 41, 0.84);
font-weight: 500;
font-size: large;
}
md-backdrop.md-sidenav-backdrop {
z-index: 80;
}
md-card {
box-shadow: none;
}
.md-button {
min-width: 64px;
}
.md-tooltip {
background-color: #888 !important;
color: #fff !important;
border-radius: 3px;
opacity: 1 !important;
}
.md-tooltip.md-origin-bottom {
margin-top: -6px;
margin-left: -8px;
}
.node-red-ui--notabs {
color: #888;
font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;
display: flex;
height: 100%;
width: 100%;
align-items: center;
justify-content: center;
opacity: 1;
animation-name: fadeInOpacity;
animation-iteration-count: 1;
animation-timing-function: ease-in;
animation-duration: 2.5s;
}
.node-red-ui--loading {
color: #888;
font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;
display: flex;
height: 100%;
width: 100%;
align-items: center;
justify-content: center;
}
.node-red-ui--inline-link {
width: 100%;
height: 100%;
position: absolute;
}
.node-red-ui--inline-link iframe {
width: 100%;
height: 100%;
}
.material-icons {
vertical-align: middle;
}
.ie9 img[src$=".svg"] {
width: 100%;
}
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
img[src$=".svg"] {
width: 100%;
}
}
@keyframes fadeInOpacity {
0% {
opacity: 0;
}
30% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.flip-icon {
animation: flip-icon 0.3s linear both;
}
@keyframes flip-icon {
0% {
transform: rotateY(180deg);
}
100% {
transform: rotateY(0deg);
}
}
@supports (-ms-overflow-style: none) {
overflow:auto !important;
}
/*
ALL COMPONENTS/CONTENT
*/
@baseFont: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;
@baseColor: #fff;
@pageBackgroundColor: #eee;
@pageSidebarBackgroundColor: #eee;
@pageTitlebarBackgroundColor: #0094CE;
@groupBackgroundColor: #fff;
@groupTextColor: #00A4DE;
@groupBorderColor: #fff;
@widgetTextColor: #000;
@widgetBackgroundColor: #4FBAE4;
@widgetBorderColor: #fff;
@nrTheme: true;
@nrTemplateTheme: true;
@nrUnitHeight: 24px;
@wtc-light: boolean(luma(@widgetTextColor) > 50%);
@wbc-light: boolean(luma(@widgetBackgroundColor) > 50%);
// define some CSS variables for user usage
:root {
--nr-dashboard-pageBackgroundColor: @pageBackgroundColor;
--nr-dashboard-pageTitlebarBackgroundColor: @pageTitlebarBackgroundColor;
--nr-dashboard-pageSidebarBackgroundColor: @pageSidebarBackgroundColor;
--nr-dashboard-groupTextColor: @groupTextColor;
--nr-dashboard-groupBackgroundColor: @groupBackgroundColor;
--nr-dashboard-groupBorderColor: @groupBorderColor;
--nr-dashboard-widgetTextColor: @widgetTextColor;
--nr-dashboard-widgetBackgroundColor: @widgetBackgroundColor; // deprecated - will be removed at some point
--nr-dashboard-widgetBorderColor: @widgetBorderColor; // deprecated - will be removed at some point
--nr-dashboard-widgetColor: @widgetBackgroundColor;
--nr-dashboard-widgetBgndColor: @widgetBorderColor;
}
.nr-dashboard-disabled {
opacity: 0.4 !important;
pointer-events: none !important;
}
& when (@nrTheme = false) {
.nr-menu-item-active div button {
border-right: 4px solid #888;
}
}
& when (@nrTheme = true) {
body.nr-dashboard-theme {
background-color: @pageBackgroundColor;
font-family: @baseFont;
}
body.nr-dashboard-theme md-content {
background: transparent;
height: 100%;
& when (@nrTemplateTheme = true) {
color: @groupTextColor;
}
}
// body.nr-dashboard-theme md-select-menu md-content {
// max-height: 80%;
// }
body.nr-dashboard-theme md-input-container.md-input-focused:not([md-no-float]) .md-select-placeholder span:first-child {
-webkit-transform: translateY(-28px) scale(.75);
transform: translateY(-28px) scale(.75);
}
body.nr-dashboard-theme md-input-container.md-input-focused:not(.md-input-has-value) md-select .md-select-value.md-select-placeholder {
color: @widgetTextColor;
}
body.nr-dashboard-theme md-content md-card {
background-color: @widgetBorderColor;
color: @widgetTextColor;
}
/* Some colour classes */
body.nr-dashboard-theme .nr-dashboard-color { color: @groupTextColor; }
body.nr-dashboard-theme .nr-dashboard-error { color: #ff2929; }
body.nr-dashboard-theme .nr-dashboard-warning { color: #eaf42f; }
body.nr-dashboard-theme .nr-dashboard-ok { color: #49db3c; }
body.nr-dashboard-theme .nr-dashboard-dim { opacity: 0.5 !important; }
/*
DASHBOARD HEADER
*/
body.nr-dashboard-theme md-toolbar {
background-color: @pageTitlebarBackgroundColor;
color: #fff;
}
body.nr-dashboard-theme md-toolbar .md-toolbar-tools {
color: #fff;
filter: invert(if(@wbc-light, 100%, 0%));
}
/*
DASHBOARD SIDEBAR
*/
body.nr-dashboard-theme md-sidenav {
color: @groupTextColor;
background-color: @pageSidebarBackgroundColor;
}
body.nr-dashboard-theme md-sidenav md-list-item._md-button-wrap > div.md-button:first-child {
background-color: transparent;
}
body.nr-dashboard-theme md-sidenav div.md-list-item-inner {
color: @groupTextColor;
background-color: transparent;
}
a.md-no-style, button.md-no-style {
background-color: transparent;
}
.nr-menu-item-active div button {
border-right: 4px solid @groupTextColor;
}
/*
GROUP SPECIFIC
*/
.nr-dashboard-theme ui-card-panel {
background-color: @groupBackgroundColor;
border: 1px solid @groupBorderColor;
& p.nr-dashboard-cardtitle {
color: @groupTextColor;
}
}
/*
COMPONENT-SPECIFIC
*/
.nr-dashboard-theme .nr-dashboard-spacer {
opacity: 0;
}
.md-button.md-default-theme.md-primary, .md-button.md-primary {
background-color: @widgetBackgroundColor !important;
color: white;
}
// .md-button.md-default-theme:not([disabled]):hover, .md-button:not([disabled]):hover {
// filter: grayscale(75%);
// }
// .nr-dashboard-theme .md-button.md-primary {
// color: lighten(@widgetBackgroundColor, 8);
// }
.nr-dashboard-theme .md-button[disabled] {
color: rgba(0,0,0,0.38);
cursor: default;
}
/* Button */
.nr-dashboard-theme .nr-dashboard-button .md-button {
background-color: @widgetBackgroundColor;
color: white;
}
.nr-dashboard-theme .nr-dashboard-button .md-button:hover {
background-color: lighten(@widgetBackgroundColor, 6);
}
.nr-dashboard-theme .nr-dashboard-template .md-button[disabled] {
color: #888;
}
.nr-dashboard-theme .nr-dashboard-button .md-button.md-primary {
color: white;
background-color: lighten(@widgetBackgroundColor, 4);
}
.nr-dashboard-theme .nr-dashboard-button .md-button.md-raised:not([disabled]).md-focused {
background-color: @widgetBackgroundColor;
}
/* Date picker */
.nr-dashboard-theme .nr-dashboard-date-picker md-input-container .md-input {
color: @widgetTextColor;
border-bottom-color: @widgetBackgroundColor;
font-family: inherit;
}
.nr-dashboard-theme .nr-dashboard-date-picker md-input-container .md-input::-webkit-input-placeholder {
color: @widgetTextColor;
}
.nr-dashboard-theme .nr-dashboard-date-picker .md-button.md-icon-button {
/* background-color: @widgetBackgroundColor; */
}
.nr-dashboard-theme .nr-dashboard-date-picker .md-button.md-icon-button md-icon {
color: @widgetBackgroundColor;
}
.nr-dashboard-theme .nr-dashboard-date-picker .md-datepicker-triangle-button .md-datepicker-expand-triangle {
border-top-color: @widgetTextColor;
}
.md-default-theme .md-calendar-day-header, .md-calendar-day-header {
color: contrast(@pageTitlebarBackgroundColor);
background-color: @pageTitlebarBackgroundColor;
}
.md-default-theme .md-calendar-date.md-calendar-selected-date .md-calendar-date-selection-indicator, .md-calendar-date.md-calendar-selected-date .md-calendar-date-selection-indicator, .md-default-theme .md-calendar-date.md-focus.md-calendar-selected-date .md-calendar-date-selection-indicator, .md-calendar-date.md-focus.md-calendar-selected-date .md-calendar-date-selection-indicator {
background: @widgetBackgroundColor;
color: contrast(@widgetBackgroundColor);
border-color: transparent;
}
.md-default-theme .md-calendar-date.md-calendar-date-today .md-calendar-date-selection-indicator, .md-calendar-date.md-calendar-date-today .md-calendar-date-selection-indicator {
border: 1px solid @widgetBackgroundColor;
}
.md-datepicker-calendar-pane.md-pane-open {
width: 345px;
background-color: @groupBackgroundColor;
}
/* Chart */
.nr-dashboard-theme .nr-dashboard-chart-title {
}
.nr-dashboard-theme .nr-dashboard-chart-titlel {
font-size: larger;
font-weight: 500;
}
/* Colour Picker */
.nr-dashboard-theme .color-picker-panel {
background-color: @groupBackgroundColor;
border-color: @groupBorderColor;
box-shadow: 0 0 1px rgba(255,255,255,.5);
}
.nr-dashboard-theme .color-picker-input-wrapper > input {
color: @widgetTextColor;
background-color: @widgetBorderColor;
font-family: inherit;
}
.nr-dashboard-theme .color-picker-wrapper .color-picker-panel.color-picker-panel-round .color-picker-grid-wrapper .color-picker-row .color-picker-grid .color-picker-grid-inner {
background-color: @widgetBorderColor;
}
/* Dropdown */
.nr-dashboard-theme .nr-dashboard-dropdown md-select .md-select-value,
.nr-dashboard-theme .nr-dashboard-dropdown md-select .md-select-value.md-select-placeholder {
color: @widgetTextColor;
border-color: @widgetTextColor;
border-bottom-width: 1px;
padding: 0px 2px;
}
.nr-dashboard-theme .nr-dashboard-dropdown .md-select-icon {
color: @widgetTextColor;
}
.nr-dashboard-theme .md-select-menu-container {
max-height: 85%;
overflow-y: auto;
border: 1px solid @pageTitlebarBackgroundColor;
z-index: 99;
}
.nr-dashboard-theme md-select-menu {
margin-left: -2px;
max-height: 85%;
}
.nr-dashboard-theme md-select-menu md-content {
padding: 0px;
max-height: 85%;
}
.nr-dashboard-theme md-select-menu, .nr-dashboard-theme md-select-menu md-option {
background-color: @groupBackgroundColor;
color: @widgetTextColor;
}
.nr-dashboard-theme md-select-menu md-option[selected] {
color: @groupTextColor !important;
background-color: @groupBackgroundColor !important;
}
.nr-dashboard-theme md-select-menu[multiple] md-option.md-checkbox-enabled[selected] .md-icon {
background-color: lighten(@widgetBackgroundColor, 10) !important;
border-color: transparent !important;
}
.nr-dashboard-theme md-select-menu[multiple] md-option.md-checkbox-enabled .md-icon {
border-color: @widgetBackgroundColor !important;
}
.nr-dashboard-theme md-select-menu.md-default-theme md-option:focus:not([disabled]):not([selected]),
md-select-menu md-option:focus:not([disabled]):not([selected]) {
background-color: @groupBackgroundColor;
}
.nr-dashboard-theme md-select-menu md-option:hover {
background-color: lighten(@widgetBackgroundColor, 4) !important;
}
.nr-dashboard-theme md-menu-content {
background-color: @groupBackgroundColor;
color: @widgetTextColor;
}
.nr-dashboard-theme md-menu-content md-menu-item {
background-color: @groupBackgroundColor;
color: @widgetTextColor;
}
/* Gauge */
.nr-dashboard-theme .nr-dashboard-gauge {}
.nr-dashboard-theme .nr-dashboard-gauge text {
fill: @widgetTextColor;
margin: 8px;
}
.nr-dashboard-theme .nr-dashboard-gauge-title {
margin: 6px 0px 20px 0px;
z-index: 1;
}
.nr-dashboard-theme .nr-dashboard-gauge-titlel {
font-size: larger;
font-weight: 500;
z-index: 1;
}
.nr-dashboard-theme .nr-dashboard-gauge-titlem {
font-weight: 500;
margin: 2px 0px 14px 0px;
z-index: 1;
}
.nr-dashboard-theme .nr-dashboard-gauge-titles {
font-size: x-small;
margin-top: 2px;
height: 10px;
padding-bottom: 14px;
z-index: 1;
}
/* Numeric */
.nr-dashboard-theme .nr-dashboard-numeric .value {
background-color: @widgetBorderColor;
color: @widgetTextColor;
}
/* Slider */
.nr-dashboard-theme .nr-dashboard-slider {}
.nr-dashboard-theme .nr-dashboard-slider .md-track {
background-color: rgba(111, 111, 111, 0.5);
}
.nr-dashboard-theme .nr-dashboard-slider .md-track-fill {
background-color: @widgetBackgroundColor;
}
.nr-dashboard-theme .nr-dashboard-slider .md-thumb:after {
background-color: @widgetBackgroundColor;
border-color: @widgetBackgroundColor;
}
.nr-dashboard-theme .nr-dashboard-slider .md-focus-ring {
background-color: @widgetBackgroundColor;
transform: scale(.4);
opacity: 1;
}
.nr-dashboard-theme .nr-dashboard-slider .md-sign {
background-color: @widgetBackgroundColor;
}
.nr-dashboard-theme .nr-dashboard-slider .md-sign:after {
border-top-color: @widgetBackgroundColor !important;
}
.nr-dashboard-theme .nr-dashboard-slider .md-min[md-discrete] .md-sign {
background-color: @widgetBackgroundColor;
}
.nr-dashboard-theme .nr-dashboard-slider md-slider[md-discrete] .md-sign,
.nr-dashboard-theme .nr-dashboard-slider md-slider[md-discrete] .md-sign:after {
opacity: 1;
-webkit-transform: translate3d(0, 0, 0) scale(1);
transform: translate3d(0, 0, 0) scale(1);
}
.nr-dashboard-theme .nr-dashboard-slider .md-sign:after {
border-top-color: @widgetBackgroundColor;
}
.nr-dashboard-theme md-slider.md-default-theme[md-vertical] .md-sign:after, .nr-dashboard-theme md-slider[md-vertical] .md-sign:after {
content: none;;
}
.nr-dashboard-theme .nr-dashboard-slider md-slider.md-default-theme.md-min[md-discrete] .md-thumb:after, md-slider.md-min[md-discrete] .md-thumb:after {
background-color: @widgetBackgroundColor;
border-color: transparent;
}
.nr-dashboard-theme .nr-dashboard-slider md-slider .md-track-ticks {
color: transparent;
}
.nr-dashboard-theme .nr-dashboard-slider md-slider[md-discrete]:not([disabled]) .md-slider-wrapper.md-focused .md-focus-ring {
transform: scale(0.4);
animation: unset;
}
.nr-dashboard-theme .nr-dashboard-slider .md-thumb-text {
color: white;
filter: invert(if(@wbc-light, 100%, 0%));
}
/* Switch */
.nr-dashboard-theme .nr-dashboard-switch {}
.nr-dashboard-theme .nr-dashboard-switch md-switch .md-bar {
background-color: rgba(111, 111, 111, 0.5);
}
.nr-dashboard-theme .nr-dashboard-switch md-switch.md-checked .md-bar {
background-color: rgba(red(@widgetBackgroundColor), green(@widgetBackgroundColor), blue(@widgetBackgroundColor), 0.5);
}
.nr-dashboard-theme .nr-dashboard-switch md-switch .md-thumb {
background-color: rgb(148, 148, 148);
}
.nr-dashboard-theme .nr-dashboard-switch md-switch.md-checked .md-thumb {
background-color: rgba(red(@widgetBackgroundColor), green(@widgetBackgroundColor), blue(@widgetBackgroundColor), 1);
}
/* Template */
& when (@nrTemplateTheme = true) {
md-list {
padding: unset;
}
md-list-item[disabled] {
color: #888;
// text-decoration: line-through;
}
md-list-item {
min-height: @nrUnitHeight * 2;
height: @nrUnitHeight * 2;
}
md-list-item._md-button-wrap>div.md-button:first-child {
background-color: @widgetBorderColor;
height: inherit;
padding: 0 6px;
}
md-list-item.md-2-line {
height: @nrUnitHeight * 2;
min-height: @nrUnitHeight * 2;
}
md-list-item.md-3-line {
height: @nrUnitHeight * 3;
min-height: @nrUnitHeight * 3;
}
md-list-item .md-list-item-inner {
background: @widgetBorderColor;
//color: @widgetTextColor;
padding-left: 8px;
width: 100%;
height: 100%;
}
div > md-list-item.md-2-line, md-list-item.md-2-line>.md-no-style {
height: 48px;
min-height: 48px;
width: 100px;
}
md-progress-linear {
padding-top: 4px !important;
}
md-progress-linear .md-container {
margin-top: @nrUnitHeight / 2;
background-color: @pageBackgroundColor;
}
md-progress-linear .md-container .md-bar {
background-color: lighten(@widgetBackgroundColor, 5);
}
md-checkbox {
min-height: @nrUnitHeight * 2;
margin-left: 6px;
margin-bottom: 0px;
width: 100%;
}
md-checkbox .md-icon {
border-color: @widgetBackgroundColor !important;
}
md-checkbox[disabled] .md-icon {
border-color: #888 !important;
}
md-checkbox.md-checked .md-icon {
background-color: lighten(@widgetBackgroundColor, 5);
border-color: transparent !important;
}
md-checkbox .md-label {
position: absolute;
top: 32%;
}
md-checkbox[disabled] .md-label {
color: #888;
}
md-checkbox:last-of-type {
margin-left: 6px;
}
.nr-dashboard-theme .nr-dashboard-template {
// padding: 0;
background-color: @widgetBorderColor;
}
.nr-dashboard-theme .nr-dashboard-template md-switch .md-thumb {
background-color: rgb(148, 148, 148);
}
.nr-dashboard-theme .nr-dashboard-template md-switch .md-bar {
background-color: rgba(111, 111, 111, 0.5);
}
.nr-dashboard-theme .nr-dashboard-template md-switch.md-checked:not([disabled]) .md-thumb {
background-color: lighten(@widgetBackgroundColor, 5);
}
.nr-dashboard-theme .nr-dashboard-template md-switch.md-checked:not([disabled]) .md-bar {
background-color: rgba(red(@widgetBackgroundColor), green(@widgetBackgroundColor), blue(@widgetBackgroundColor), 0.5);
}
md-radio-button {
min-height: @nrUnitHeight * 2;
margin-left: 6px;
margin-bottom: 0px;
}
md-radio-button .md-off, md-radio-button .md-on {
border-color: @widgetBackgroundColor !important;
}
md-radio-button[disabled] .md-off, md-radio-button[disabled] .md-on {
border-color: #888 !important;
}
md-radio-button.md-checked .md-on {
background-color: @widgetBackgroundColor !important;
}
md-radio-button .md-label {
position: absolute;
top: 32%;
}
md-radio-button[disabled] .md-label {
color: #888;
}
md-divider {
border-color: @widgetBackgroundColor !important;
}
.nr-dashboard-theme .nr-dashboard-template path {
fill: @widgetBackgroundColor;
}
.nr-dashboard-template {
padding: (@nrUnitHeight / 8) 6px;
p, h1, h2, h3, h4 {
color: @widgetTextColor !important;
background-color : @widgetBorderColor !important;
}
}
.nr-dashboard-theme .nr-dashboard-template .md-button .md-no-style {
background: initial !important;
color: initial !important;
}
.nr-dashboard-theme .nr-dashboard-template .md-button[disabled] {
color: #ccc;
}
.nr-dashboard-theme .nr-dashboard-template .md-button.md-primary:not([disabled]) {
color: @widgetTextColor;
background-color: lighten(@widgetBackgroundColor, 5);
}
.nr-dashboard-theme .nr-dashboard-template .md-button .ng-scope {
color: unset;
}
.nr-dashboard-template .md-button {
color: white;
}
.nr-dashboard-theme .nr-dashboard-template .md-button:not(:first-of-type) {
margin-top: @nrUnitHeight * 3 / 4;
}
.nr-dashboard-theme .nr-dashboard-template .md-button {
background-color: @widgetBackgroundColor;
margin: 0;
// padding: 0px 12px;
min-height: @nrUnitHeight * 3 / 2;
min-width: unset;
line-height: unset;
&.md-fab.md-mini {
padding: unset;
}
}
.nr-dashboard-theme .nr-dashboard-template .md-button:not([disabled]):hover {
background-color: lighten(@widgetBackgroundColor, 4);
}
.nr-dashboard-theme .nr-dashboard-template .md-button.md-primary:not([disabled]):hover {
background-color: lighten(@widgetBackgroundColor, 4);
}
.nr-dashboard-theme .nr-dashboard-template .md-button.md-primary.md-raised:not([disabled]) {
background-color: lighten(@widgetBackgroundColor, 2);
}
.nr-dashboard-theme .nr-dashboard-template .md-button.md-primary.md-raised:not([disabled]):hover {
background-color: lighten(@widgetBackgroundColor, 4);
}
// .md-button:disabled {
// background-color: @widgetBackgroundColor;
// }
.nr-dashboard-theme .nr-dashboard-template {
::-webkit-scrollbar {
height: 12px;
width: 12px;
}
::-webkit-scrollbar-thumb {
background-color: @baseColor;
-webkit-border-radius: 1ex;
-webkit-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.75);
}
::-webkit-scrollbar-track {
background-color: @pageBackgroundColor;
}
}
}
/* Text-Input */
.nr-dashboard-theme .nr-dashboard-textinput {}
.nr-dashboard-theme .nr-dashboard-textinput label {
color: @widgetTextColor;
}
.nr-dashboard-theme .nr-dashboard-textinput md-input-container.md-input-has-value label {
color: @widgetTextColor;
}
.nr-dashboard-theme .nr-dashboard-textinput md-input-container.md-input-focused label {
color: @groupTextColor;
}
.nr-dashboard-theme .nr-dashboard-textinput md-input-container.md-input-focused input {
border-color: @groupTextColor;
font-family: inherit;
}
.nr-dashboard-theme .nr-dashboard-textinput md-input-container .md-input:invalid {
color: #DA5252;
}
.nr-dashboard-theme .nr-dashboard-textinput input {
border-color: @widgetTextColor;
color: @widgetTextColor;
font-family: inherit;
}
.nr-dashboard-theme input[type="time"]::-webkit-calendar-picker-indicator {
filter: invert(if(@wtc-light, 100%, 0%));
}
.nr-dashboard-theme input[type="date"]::-webkit-calendar-picker-indicator {
filter: invert(if(@wtc-light, 100%, 0%));
}
/* Text */
.nr-dashboard-theme .nr-dashboard-text {}
/* Dialog */
.nr-dashboard-theme md-dialog {
color: @widgetTextColor;
background-color: @groupBackgroundColor;
border: 3px solid @groupBorderColor;
}
.nr-dashboard-theme .md-dialog-content {
padding: 24px;
}
.nr-dashboard-theme md-input-container.md-default-theme .md-input, md-input-container .md-input {
color: @widgetTextColor;
border-color: @pageTitlebarBackgroundColor !important;
}
/* Form */
.nr-dashboard-theme .nr-dashboard-form md-input-container {
display: block;
}
.nr-dashboard-theme .nr-dashboard-form-button {
background-color: @widgetBackgroundColor;
color: white;
}
.nr-dashboard-theme .nr-dashboard-form-button:hover {
background-color: lighten(@widgetBackgroundColor, 10) !important;
}
.nr-dashboard-theme .nr-dashboard-form-button:focus {
background-color: lighten(@widgetBackgroundColor, 10) !important;
}
.nr-dashboard-theme .nr-dashboard-form {
color: @widgetTextColor;
}
.nr-dashboard-theme .nr-dashboard-form form md-input-container input {
border-color: @widgetTextColor;
color: @widgetTextColor;
font-family: inherit;
}
.nr-dashboard-theme .nr-dashboard-form form md-input-container label {
color: @widgetTextColor;;
}
.nr-dashboard-theme .nr-dashboard-form form md-input-container.md-input-has-value:not(.md-input-invalid) label {
color: @widgetTextColor;;
}
.nr-dashboard-theme .nr-dashboard-form form md-input-container:not(.md-input-invalid).md-input-focused input {
border-color: @groupTextColor ;
}
.nr-dashboard-theme .nr-dashboard-form form md-input-container:not(.md-input-invalid).md-input-focused label {
color: @groupTextColor ;
}
.nr-dashboard-theme .nr-dashboard-form form .md-input-invalid input {
border-color: #d00 !important;
}
.nr-dashboard-theme md-content .nr-dashboard-form form .md-input-invalid label {
color: #d00 !important;
}
.nr-dashboard-theme md-content .nr-dashboard-form form md-input-container md-checkbox.md-checked .md-icon {
background-color: lighten(@widgetBackgroundColor, 10);
}
.nr-dashboard-theme md-content .nr-dashboard-form form md-input-container md-checkbox .md-icon {
border-color: @widgetTextColor;
}
.nr-dashboard-theme md-content .nr-dashboard-form form md-input-container md-switch .md-bar {
background-color: rgba(111, 111, 111, 0.5);
}
.nr-dashboard-theme md-content .nr-dashboard-form form md-input-container md-switch .md-thumb {
background-color: rgb(148, 148, 148);
}
.nr-dashboard-theme md-content .nr-dashboard-form form md-input-container md-switch.md-checked .md-bar {
background-color: lighten(@widgetBackgroundColor, 10);
}
.nr-dashboard-theme md-content .nr-dashboard-form form md-input-container md-switch.md-checked .md-thumb {
background-color: @widgetBackgroundColor;
}
.nr-dashboard-theme md-content .nr-dashboard-form form md-datepicker {
background-color: inherit;
}
.nr-dashboard-theme md-content .nr-dashboard-form form .md-datepicker-calendar-icon {
fill: @groupTextColor;
}
.nr-dashboard-theme md-content .nr-dashboard-form form .md-datepicker-open .md-datepicker-calendar-icon {
fill: @widgetBackgroundColor ;
}
.nr-dashboard-theme md-content .nr-dashboard-form form .md-datepicker-input {
color: @widgetTextColor;
}
.nr-dashboard-theme md-content .nr-dashboard-form form .md-datepicker-input-container {
border-color: @widgetTextColor;;
}
.nr-dashboard-theme md-content .nr-dashboard-form form .md-datepicker-expand-triangle{
border-top-color: @widgetBackgroundColor ;
}
.nr-dashboard-theme md-content .nr-dashboard-form form md-input-container .md-input {
color: @widgetTextColor;
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
CACHE MANIFEST
# Time: Tue Jan 03 2023 15:45:18 GMT+0000 (Greenwich Mean Time)
CACHE:
i18n.js
icon120x120.png
icon192x192.png
icon64x64.png
css/app.min.css
css/app.min.less
css/gridstack-extra.min.css
js/app.min.js
js/tinycolor-min.js
socket.io/socket.io.js
fonts/MaterialIcons-Regular.woff
fonts/MaterialIcons-Regular.woff2
fonts/fontawesome-webfont.woff
fonts/fontawesome-webfont.woff2
fonts/weather-icons-lite.woff
fonts/weather-icons-lite.woff2
gs/gridstack.jQueryUI.min.js
gs/gridstack.min.css
gs/gridstack.min.js
loading.html
NETWORK:
*
# hash: 4e1747f9d470381b38d72b730cdfbe144f536fa6303dece638a15db835a4612e

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,4 @@
// Placeholder only - This is NOT a sustainable solution to i18n localisation
// Replace/overwrite this file with an angular-locale_... file of your choice from the npm angular-i18n project
// Then edit dashboard.appcache - (for example add a digit to the hash)
// Stop, start Node-RED and refresh the browser page twice to flush the cache.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -0,0 +1,17 @@
<!DOCTYPE html> <!--
Copyright 2016,2019 JS Foundation and other contributors, https://js.foundation/
Copyright 2016 IBM Corp.
Copyright 2015 Andrei Tatar
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--> <!-- <html> --> <html> <!-- manifest="dashboard.appcache"> --> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> <meta name="apple-mobile-web-app-title" content="Node-RED"> <meta name="mobile-web-app-capable" content="yes"> <meta name="theme-color" content="#097479"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <link rel="manifest" href="manifest.json" crossorigin="use-credentials"> <link rel="icon" sizes="192x192" href="icon192x192.png"> <link rel="shortcut icon" type="image/png" href="icon64x64.png"> <link rel="apple-touch-icon" href="icon120x120.png"> <link rel="stylesheet" href="css/app.min.css"> <link rel="stylesheet/less" href="css/app.min.less"> <title></title> </head> <body id="nr-dashboard" ng-app="ui" ng-controller="MainController as main" ng-cloak layout="column" style="background: {{main.backgroundColor}}" class="nr-dashboard-theme" ng-swipe-right="onSwipeRight();" ng-swipe-left="onSwipeLeft();" ng-attr-ng-swipe-disable-mouse="{{main.allowSwipe !== 'mouse' ? '' : undefined}}"> <md-content ng-if="main.loaded" ng-include="'partials/main.html'" layout="column" flex></md-content> <div ng-if="!main.loaded && !main.nothing" ng-include="'loading.html'" class="node-red-ui--loading"></div> <div ng-if="main.nothing" class="node-red-ui--notabs"> <table><tr><td><center><img src="icon120x120.png"></center></td></tr> <tr><td><center><h2>Welcome to the Node-RED Dashboard</h2></center></td></tr> <tr><td><center>Please add some UI nodes to your flow and redeploy.</center></td></tr></table> </div> <script src="socket.io/socket.io.js"></script> <script src="js/app.min.js"></script> <script src="i18n.js"></script> </body> </html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,7 @@
/// <reference types="node" />
import { EventEmitter } from 'events';
import { EventNames, EventListenerParameters, AbortSignal } from './types';
export interface OnceOptions {
signal?: AbortSignal;
}
export default function once<Emitter extends EventEmitter, Event extends EventNames<Emitter>>(emitter: Emitter, name: Event, { signal }?: OnceOptions): Promise<EventListenerParameters<Emitter, Event>>;

View file

@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function once(emitter, name, { signal } = {}) {
return new Promise((resolve, reject) => {
function cleanup() {
signal === null || signal === void 0 ? void 0 : signal.removeEventListener('abort', cleanup);
emitter.removeListener(name, onEvent);
emitter.removeListener('error', onError);
}
function onEvent(...args) {
cleanup();
resolve(args);
}
function onError(err) {
cleanup();
reject(err);
}
signal === null || signal === void 0 ? void 0 : signal.addEventListener('abort', cleanup);
emitter.on(name, onEvent);
emitter.on('error', onError);
});
}
exports.default = once;
//# sourceMappingURL=index.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAOA,SAAwB,IAAI,CAI3B,OAAgB,EAChB,IAAW,EACX,EAAE,MAAM,KAAkB,EAAE;IAE5B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACtC,SAAS,OAAO;YACf,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC9C,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACtC,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC1C,CAAC;QACD,SAAS,OAAO,CAAC,GAAG,IAAW;YAC9B,OAAO,EAAE,CAAC;YACV,OAAO,CAAC,IAA+C,CAAC,CAAC;QAC1D,CAAC;QACD,SAAS,OAAO,CAAC,GAAU;YAC1B,OAAO,EAAE,CAAC;YACV,MAAM,CAAC,GAAG,CAAC,CAAC;QACb,CAAC;QACD,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC3C,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC1B,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;AACJ,CAAC;AA1BD,uBA0BC"}

View file

@ -0,0 +1,231 @@
export declare type OverloadedParameters<T> = T extends {
(...args: infer A1): any;
(...args: infer A2): any;
(...args: infer A3): any;
(...args: infer A4): any;
(...args: infer A5): any;
(...args: infer A6): any;
(...args: infer A7): any;
(...args: infer A8): any;
(...args: infer A9): any;
(...args: infer A10): any;
(...args: infer A11): any;
(...args: infer A12): any;
(...args: infer A13): any;
(...args: infer A14): any;
(...args: infer A15): any;
(...args: infer A16): any;
(...args: infer A17): any;
(...args: infer A18): any;
(...args: infer A19): any;
(...args: infer A20): any;
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 | A15 | A16 | A17 | A18 | A19 | A20 : T extends {
(...args: infer A1): any;
(...args: infer A2): any;
(...args: infer A3): any;
(...args: infer A4): any;
(...args: infer A5): any;
(...args: infer A6): any;
(...args: infer A7): any;
(...args: infer A8): any;
(...args: infer A9): any;
(...args: infer A10): any;
(...args: infer A11): any;
(...args: infer A12): any;
(...args: infer A13): any;
(...args: infer A14): any;
(...args: infer A15): any;
(...args: infer A16): any;
(...args: infer A17): any;
(...args: infer A18): any;
(...args: infer A19): any;
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 | A15 | A16 | A17 | A18 | A19 : T extends {
(...args: infer A1): any;
(...args: infer A2): any;
(...args: infer A3): any;
(...args: infer A4): any;
(...args: infer A5): any;
(...args: infer A6): any;
(...args: infer A7): any;
(...args: infer A8): any;
(...args: infer A9): any;
(...args: infer A10): any;
(...args: infer A11): any;
(...args: infer A12): any;
(...args: infer A13): any;
(...args: infer A14): any;
(...args: infer A15): any;
(...args: infer A16): any;
(...args: infer A17): any;
(...args: infer A18): any;
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 | A15 | A16 | A17 | A18 : T extends {
(...args: infer A1): any;
(...args: infer A2): any;
(...args: infer A3): any;
(...args: infer A4): any;
(...args: infer A5): any;
(...args: infer A6): any;
(...args: infer A7): any;
(...args: infer A8): any;
(...args: infer A9): any;
(...args: infer A10): any;
(...args: infer A11): any;
(...args: infer A12): any;
(...args: infer A13): any;
(...args: infer A14): any;
(...args: infer A15): any;
(...args: infer A16): any;
(...args: infer A17): any;
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 | A15 | A16 | A17 : T extends {
(...args: infer A1): any;
(...args: infer A2): any;
(...args: infer A3): any;
(...args: infer A4): any;
(...args: infer A5): any;
(...args: infer A6): any;
(...args: infer A7): any;
(...args: infer A8): any;
(...args: infer A9): any;
(...args: infer A10): any;
(...args: infer A11): any;
(...args: infer A12): any;
(...args: infer A13): any;
(...args: infer A14): any;
(...args: infer A15): any;
(...args: infer A16): any;
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 | A15 | A16 : T extends {
(...args: infer A1): any;
(...args: infer A2): any;
(...args: infer A3): any;
(...args: infer A4): any;
(...args: infer A5): any;
(...args: infer A6): any;
(...args: infer A7): any;
(...args: infer A8): any;
(...args: infer A9): any;
(...args: infer A10): any;
(...args: infer A11): any;
(...args: infer A12): any;
(...args: infer A13): any;
(...args: infer A14): any;
(...args: infer A15): any;
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 | A15 : T extends {
(...args: infer A1): any;
(...args: infer A2): any;
(...args: infer A3): any;
(...args: infer A4): any;
(...args: infer A5): any;
(...args: infer A6): any;
(...args: infer A7): any;
(...args: infer A8): any;
(...args: infer A9): any;
(...args: infer A10): any;
(...args: infer A11): any;
(...args: infer A12): any;
(...args: infer A13): any;
(...args: infer A14): any;
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 : T extends {
(...args: infer A1): any;
(...args: infer A2): any;
(...args: infer A3): any;
(...args: infer A4): any;
(...args: infer A5): any;
(...args: infer A6): any;
(...args: infer A7): any;
(...args: infer A8): any;
(...args: infer A9): any;
(...args: infer A10): any;
(...args: infer A11): any;
(...args: infer A12): any;
(...args: infer A13): any;
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 : T extends {
(...args: infer A1): any;
(...args: infer A2): any;
(...args: infer A3): any;
(...args: infer A4): any;
(...args: infer A5): any;
(...args: infer A6): any;
(...args: infer A7): any;
(...args: infer A8): any;
(...args: infer A9): any;
(...args: infer A10): any;
(...args: infer A11): any;
(...args: infer A12): any;
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 : T extends {
(...args: infer A1): any;
(...args: infer A2): any;
(...args: infer A3): any;
(...args: infer A4): any;
(...args: infer A5): any;
(...args: infer A6): any;
(...args: infer A7): any;
(...args: infer A8): any;
(...args: infer A9): any;
(...args: infer A10): any;
(...args: infer A11): any;
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 : T extends {
(...args: infer A1): any;
(...args: infer A2): any;
(...args: infer A3): any;
(...args: infer A4): any;
(...args: infer A5): any;
(...args: infer A6): any;
(...args: infer A7): any;
(...args: infer A8): any;
(...args: infer A9): any;
(...args: infer A10): any;
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 : T extends {
(...args: infer A1): any;
(...args: infer A2): any;
(...args: infer A3): any;
(...args: infer A4): any;
(...args: infer A5): any;
(...args: infer A6): any;
(...args: infer A7): any;
(...args: infer A8): any;
(...args: infer A9): any;
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 : T extends {
(...args: infer A1): any;
(...args: infer A2): any;
(...args: infer A3): any;
(...args: infer A4): any;
(...args: infer A5): any;
(...args: infer A6): any;
(...args: infer A7): any;
(...args: infer A8): any;
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 : T extends {
(...args: infer A1): any;
(...args: infer A2): any;
(...args: infer A3): any;
(...args: infer A4): any;
(...args: infer A5): any;
(...args: infer A6): any;
(...args: infer A7): any;
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 : T extends {
(...args: infer A1): any;
(...args: infer A2): any;
(...args: infer A3): any;
(...args: infer A4): any;
(...args: infer A5): any;
(...args: infer A6): any;
} ? A1 | A2 | A3 | A4 | A5 | A6 : T extends {
(...args: infer A1): any;
(...args: infer A2): any;
(...args: infer A3): any;
(...args: infer A4): any;
(...args: infer A5): any;
} ? A1 | A2 | A3 | A4 | A5 : T extends {
(...args: infer A1): any;
(...args: infer A2): any;
(...args: infer A3): any;
(...args: infer A4): any;
} ? A1 | A2 | A3 | A4 : T extends {
(...args: infer A1): any;
(...args: infer A2): any;
(...args: infer A3): any;
} ? A1 | A2 | A3 : T extends {
(...args: infer A1): any;
(...args: infer A2): any;
} ? A1 | A2 : T extends {
(...args: infer A1): any;
} ? A1 : any;

View file

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=overloaded-parameters.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"overloaded-parameters.js","sourceRoot":"","sources":["../src/overloaded-parameters.ts"],"names":[],"mappings":""}

View file

@ -0,0 +1,17 @@
/// <reference types="node" />
import { EventEmitter } from 'events';
import { OverloadedParameters } from './overloaded-parameters';
export declare type FirstParameter<T> = T extends [infer R, ...any[]] ? R : never;
export declare type EventListener<F, T extends string | symbol> = F extends [
T,
infer R,
...any[]
] ? R : never;
export declare type EventParameters<Emitter extends EventEmitter> = OverloadedParameters<Emitter['on']>;
export declare type EventNames<Emitter extends EventEmitter> = FirstParameter<EventParameters<Emitter>>;
export declare type EventListenerParameters<Emitter extends EventEmitter, Event extends EventNames<Emitter>> = WithDefault<Parameters<EventListener<EventParameters<Emitter>, Event>>, unknown[]>;
export declare type WithDefault<T, D> = [T] extends [never] ? D : T;
export interface AbortSignal {
addEventListener: (name: string, listener: (...args: any[]) => any) => void;
removeEventListener: (name: string, listener: (...args: any[]) => any) => void;
}

View file

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=types.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}

View file

@ -0,0 +1,43 @@
import { EventTarget } from "event-target-shim"
type Events = {
abort: any
}
type EventAttributes = {
onabort: any
}
/**
* The signal class.
* @see https://dom.spec.whatwg.org/#abortsignal
*/
declare class AbortSignal extends EventTarget<Events, EventAttributes> {
/**
* AbortSignal cannot be constructed directly.
*/
constructor()
/**
* Returns `true` if this `AbortSignal`"s `AbortController` has signaled to abort, and `false` otherwise.
*/
readonly aborted: boolean
}
/**
* The AbortController.
* @see https://dom.spec.whatwg.org/#abortcontroller
*/
declare class AbortController {
/**
* Initialize this controller.
*/
constructor()
/**
* Returns the `AbortSignal` object associated with this object.
*/
readonly signal: AbortSignal
/**
* Abort and signal to any observers that the associated activity is to be aborted.
*/
abort(): void
}
export default AbortController
export { AbortController, AbortSignal }

View file

@ -0,0 +1,127 @@
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var eventTargetShim = require('event-target-shim');
/**
* The signal class.
* @see https://dom.spec.whatwg.org/#abortsignal
*/
class AbortSignal extends eventTargetShim.EventTarget {
/**
* AbortSignal cannot be constructed directly.
*/
constructor() {
super();
throw new TypeError("AbortSignal cannot be constructed directly");
}
/**
* Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise.
*/
get aborted() {
const aborted = abortedFlags.get(this);
if (typeof aborted !== "boolean") {
throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this === null ? "null" : typeof this}`);
}
return aborted;
}
}
eventTargetShim.defineEventAttribute(AbortSignal.prototype, "abort");
/**
* Create an AbortSignal object.
*/
function createAbortSignal() {
const signal = Object.create(AbortSignal.prototype);
eventTargetShim.EventTarget.call(signal);
abortedFlags.set(signal, false);
return signal;
}
/**
* Abort a given signal.
*/
function abortSignal(signal) {
if (abortedFlags.get(signal) !== false) {
return;
}
abortedFlags.set(signal, true);
signal.dispatchEvent({ type: "abort" });
}
/**
* Aborted flag for each instances.
*/
const abortedFlags = new WeakMap();
// Properties should be enumerable.
Object.defineProperties(AbortSignal.prototype, {
aborted: { enumerable: true },
});
// `toString()` should return `"[object AbortSignal]"`
if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {
configurable: true,
value: "AbortSignal",
});
}
/**
* The AbortController.
* @see https://dom.spec.whatwg.org/#abortcontroller
*/
class AbortController {
/**
* Initialize this controller.
*/
constructor() {
signals.set(this, createAbortSignal());
}
/**
* Returns the `AbortSignal` object associated with this object.
*/
get signal() {
return getSignal(this);
}
/**
* Abort and signal to any observers that the associated activity is to be aborted.
*/
abort() {
abortSignal(getSignal(this));
}
}
/**
* Associated signals.
*/
const signals = new WeakMap();
/**
* Get the associated signal of a given controller.
*/
function getSignal(controller) {
const signal = signals.get(controller);
if (signal == null) {
throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${controller === null ? "null" : typeof controller}`);
}
return signal;
}
// Properties should be enumerable.
Object.defineProperties(AbortController.prototype, {
signal: { enumerable: true },
abort: { enumerable: true },
});
if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
Object.defineProperty(AbortController.prototype, Symbol.toStringTag, {
configurable: true,
value: "AbortController",
});
}
exports.AbortController = AbortController;
exports.AbortSignal = AbortSignal;
exports.default = AbortController;
module.exports = AbortController
module.exports.AbortController = module.exports["default"] = AbortController
module.exports.AbortSignal = AbortSignal
//# sourceMappingURL=abort-controller.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,118 @@
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
import { EventTarget, defineEventAttribute } from 'event-target-shim';
/**
* The signal class.
* @see https://dom.spec.whatwg.org/#abortsignal
*/
class AbortSignal extends EventTarget {
/**
* AbortSignal cannot be constructed directly.
*/
constructor() {
super();
throw new TypeError("AbortSignal cannot be constructed directly");
}
/**
* Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise.
*/
get aborted() {
const aborted = abortedFlags.get(this);
if (typeof aborted !== "boolean") {
throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this === null ? "null" : typeof this}`);
}
return aborted;
}
}
defineEventAttribute(AbortSignal.prototype, "abort");
/**
* Create an AbortSignal object.
*/
function createAbortSignal() {
const signal = Object.create(AbortSignal.prototype);
EventTarget.call(signal);
abortedFlags.set(signal, false);
return signal;
}
/**
* Abort a given signal.
*/
function abortSignal(signal) {
if (abortedFlags.get(signal) !== false) {
return;
}
abortedFlags.set(signal, true);
signal.dispatchEvent({ type: "abort" });
}
/**
* Aborted flag for each instances.
*/
const abortedFlags = new WeakMap();
// Properties should be enumerable.
Object.defineProperties(AbortSignal.prototype, {
aborted: { enumerable: true },
});
// `toString()` should return `"[object AbortSignal]"`
if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {
configurable: true,
value: "AbortSignal",
});
}
/**
* The AbortController.
* @see https://dom.spec.whatwg.org/#abortcontroller
*/
class AbortController {
/**
* Initialize this controller.
*/
constructor() {
signals.set(this, createAbortSignal());
}
/**
* Returns the `AbortSignal` object associated with this object.
*/
get signal() {
return getSignal(this);
}
/**
* Abort and signal to any observers that the associated activity is to be aborted.
*/
abort() {
abortSignal(getSignal(this));
}
}
/**
* Associated signals.
*/
const signals = new WeakMap();
/**
* Get the associated signal of a given controller.
*/
function getSignal(controller) {
const signal = signals.get(controller);
if (signal == null) {
throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${controller === null ? "null" : typeof controller}`);
}
return signal;
}
// Properties should be enumerable.
Object.defineProperties(AbortController.prototype, {
signal: { enumerable: true },
abort: { enumerable: true },
});
if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
Object.defineProperty(AbortController.prototype, Symbol.toStringTag, {
configurable: true,
value: "AbortController",
});
}
export default AbortController;
export { AbortController, AbortSignal };
//# sourceMappingURL=abort-controller.mjs.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,78 @@
/// <reference types="node" />
import net from 'net';
import http from 'http';
import https from 'https';
import { Duplex } from 'stream';
import { EventEmitter } from 'events';
declare function createAgent(opts?: createAgent.AgentOptions): createAgent.Agent;
declare function createAgent(callback: createAgent.AgentCallback, opts?: createAgent.AgentOptions): createAgent.Agent;
declare namespace createAgent {
interface ClientRequest extends http.ClientRequest {
_last?: boolean;
_hadError?: boolean;
method: string;
}
interface AgentRequestOptions {
host?: string;
path?: string;
port: number;
}
interface HttpRequestOptions extends AgentRequestOptions, Omit<http.RequestOptions, keyof AgentRequestOptions> {
secureEndpoint: false;
}
interface HttpsRequestOptions extends AgentRequestOptions, Omit<https.RequestOptions, keyof AgentRequestOptions> {
secureEndpoint: true;
}
type RequestOptions = HttpRequestOptions | HttpsRequestOptions;
type AgentLike = Pick<createAgent.Agent, 'addRequest'> | http.Agent;
type AgentCallbackReturn = Duplex | AgentLike;
type AgentCallbackCallback = (err?: Error | null, socket?: createAgent.AgentCallbackReturn) => void;
type AgentCallbackPromise = (req: createAgent.ClientRequest, opts: createAgent.RequestOptions) => createAgent.AgentCallbackReturn | Promise<createAgent.AgentCallbackReturn>;
type AgentCallback = typeof Agent.prototype.callback;
type AgentOptions = {
timeout?: number;
};
/**
* Base `http.Agent` implementation.
* No pooling/keep-alive is implemented by default.
*
* @param {Function} callback
* @api public
*/
class Agent extends EventEmitter {
timeout: number | null;
maxFreeSockets: number;
maxTotalSockets: number;
maxSockets: number;
sockets: {
[key: string]: net.Socket[];
};
freeSockets: {
[key: string]: net.Socket[];
};
requests: {
[key: string]: http.IncomingMessage[];
};
options: https.AgentOptions;
private promisifiedCallback?;
private explicitDefaultPort?;
private explicitProtocol?;
constructor(callback?: createAgent.AgentCallback | createAgent.AgentOptions, _opts?: createAgent.AgentOptions);
get defaultPort(): number;
set defaultPort(v: number);
get protocol(): string;
set protocol(v: string);
callback(req: createAgent.ClientRequest, opts: createAgent.RequestOptions, fn: createAgent.AgentCallbackCallback): void;
callback(req: createAgent.ClientRequest, opts: createAgent.RequestOptions): createAgent.AgentCallbackReturn | Promise<createAgent.AgentCallbackReturn>;
/**
* Called by node-core's "_http_client.js" module when creating
* a new HTTP request with this Agent instance.
*
* @api public
*/
addRequest(req: ClientRequest, _opts: RequestOptions): void;
freeSocket(socket: net.Socket, opts: AgentOptions): void;
destroy(): void;
}
}
export = createAgent;

View file

@ -0,0 +1,203 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
const events_1 = require("events");
const debug_1 = __importDefault(require("debug"));
const promisify_1 = __importDefault(require("./promisify"));
const debug = debug_1.default('agent-base');
function isAgent(v) {
return Boolean(v) && typeof v.addRequest === 'function';
}
function isSecureEndpoint() {
const { stack } = new Error();
if (typeof stack !== 'string')
return false;
return stack.split('\n').some(l => l.indexOf('(https.js:') !== -1 || l.indexOf('node:https:') !== -1);
}
function createAgent(callback, opts) {
return new createAgent.Agent(callback, opts);
}
(function (createAgent) {
/**
* Base `http.Agent` implementation.
* No pooling/keep-alive is implemented by default.
*
* @param {Function} callback
* @api public
*/
class Agent extends events_1.EventEmitter {
constructor(callback, _opts) {
super();
let opts = _opts;
if (typeof callback === 'function') {
this.callback = callback;
}
else if (callback) {
opts = callback;
}
// Timeout for the socket to be returned from the callback
this.timeout = null;
if (opts && typeof opts.timeout === 'number') {
this.timeout = opts.timeout;
}
// These aren't actually used by `agent-base`, but are required
// for the TypeScript definition files in `@types/node` :/
this.maxFreeSockets = 1;
this.maxSockets = 1;
this.maxTotalSockets = Infinity;
this.sockets = {};
this.freeSockets = {};
this.requests = {};
this.options = {};
}
get defaultPort() {
if (typeof this.explicitDefaultPort === 'number') {
return this.explicitDefaultPort;
}
return isSecureEndpoint() ? 443 : 80;
}
set defaultPort(v) {
this.explicitDefaultPort = v;
}
get protocol() {
if (typeof this.explicitProtocol === 'string') {
return this.explicitProtocol;
}
return isSecureEndpoint() ? 'https:' : 'http:';
}
set protocol(v) {
this.explicitProtocol = v;
}
callback(req, opts, fn) {
throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`');
}
/**
* Called by node-core's "_http_client.js" module when creating
* a new HTTP request with this Agent instance.
*
* @api public
*/
addRequest(req, _opts) {
const opts = Object.assign({}, _opts);
if (typeof opts.secureEndpoint !== 'boolean') {
opts.secureEndpoint = isSecureEndpoint();
}
if (opts.host == null) {
opts.host = 'localhost';
}
if (opts.port == null) {
opts.port = opts.secureEndpoint ? 443 : 80;
}
if (opts.protocol == null) {
opts.protocol = opts.secureEndpoint ? 'https:' : 'http:';
}
if (opts.host && opts.path) {
// If both a `host` and `path` are specified then it's most
// likely the result of a `url.parse()` call... we need to
// remove the `path` portion so that `net.connect()` doesn't
// attempt to open that as a unix socket file.
delete opts.path;
}
delete opts.agent;
delete opts.hostname;
delete opts._defaultAgent;
delete opts.defaultPort;
delete opts.createConnection;
// Hint to use "Connection: close"
// XXX: non-documented `http` module API :(
req._last = true;
req.shouldKeepAlive = false;
let timedOut = false;
let timeoutId = null;
const timeoutMs = opts.timeout || this.timeout;
const onerror = (err) => {
if (req._hadError)
return;
req.emit('error', err);
// For Safety. Some additional errors might fire later on
// and we need to make sure we don't double-fire the error event.
req._hadError = true;
};
const ontimeout = () => {
timeoutId = null;
timedOut = true;
const err = new Error(`A "socket" was not created for HTTP request before ${timeoutMs}ms`);
err.code = 'ETIMEOUT';
onerror(err);
};
const callbackError = (err) => {
if (timedOut)
return;
if (timeoutId !== null) {
clearTimeout(timeoutId);
timeoutId = null;
}
onerror(err);
};
const onsocket = (socket) => {
if (timedOut)
return;
if (timeoutId != null) {
clearTimeout(timeoutId);
timeoutId = null;
}
if (isAgent(socket)) {
// `socket` is actually an `http.Agent` instance, so
// relinquish responsibility for this `req` to the Agent
// from here on
debug('Callback returned another Agent instance %o', socket.constructor.name);
socket.addRequest(req, opts);
return;
}
if (socket) {
socket.once('free', () => {
this.freeSocket(socket, opts);
});
req.onSocket(socket);
return;
}
const err = new Error(`no Duplex stream was returned to agent-base for \`${req.method} ${req.path}\``);
onerror(err);
};
if (typeof this.callback !== 'function') {
onerror(new Error('`callback` is not defined'));
return;
}
if (!this.promisifiedCallback) {
if (this.callback.length >= 3) {
debug('Converting legacy callback function to promise');
this.promisifiedCallback = promisify_1.default(this.callback);
}
else {
this.promisifiedCallback = this.callback;
}
}
if (typeof timeoutMs === 'number' && timeoutMs > 0) {
timeoutId = setTimeout(ontimeout, timeoutMs);
}
if ('port' in opts && typeof opts.port !== 'number') {
opts.port = Number(opts.port);
}
try {
debug('Resolving socket for %o request: %o', opts.protocol, `${req.method} ${req.path}`);
Promise.resolve(this.promisifiedCallback(req, opts)).then(onsocket, callbackError);
}
catch (err) {
Promise.reject(err).catch(callbackError);
}
}
freeSocket(socket, opts) {
debug('Freeing socket %o %o', socket.constructor.name, opts);
socket.destroy();
}
destroy() {
debug('Destroying agent %o', this.constructor.name);
}
}
createAgent.Agent = Agent;
// So that `instanceof` works correctly
createAgent.prototype = createAgent.Agent.prototype;
})(createAgent || (createAgent = {}));
module.exports = createAgent;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,4 @@
import { ClientRequest, RequestOptions, AgentCallbackCallback, AgentCallbackPromise } from './index';
declare type LegacyCallback = (req: ClientRequest, opts: RequestOptions, fn: AgentCallbackCallback) => void;
export default function promisify(fn: LegacyCallback): AgentCallbackPromise;
export {};

View file

@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function promisify(fn) {
return function (req, opts) {
return new Promise((resolve, reject) => {
fn.call(this, req, opts, (err, rtn) => {
if (err) {
reject(err);
}
else {
resolve(rtn);
}
});
});
};
}
exports.default = promisify;
//# sourceMappingURL=promisify.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"promisify.js","sourceRoot":"","sources":["../../src/promisify.ts"],"names":[],"mappings":";;AAeA,SAAwB,SAAS,CAAC,EAAkB;IACnD,OAAO,UAAsB,GAAkB,EAAE,IAAoB;QACpE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtC,EAAE,CAAC,IAAI,CACN,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,CAAC,GAA6B,EAAE,GAAyB,EAAE,EAAE;gBAC5D,IAAI,GAAG,EAAE;oBACR,MAAM,CAAC,GAAG,CAAC,CAAC;iBACZ;qBAAM;oBACN,OAAO,CAAC,GAAG,CAAC,CAAC;iBACb;YACF,CAAC,CACD,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC;AACH,CAAC;AAjBD,4BAiBC"}

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,871 @@
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* @copyright 2015 Toru Nagashima. All rights reserved.
* See LICENSE file in root directory for full license.
*/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
/**
* @typedef {object} PrivateData
* @property {EventTarget} eventTarget The event target.
* @property {{type:string}} event The original event object.
* @property {number} eventPhase The current event phase.
* @property {EventTarget|null} currentTarget The current event target.
* @property {boolean} canceled The flag to prevent default.
* @property {boolean} stopped The flag to stop propagation.
* @property {boolean} immediateStopped The flag to stop propagation immediately.
* @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null.
* @property {number} timeStamp The unix time.
* @private
*/
/**
* Private data for event wrappers.
* @type {WeakMap<Event, PrivateData>}
* @private
*/
const privateData = new WeakMap();
/**
* Cache for wrapper classes.
* @type {WeakMap<Object, Function>}
* @private
*/
const wrappers = new WeakMap();
/**
* Get private data.
* @param {Event} event The event object to get private data.
* @returns {PrivateData} The private data of the event.
* @private
*/
function pd(event) {
const retv = privateData.get(event);
console.assert(
retv != null,
"'this' is expected an Event object, but got",
event
);
return retv
}
/**
* https://dom.spec.whatwg.org/#set-the-canceled-flag
* @param data {PrivateData} private data.
*/
function setCancelFlag(data) {
if (data.passiveListener != null) {
if (
typeof console !== "undefined" &&
typeof console.error === "function"
) {
console.error(
"Unable to preventDefault inside passive event listener invocation.",
data.passiveListener
);
}
return
}
if (!data.event.cancelable) {
return
}
data.canceled = true;
if (typeof data.event.preventDefault === "function") {
data.event.preventDefault();
}
}
/**
* @see https://dom.spec.whatwg.org/#interface-event
* @private
*/
/**
* The event wrapper.
* @constructor
* @param {EventTarget} eventTarget The event target of this dispatching.
* @param {Event|{type:string}} event The original event to wrap.
*/
function Event(eventTarget, event) {
privateData.set(this, {
eventTarget,
event,
eventPhase: 2,
currentTarget: eventTarget,
canceled: false,
stopped: false,
immediateStopped: false,
passiveListener: null,
timeStamp: event.timeStamp || Date.now(),
});
// https://heycam.github.io/webidl/#Unforgeable
Object.defineProperty(this, "isTrusted", { value: false, enumerable: true });
// Define accessors
const keys = Object.keys(event);
for (let i = 0; i < keys.length; ++i) {
const key = keys[i];
if (!(key in this)) {
Object.defineProperty(this, key, defineRedirectDescriptor(key));
}
}
}
// Should be enumerable, but class methods are not enumerable.
Event.prototype = {
/**
* The type of this event.
* @type {string}
*/
get type() {
return pd(this).event.type
},
/**
* The target of this event.
* @type {EventTarget}
*/
get target() {
return pd(this).eventTarget
},
/**
* The target of this event.
* @type {EventTarget}
*/
get currentTarget() {
return pd(this).currentTarget
},
/**
* @returns {EventTarget[]} The composed path of this event.
*/
composedPath() {
const currentTarget = pd(this).currentTarget;
if (currentTarget == null) {
return []
}
return [currentTarget]
},
/**
* Constant of NONE.
* @type {number}
*/
get NONE() {
return 0
},
/**
* Constant of CAPTURING_PHASE.
* @type {number}
*/
get CAPTURING_PHASE() {
return 1
},
/**
* Constant of AT_TARGET.
* @type {number}
*/
get AT_TARGET() {
return 2
},
/**
* Constant of BUBBLING_PHASE.
* @type {number}
*/
get BUBBLING_PHASE() {
return 3
},
/**
* The target of this event.
* @type {number}
*/
get eventPhase() {
return pd(this).eventPhase
},
/**
* Stop event bubbling.
* @returns {void}
*/
stopPropagation() {
const data = pd(this);
data.stopped = true;
if (typeof data.event.stopPropagation === "function") {
data.event.stopPropagation();
}
},
/**
* Stop event bubbling.
* @returns {void}
*/
stopImmediatePropagation() {
const data = pd(this);
data.stopped = true;
data.immediateStopped = true;
if (typeof data.event.stopImmediatePropagation === "function") {
data.event.stopImmediatePropagation();
}
},
/**
* The flag to be bubbling.
* @type {boolean}
*/
get bubbles() {
return Boolean(pd(this).event.bubbles)
},
/**
* The flag to be cancelable.
* @type {boolean}
*/
get cancelable() {
return Boolean(pd(this).event.cancelable)
},
/**
* Cancel this event.
* @returns {void}
*/
preventDefault() {
setCancelFlag(pd(this));
},
/**
* The flag to indicate cancellation state.
* @type {boolean}
*/
get defaultPrevented() {
return pd(this).canceled
},
/**
* The flag to be composed.
* @type {boolean}
*/
get composed() {
return Boolean(pd(this).event.composed)
},
/**
* The unix time of this event.
* @type {number}
*/
get timeStamp() {
return pd(this).timeStamp
},
/**
* The target of this event.
* @type {EventTarget}
* @deprecated
*/
get srcElement() {
return pd(this).eventTarget
},
/**
* The flag to stop event bubbling.
* @type {boolean}
* @deprecated
*/
get cancelBubble() {
return pd(this).stopped
},
set cancelBubble(value) {
if (!value) {
return
}
const data = pd(this);
data.stopped = true;
if (typeof data.event.cancelBubble === "boolean") {
data.event.cancelBubble = true;
}
},
/**
* The flag to indicate cancellation state.
* @type {boolean}
* @deprecated
*/
get returnValue() {
return !pd(this).canceled
},
set returnValue(value) {
if (!value) {
setCancelFlag(pd(this));
}
},
/**
* Initialize this event object. But do nothing under event dispatching.
* @param {string} type The event type.
* @param {boolean} [bubbles=false] The flag to be possible to bubble up.
* @param {boolean} [cancelable=false] The flag to be possible to cancel.
* @deprecated
*/
initEvent() {
// Do nothing.
},
};
// `constructor` is not enumerable.
Object.defineProperty(Event.prototype, "constructor", {
value: Event,
configurable: true,
writable: true,
});
// Ensure `event instanceof window.Event` is `true`.
if (typeof window !== "undefined" && typeof window.Event !== "undefined") {
Object.setPrototypeOf(Event.prototype, window.Event.prototype);
// Make association for wrappers.
wrappers.set(window.Event.prototype, Event);
}
/**
* Get the property descriptor to redirect a given property.
* @param {string} key Property name to define property descriptor.
* @returns {PropertyDescriptor} The property descriptor to redirect the property.
* @private
*/
function defineRedirectDescriptor(key) {
return {
get() {
return pd(this).event[key]
},
set(value) {
pd(this).event[key] = value;
},
configurable: true,
enumerable: true,
}
}
/**
* Get the property descriptor to call a given method property.
* @param {string} key Property name to define property descriptor.
* @returns {PropertyDescriptor} The property descriptor to call the method property.
* @private
*/
function defineCallDescriptor(key) {
return {
value() {
const event = pd(this).event;
return event[key].apply(event, arguments)
},
configurable: true,
enumerable: true,
}
}
/**
* Define new wrapper class.
* @param {Function} BaseEvent The base wrapper class.
* @param {Object} proto The prototype of the original event.
* @returns {Function} The defined wrapper class.
* @private
*/
function defineWrapper(BaseEvent, proto) {
const keys = Object.keys(proto);
if (keys.length === 0) {
return BaseEvent
}
/** CustomEvent */
function CustomEvent(eventTarget, event) {
BaseEvent.call(this, eventTarget, event);
}
CustomEvent.prototype = Object.create(BaseEvent.prototype, {
constructor: { value: CustomEvent, configurable: true, writable: true },
});
// Define accessors.
for (let i = 0; i < keys.length; ++i) {
const key = keys[i];
if (!(key in BaseEvent.prototype)) {
const descriptor = Object.getOwnPropertyDescriptor(proto, key);
const isFunc = typeof descriptor.value === "function";
Object.defineProperty(
CustomEvent.prototype,
key,
isFunc
? defineCallDescriptor(key)
: defineRedirectDescriptor(key)
);
}
}
return CustomEvent
}
/**
* Get the wrapper class of a given prototype.
* @param {Object} proto The prototype of the original event to get its wrapper.
* @returns {Function} The wrapper class.
* @private
*/
function getWrapper(proto) {
if (proto == null || proto === Object.prototype) {
return Event
}
let wrapper = wrappers.get(proto);
if (wrapper == null) {
wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto);
wrappers.set(proto, wrapper);
}
return wrapper
}
/**
* Wrap a given event to management a dispatching.
* @param {EventTarget} eventTarget The event target of this dispatching.
* @param {Object} event The event to wrap.
* @returns {Event} The wrapper instance.
* @private
*/
function wrapEvent(eventTarget, event) {
const Wrapper = getWrapper(Object.getPrototypeOf(event));
return new Wrapper(eventTarget, event)
}
/**
* Get the immediateStopped flag of a given event.
* @param {Event} event The event to get.
* @returns {boolean} The flag to stop propagation immediately.
* @private
*/
function isStopped(event) {
return pd(event).immediateStopped
}
/**
* Set the current event phase of a given event.
* @param {Event} event The event to set current target.
* @param {number} eventPhase New event phase.
* @returns {void}
* @private
*/
function setEventPhase(event, eventPhase) {
pd(event).eventPhase = eventPhase;
}
/**
* Set the current target of a given event.
* @param {Event} event The event to set current target.
* @param {EventTarget|null} currentTarget New current target.
* @returns {void}
* @private
*/
function setCurrentTarget(event, currentTarget) {
pd(event).currentTarget = currentTarget;
}
/**
* Set a passive listener of a given event.
* @param {Event} event The event to set current target.
* @param {Function|null} passiveListener New passive listener.
* @returns {void}
* @private
*/
function setPassiveListener(event, passiveListener) {
pd(event).passiveListener = passiveListener;
}
/**
* @typedef {object} ListenerNode
* @property {Function} listener
* @property {1|2|3} listenerType
* @property {boolean} passive
* @property {boolean} once
* @property {ListenerNode|null} next
* @private
*/
/**
* @type {WeakMap<object, Map<string, ListenerNode>>}
* @private
*/
const listenersMap = new WeakMap();
// Listener types
const CAPTURE = 1;
const BUBBLE = 2;
const ATTRIBUTE = 3;
/**
* Check whether a given value is an object or not.
* @param {any} x The value to check.
* @returns {boolean} `true` if the value is an object.
*/
function isObject(x) {
return x !== null && typeof x === "object" //eslint-disable-line no-restricted-syntax
}
/**
* Get listeners.
* @param {EventTarget} eventTarget The event target to get.
* @returns {Map<string, ListenerNode>} The listeners.
* @private
*/
function getListeners(eventTarget) {
const listeners = listenersMap.get(eventTarget);
if (listeners == null) {
throw new TypeError(
"'this' is expected an EventTarget object, but got another value."
)
}
return listeners
}
/**
* Get the property descriptor for the event attribute of a given event.
* @param {string} eventName The event name to get property descriptor.
* @returns {PropertyDescriptor} The property descriptor.
* @private
*/
function defineEventAttributeDescriptor(eventName) {
return {
get() {
const listeners = getListeners(this);
let node = listeners.get(eventName);
while (node != null) {
if (node.listenerType === ATTRIBUTE) {
return node.listener
}
node = node.next;
}
return null
},
set(listener) {
if (typeof listener !== "function" && !isObject(listener)) {
listener = null; // eslint-disable-line no-param-reassign
}
const listeners = getListeners(this);
// Traverse to the tail while removing old value.
let prev = null;
let node = listeners.get(eventName);
while (node != null) {
if (node.listenerType === ATTRIBUTE) {
// Remove old value.
if (prev !== null) {
prev.next = node.next;
} else if (node.next !== null) {
listeners.set(eventName, node.next);
} else {
listeners.delete(eventName);
}
} else {
prev = node;
}
node = node.next;
}
// Add new value.
if (listener !== null) {
const newNode = {
listener,
listenerType: ATTRIBUTE,
passive: false,
once: false,
next: null,
};
if (prev === null) {
listeners.set(eventName, newNode);
} else {
prev.next = newNode;
}
}
},
configurable: true,
enumerable: true,
}
}
/**
* Define an event attribute (e.g. `eventTarget.onclick`).
* @param {Object} eventTargetPrototype The event target prototype to define an event attrbite.
* @param {string} eventName The event name to define.
* @returns {void}
*/
function defineEventAttribute(eventTargetPrototype, eventName) {
Object.defineProperty(
eventTargetPrototype,
`on${eventName}`,
defineEventAttributeDescriptor(eventName)
);
}
/**
* Define a custom EventTarget with event attributes.
* @param {string[]} eventNames Event names for event attributes.
* @returns {EventTarget} The custom EventTarget.
* @private
*/
function defineCustomEventTarget(eventNames) {
/** CustomEventTarget */
function CustomEventTarget() {
EventTarget.call(this);
}
CustomEventTarget.prototype = Object.create(EventTarget.prototype, {
constructor: {
value: CustomEventTarget,
configurable: true,
writable: true,
},
});
for (let i = 0; i < eventNames.length; ++i) {
defineEventAttribute(CustomEventTarget.prototype, eventNames[i]);
}
return CustomEventTarget
}
/**
* EventTarget.
*
* - This is constructor if no arguments.
* - This is a function which returns a CustomEventTarget constructor if there are arguments.
*
* For example:
*
* class A extends EventTarget {}
* class B extends EventTarget("message") {}
* class C extends EventTarget("message", "error") {}
* class D extends EventTarget(["message", "error"]) {}
*/
function EventTarget() {
/*eslint-disable consistent-return */
if (this instanceof EventTarget) {
listenersMap.set(this, new Map());
return
}
if (arguments.length === 1 && Array.isArray(arguments[0])) {
return defineCustomEventTarget(arguments[0])
}
if (arguments.length > 0) {
const types = new Array(arguments.length);
for (let i = 0; i < arguments.length; ++i) {
types[i] = arguments[i];
}
return defineCustomEventTarget(types)
}
throw new TypeError("Cannot call a class as a function")
/*eslint-enable consistent-return */
}
// Should be enumerable, but class methods are not enumerable.
EventTarget.prototype = {
/**
* Add a given listener to this event target.
* @param {string} eventName The event name to add.
* @param {Function} listener The listener to add.
* @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
* @returns {void}
*/
addEventListener(eventName, listener, options) {
if (listener == null) {
return
}
if (typeof listener !== "function" && !isObject(listener)) {
throw new TypeError("'listener' should be a function or an object.")
}
const listeners = getListeners(this);
const optionsIsObj = isObject(options);
const capture = optionsIsObj
? Boolean(options.capture)
: Boolean(options);
const listenerType = capture ? CAPTURE : BUBBLE;
const newNode = {
listener,
listenerType,
passive: optionsIsObj && Boolean(options.passive),
once: optionsIsObj && Boolean(options.once),
next: null,
};
// Set it as the first node if the first node is null.
let node = listeners.get(eventName);
if (node === undefined) {
listeners.set(eventName, newNode);
return
}
// Traverse to the tail while checking duplication..
let prev = null;
while (node != null) {
if (
node.listener === listener &&
node.listenerType === listenerType
) {
// Should ignore duplication.
return
}
prev = node;
node = node.next;
}
// Add it.
prev.next = newNode;
},
/**
* Remove a given listener from this event target.
* @param {string} eventName The event name to remove.
* @param {Function} listener The listener to remove.
* @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
* @returns {void}
*/
removeEventListener(eventName, listener, options) {
if (listener == null) {
return
}
const listeners = getListeners(this);
const capture = isObject(options)
? Boolean(options.capture)
: Boolean(options);
const listenerType = capture ? CAPTURE : BUBBLE;
let prev = null;
let node = listeners.get(eventName);
while (node != null) {
if (
node.listener === listener &&
node.listenerType === listenerType
) {
if (prev !== null) {
prev.next = node.next;
} else if (node.next !== null) {
listeners.set(eventName, node.next);
} else {
listeners.delete(eventName);
}
return
}
prev = node;
node = node.next;
}
},
/**
* Dispatch a given event.
* @param {Event|{type:string}} event The event to dispatch.
* @returns {boolean} `false` if canceled.
*/
dispatchEvent(event) {
if (event == null || typeof event.type !== "string") {
throw new TypeError('"event.type" should be a string.')
}
// If listeners aren't registered, terminate.
const listeners = getListeners(this);
const eventName = event.type;
let node = listeners.get(eventName);
if (node == null) {
return true
}
// Since we cannot rewrite several properties, so wrap object.
const wrappedEvent = wrapEvent(this, event);
// This doesn't process capturing phase and bubbling phase.
// This isn't participating in a tree.
let prev = null;
while (node != null) {
// Remove this listener if it's once
if (node.once) {
if (prev !== null) {
prev.next = node.next;
} else if (node.next !== null) {
listeners.set(eventName, node.next);
} else {
listeners.delete(eventName);
}
} else {
prev = node;
}
// Call this listener
setPassiveListener(
wrappedEvent,
node.passive ? node.listener : null
);
if (typeof node.listener === "function") {
try {
node.listener.call(this, wrappedEvent);
} catch (err) {
if (
typeof console !== "undefined" &&
typeof console.error === "function"
) {
console.error(err);
}
}
} else if (
node.listenerType !== ATTRIBUTE &&
typeof node.listener.handleEvent === "function"
) {
node.listener.handleEvent(wrappedEvent);
}
// Break if `event.stopImmediatePropagation` was called.
if (isStopped(wrappedEvent)) {
break
}
node = node.next;
}
setPassiveListener(wrappedEvent, null);
setEventPhase(wrappedEvent, 0);
setCurrentTarget(wrappedEvent, null);
return !wrappedEvent.defaultPrevented
},
};
// `constructor` is not enumerable.
Object.defineProperty(EventTarget.prototype, "constructor", {
value: EventTarget,
configurable: true,
writable: true,
});
// Ensure `eventTarget instanceof window.EventTarget` is `true`.
if (
typeof window !== "undefined" &&
typeof window.EventTarget !== "undefined"
) {
Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype);
}
exports.defineEventAttribute = defineEventAttribute;
exports.EventTarget = EventTarget;
exports.default = EventTarget;
module.exports = EventTarget
module.exports.EventTarget = module.exports["default"] = EventTarget
module.exports.defineEventAttribute = defineEventAttribute
//# sourceMappingURL=event-target-shim.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,862 @@
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* @copyright 2015 Toru Nagashima. All rights reserved.
* See LICENSE file in root directory for full license.
*/
/**
* @typedef {object} PrivateData
* @property {EventTarget} eventTarget The event target.
* @property {{type:string}} event The original event object.
* @property {number} eventPhase The current event phase.
* @property {EventTarget|null} currentTarget The current event target.
* @property {boolean} canceled The flag to prevent default.
* @property {boolean} stopped The flag to stop propagation.
* @property {boolean} immediateStopped The flag to stop propagation immediately.
* @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null.
* @property {number} timeStamp The unix time.
* @private
*/
/**
* Private data for event wrappers.
* @type {WeakMap<Event, PrivateData>}
* @private
*/
const privateData = new WeakMap();
/**
* Cache for wrapper classes.
* @type {WeakMap<Object, Function>}
* @private
*/
const wrappers = new WeakMap();
/**
* Get private data.
* @param {Event} event The event object to get private data.
* @returns {PrivateData} The private data of the event.
* @private
*/
function pd(event) {
const retv = privateData.get(event);
console.assert(
retv != null,
"'this' is expected an Event object, but got",
event
);
return retv
}
/**
* https://dom.spec.whatwg.org/#set-the-canceled-flag
* @param data {PrivateData} private data.
*/
function setCancelFlag(data) {
if (data.passiveListener != null) {
if (
typeof console !== "undefined" &&
typeof console.error === "function"
) {
console.error(
"Unable to preventDefault inside passive event listener invocation.",
data.passiveListener
);
}
return
}
if (!data.event.cancelable) {
return
}
data.canceled = true;
if (typeof data.event.preventDefault === "function") {
data.event.preventDefault();
}
}
/**
* @see https://dom.spec.whatwg.org/#interface-event
* @private
*/
/**
* The event wrapper.
* @constructor
* @param {EventTarget} eventTarget The event target of this dispatching.
* @param {Event|{type:string}} event The original event to wrap.
*/
function Event(eventTarget, event) {
privateData.set(this, {
eventTarget,
event,
eventPhase: 2,
currentTarget: eventTarget,
canceled: false,
stopped: false,
immediateStopped: false,
passiveListener: null,
timeStamp: event.timeStamp || Date.now(),
});
// https://heycam.github.io/webidl/#Unforgeable
Object.defineProperty(this, "isTrusted", { value: false, enumerable: true });
// Define accessors
const keys = Object.keys(event);
for (let i = 0; i < keys.length; ++i) {
const key = keys[i];
if (!(key in this)) {
Object.defineProperty(this, key, defineRedirectDescriptor(key));
}
}
}
// Should be enumerable, but class methods are not enumerable.
Event.prototype = {
/**
* The type of this event.
* @type {string}
*/
get type() {
return pd(this).event.type
},
/**
* The target of this event.
* @type {EventTarget}
*/
get target() {
return pd(this).eventTarget
},
/**
* The target of this event.
* @type {EventTarget}
*/
get currentTarget() {
return pd(this).currentTarget
},
/**
* @returns {EventTarget[]} The composed path of this event.
*/
composedPath() {
const currentTarget = pd(this).currentTarget;
if (currentTarget == null) {
return []
}
return [currentTarget]
},
/**
* Constant of NONE.
* @type {number}
*/
get NONE() {
return 0
},
/**
* Constant of CAPTURING_PHASE.
* @type {number}
*/
get CAPTURING_PHASE() {
return 1
},
/**
* Constant of AT_TARGET.
* @type {number}
*/
get AT_TARGET() {
return 2
},
/**
* Constant of BUBBLING_PHASE.
* @type {number}
*/
get BUBBLING_PHASE() {
return 3
},
/**
* The target of this event.
* @type {number}
*/
get eventPhase() {
return pd(this).eventPhase
},
/**
* Stop event bubbling.
* @returns {void}
*/
stopPropagation() {
const data = pd(this);
data.stopped = true;
if (typeof data.event.stopPropagation === "function") {
data.event.stopPropagation();
}
},
/**
* Stop event bubbling.
* @returns {void}
*/
stopImmediatePropagation() {
const data = pd(this);
data.stopped = true;
data.immediateStopped = true;
if (typeof data.event.stopImmediatePropagation === "function") {
data.event.stopImmediatePropagation();
}
},
/**
* The flag to be bubbling.
* @type {boolean}
*/
get bubbles() {
return Boolean(pd(this).event.bubbles)
},
/**
* The flag to be cancelable.
* @type {boolean}
*/
get cancelable() {
return Boolean(pd(this).event.cancelable)
},
/**
* Cancel this event.
* @returns {void}
*/
preventDefault() {
setCancelFlag(pd(this));
},
/**
* The flag to indicate cancellation state.
* @type {boolean}
*/
get defaultPrevented() {
return pd(this).canceled
},
/**
* The flag to be composed.
* @type {boolean}
*/
get composed() {
return Boolean(pd(this).event.composed)
},
/**
* The unix time of this event.
* @type {number}
*/
get timeStamp() {
return pd(this).timeStamp
},
/**
* The target of this event.
* @type {EventTarget}
* @deprecated
*/
get srcElement() {
return pd(this).eventTarget
},
/**
* The flag to stop event bubbling.
* @type {boolean}
* @deprecated
*/
get cancelBubble() {
return pd(this).stopped
},
set cancelBubble(value) {
if (!value) {
return
}
const data = pd(this);
data.stopped = true;
if (typeof data.event.cancelBubble === "boolean") {
data.event.cancelBubble = true;
}
},
/**
* The flag to indicate cancellation state.
* @type {boolean}
* @deprecated
*/
get returnValue() {
return !pd(this).canceled
},
set returnValue(value) {
if (!value) {
setCancelFlag(pd(this));
}
},
/**
* Initialize this event object. But do nothing under event dispatching.
* @param {string} type The event type.
* @param {boolean} [bubbles=false] The flag to be possible to bubble up.
* @param {boolean} [cancelable=false] The flag to be possible to cancel.
* @deprecated
*/
initEvent() {
// Do nothing.
},
};
// `constructor` is not enumerable.
Object.defineProperty(Event.prototype, "constructor", {
value: Event,
configurable: true,
writable: true,
});
// Ensure `event instanceof window.Event` is `true`.
if (typeof window !== "undefined" && typeof window.Event !== "undefined") {
Object.setPrototypeOf(Event.prototype, window.Event.prototype);
// Make association for wrappers.
wrappers.set(window.Event.prototype, Event);
}
/**
* Get the property descriptor to redirect a given property.
* @param {string} key Property name to define property descriptor.
* @returns {PropertyDescriptor} The property descriptor to redirect the property.
* @private
*/
function defineRedirectDescriptor(key) {
return {
get() {
return pd(this).event[key]
},
set(value) {
pd(this).event[key] = value;
},
configurable: true,
enumerable: true,
}
}
/**
* Get the property descriptor to call a given method property.
* @param {string} key Property name to define property descriptor.
* @returns {PropertyDescriptor} The property descriptor to call the method property.
* @private
*/
function defineCallDescriptor(key) {
return {
value() {
const event = pd(this).event;
return event[key].apply(event, arguments)
},
configurable: true,
enumerable: true,
}
}
/**
* Define new wrapper class.
* @param {Function} BaseEvent The base wrapper class.
* @param {Object} proto The prototype of the original event.
* @returns {Function} The defined wrapper class.
* @private
*/
function defineWrapper(BaseEvent, proto) {
const keys = Object.keys(proto);
if (keys.length === 0) {
return BaseEvent
}
/** CustomEvent */
function CustomEvent(eventTarget, event) {
BaseEvent.call(this, eventTarget, event);
}
CustomEvent.prototype = Object.create(BaseEvent.prototype, {
constructor: { value: CustomEvent, configurable: true, writable: true },
});
// Define accessors.
for (let i = 0; i < keys.length; ++i) {
const key = keys[i];
if (!(key in BaseEvent.prototype)) {
const descriptor = Object.getOwnPropertyDescriptor(proto, key);
const isFunc = typeof descriptor.value === "function";
Object.defineProperty(
CustomEvent.prototype,
key,
isFunc
? defineCallDescriptor(key)
: defineRedirectDescriptor(key)
);
}
}
return CustomEvent
}
/**
* Get the wrapper class of a given prototype.
* @param {Object} proto The prototype of the original event to get its wrapper.
* @returns {Function} The wrapper class.
* @private
*/
function getWrapper(proto) {
if (proto == null || proto === Object.prototype) {
return Event
}
let wrapper = wrappers.get(proto);
if (wrapper == null) {
wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto);
wrappers.set(proto, wrapper);
}
return wrapper
}
/**
* Wrap a given event to management a dispatching.
* @param {EventTarget} eventTarget The event target of this dispatching.
* @param {Object} event The event to wrap.
* @returns {Event} The wrapper instance.
* @private
*/
function wrapEvent(eventTarget, event) {
const Wrapper = getWrapper(Object.getPrototypeOf(event));
return new Wrapper(eventTarget, event)
}
/**
* Get the immediateStopped flag of a given event.
* @param {Event} event The event to get.
* @returns {boolean} The flag to stop propagation immediately.
* @private
*/
function isStopped(event) {
return pd(event).immediateStopped
}
/**
* Set the current event phase of a given event.
* @param {Event} event The event to set current target.
* @param {number} eventPhase New event phase.
* @returns {void}
* @private
*/
function setEventPhase(event, eventPhase) {
pd(event).eventPhase = eventPhase;
}
/**
* Set the current target of a given event.
* @param {Event} event The event to set current target.
* @param {EventTarget|null} currentTarget New current target.
* @returns {void}
* @private
*/
function setCurrentTarget(event, currentTarget) {
pd(event).currentTarget = currentTarget;
}
/**
* Set a passive listener of a given event.
* @param {Event} event The event to set current target.
* @param {Function|null} passiveListener New passive listener.
* @returns {void}
* @private
*/
function setPassiveListener(event, passiveListener) {
pd(event).passiveListener = passiveListener;
}
/**
* @typedef {object} ListenerNode
* @property {Function} listener
* @property {1|2|3} listenerType
* @property {boolean} passive
* @property {boolean} once
* @property {ListenerNode|null} next
* @private
*/
/**
* @type {WeakMap<object, Map<string, ListenerNode>>}
* @private
*/
const listenersMap = new WeakMap();
// Listener types
const CAPTURE = 1;
const BUBBLE = 2;
const ATTRIBUTE = 3;
/**
* Check whether a given value is an object or not.
* @param {any} x The value to check.
* @returns {boolean} `true` if the value is an object.
*/
function isObject(x) {
return x !== null && typeof x === "object" //eslint-disable-line no-restricted-syntax
}
/**
* Get listeners.
* @param {EventTarget} eventTarget The event target to get.
* @returns {Map<string, ListenerNode>} The listeners.
* @private
*/
function getListeners(eventTarget) {
const listeners = listenersMap.get(eventTarget);
if (listeners == null) {
throw new TypeError(
"'this' is expected an EventTarget object, but got another value."
)
}
return listeners
}
/**
* Get the property descriptor for the event attribute of a given event.
* @param {string} eventName The event name to get property descriptor.
* @returns {PropertyDescriptor} The property descriptor.
* @private
*/
function defineEventAttributeDescriptor(eventName) {
return {
get() {
const listeners = getListeners(this);
let node = listeners.get(eventName);
while (node != null) {
if (node.listenerType === ATTRIBUTE) {
return node.listener
}
node = node.next;
}
return null
},
set(listener) {
if (typeof listener !== "function" && !isObject(listener)) {
listener = null; // eslint-disable-line no-param-reassign
}
const listeners = getListeners(this);
// Traverse to the tail while removing old value.
let prev = null;
let node = listeners.get(eventName);
while (node != null) {
if (node.listenerType === ATTRIBUTE) {
// Remove old value.
if (prev !== null) {
prev.next = node.next;
} else if (node.next !== null) {
listeners.set(eventName, node.next);
} else {
listeners.delete(eventName);
}
} else {
prev = node;
}
node = node.next;
}
// Add new value.
if (listener !== null) {
const newNode = {
listener,
listenerType: ATTRIBUTE,
passive: false,
once: false,
next: null,
};
if (prev === null) {
listeners.set(eventName, newNode);
} else {
prev.next = newNode;
}
}
},
configurable: true,
enumerable: true,
}
}
/**
* Define an event attribute (e.g. `eventTarget.onclick`).
* @param {Object} eventTargetPrototype The event target prototype to define an event attrbite.
* @param {string} eventName The event name to define.
* @returns {void}
*/
function defineEventAttribute(eventTargetPrototype, eventName) {
Object.defineProperty(
eventTargetPrototype,
`on${eventName}`,
defineEventAttributeDescriptor(eventName)
);
}
/**
* Define a custom EventTarget with event attributes.
* @param {string[]} eventNames Event names for event attributes.
* @returns {EventTarget} The custom EventTarget.
* @private
*/
function defineCustomEventTarget(eventNames) {
/** CustomEventTarget */
function CustomEventTarget() {
EventTarget.call(this);
}
CustomEventTarget.prototype = Object.create(EventTarget.prototype, {
constructor: {
value: CustomEventTarget,
configurable: true,
writable: true,
},
});
for (let i = 0; i < eventNames.length; ++i) {
defineEventAttribute(CustomEventTarget.prototype, eventNames[i]);
}
return CustomEventTarget
}
/**
* EventTarget.
*
* - This is constructor if no arguments.
* - This is a function which returns a CustomEventTarget constructor if there are arguments.
*
* For example:
*
* class A extends EventTarget {}
* class B extends EventTarget("message") {}
* class C extends EventTarget("message", "error") {}
* class D extends EventTarget(["message", "error"]) {}
*/
function EventTarget() {
/*eslint-disable consistent-return */
if (this instanceof EventTarget) {
listenersMap.set(this, new Map());
return
}
if (arguments.length === 1 && Array.isArray(arguments[0])) {
return defineCustomEventTarget(arguments[0])
}
if (arguments.length > 0) {
const types = new Array(arguments.length);
for (let i = 0; i < arguments.length; ++i) {
types[i] = arguments[i];
}
return defineCustomEventTarget(types)
}
throw new TypeError("Cannot call a class as a function")
/*eslint-enable consistent-return */
}
// Should be enumerable, but class methods are not enumerable.
EventTarget.prototype = {
/**
* Add a given listener to this event target.
* @param {string} eventName The event name to add.
* @param {Function} listener The listener to add.
* @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
* @returns {void}
*/
addEventListener(eventName, listener, options) {
if (listener == null) {
return
}
if (typeof listener !== "function" && !isObject(listener)) {
throw new TypeError("'listener' should be a function or an object.")
}
const listeners = getListeners(this);
const optionsIsObj = isObject(options);
const capture = optionsIsObj
? Boolean(options.capture)
: Boolean(options);
const listenerType = capture ? CAPTURE : BUBBLE;
const newNode = {
listener,
listenerType,
passive: optionsIsObj && Boolean(options.passive),
once: optionsIsObj && Boolean(options.once),
next: null,
};
// Set it as the first node if the first node is null.
let node = listeners.get(eventName);
if (node === undefined) {
listeners.set(eventName, newNode);
return
}
// Traverse to the tail while checking duplication..
let prev = null;
while (node != null) {
if (
node.listener === listener &&
node.listenerType === listenerType
) {
// Should ignore duplication.
return
}
prev = node;
node = node.next;
}
// Add it.
prev.next = newNode;
},
/**
* Remove a given listener from this event target.
* @param {string} eventName The event name to remove.
* @param {Function} listener The listener to remove.
* @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
* @returns {void}
*/
removeEventListener(eventName, listener, options) {
if (listener == null) {
return
}
const listeners = getListeners(this);
const capture = isObject(options)
? Boolean(options.capture)
: Boolean(options);
const listenerType = capture ? CAPTURE : BUBBLE;
let prev = null;
let node = listeners.get(eventName);
while (node != null) {
if (
node.listener === listener &&
node.listenerType === listenerType
) {
if (prev !== null) {
prev.next = node.next;
} else if (node.next !== null) {
listeners.set(eventName, node.next);
} else {
listeners.delete(eventName);
}
return
}
prev = node;
node = node.next;
}
},
/**
* Dispatch a given event.
* @param {Event|{type:string}} event The event to dispatch.
* @returns {boolean} `false` if canceled.
*/
dispatchEvent(event) {
if (event == null || typeof event.type !== "string") {
throw new TypeError('"event.type" should be a string.')
}
// If listeners aren't registered, terminate.
const listeners = getListeners(this);
const eventName = event.type;
let node = listeners.get(eventName);
if (node == null) {
return true
}
// Since we cannot rewrite several properties, so wrap object.
const wrappedEvent = wrapEvent(this, event);
// This doesn't process capturing phase and bubbling phase.
// This isn't participating in a tree.
let prev = null;
while (node != null) {
// Remove this listener if it's once
if (node.once) {
if (prev !== null) {
prev.next = node.next;
} else if (node.next !== null) {
listeners.set(eventName, node.next);
} else {
listeners.delete(eventName);
}
} else {
prev = node;
}
// Call this listener
setPassiveListener(
wrappedEvent,
node.passive ? node.listener : null
);
if (typeof node.listener === "function") {
try {
node.listener.call(this, wrappedEvent);
} catch (err) {
if (
typeof console !== "undefined" &&
typeof console.error === "function"
) {
console.error(err);
}
}
} else if (
node.listenerType !== ATTRIBUTE &&
typeof node.listener.handleEvent === "function"
) {
node.listener.handleEvent(wrappedEvent);
}
// Break if `event.stopImmediatePropagation` was called.
if (isStopped(wrappedEvent)) {
break
}
node = node.next;
}
setPassiveListener(wrappedEvent, null);
setEventPhase(wrappedEvent, 0);
setCurrentTarget(wrappedEvent, null);
return !wrappedEvent.defaultPrevented
},
};
// `constructor` is not enumerable.
Object.defineProperty(EventTarget.prototype, "constructor", {
value: EventTarget,
configurable: true,
writable: true,
});
// Ensure `eventTarget instanceof window.EventTarget` is `true`.
if (
typeof window !== "undefined" &&
typeof window.EventTarget !== "undefined"
) {
Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype);
}
export default EventTarget;
export { defineEventAttribute, EventTarget };
//# sourceMappingURL=event-target-shim.mjs.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,32 @@
/// <reference types="node" />
import net from 'net';
import { Agent, ClientRequest, RequestOptions } from 'agent-base';
import { HttpProxyAgentOptions } from '.';
interface HttpProxyAgentClientRequest extends ClientRequest {
path: string;
output?: string[];
outputData?: {
data: string;
}[];
_header?: string | null;
_implicitHeader(): void;
}
/**
* The `HttpProxyAgent` implements an HTTP Agent subclass that connects
* to the specified "HTTP proxy server" in order to proxy HTTP requests.
*
* @api public
*/
export default class HttpProxyAgent extends Agent {
private secureProxy;
private proxy;
constructor(_opts: string | HttpProxyAgentOptions);
/**
* Called when the node-core HTTP client library is creating a
* new HTTP request.
*
* @api protected
*/
callback(req: HttpProxyAgentClientRequest, opts: RequestOptions): Promise<net.Socket>;
}
export {};

View file

@ -0,0 +1,145 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const net_1 = __importDefault(require("net"));
const tls_1 = __importDefault(require("tls"));
const url_1 = __importDefault(require("url"));
const debug_1 = __importDefault(require("debug"));
const once_1 = __importDefault(require("@tootallnate/once"));
const agent_base_1 = require("agent-base");
const debug = (0, debug_1.default)('http-proxy-agent');
function isHTTPS(protocol) {
return typeof protocol === 'string' ? /^https:?$/i.test(protocol) : false;
}
/**
* The `HttpProxyAgent` implements an HTTP Agent subclass that connects
* to the specified "HTTP proxy server" in order to proxy HTTP requests.
*
* @api public
*/
class HttpProxyAgent extends agent_base_1.Agent {
constructor(_opts) {
let opts;
if (typeof _opts === 'string') {
opts = url_1.default.parse(_opts);
}
else {
opts = _opts;
}
if (!opts) {
throw new Error('an HTTP(S) proxy server `host` and `port` must be specified!');
}
debug('Creating new HttpProxyAgent instance: %o', opts);
super(opts);
const proxy = Object.assign({}, opts);
// If `true`, then connect to the proxy server over TLS.
// Defaults to `false`.
this.secureProxy = opts.secureProxy || isHTTPS(proxy.protocol);
// Prefer `hostname` over `host`, and set the `port` if needed.
proxy.host = proxy.hostname || proxy.host;
if (typeof proxy.port === 'string') {
proxy.port = parseInt(proxy.port, 10);
}
if (!proxy.port && proxy.host) {
proxy.port = this.secureProxy ? 443 : 80;
}
if (proxy.host && proxy.path) {
// If both a `host` and `path` are specified then it's most likely
// the result of a `url.parse()` call... we need to remove the
// `path` portion so that `net.connect()` doesn't attempt to open
// that as a Unix socket file.
delete proxy.path;
delete proxy.pathname;
}
this.proxy = proxy;
}
/**
* Called when the node-core HTTP client library is creating a
* new HTTP request.
*
* @api protected
*/
callback(req, opts) {
return __awaiter(this, void 0, void 0, function* () {
const { proxy, secureProxy } = this;
const parsed = url_1.default.parse(req.path);
if (!parsed.protocol) {
parsed.protocol = 'http:';
}
if (!parsed.hostname) {
parsed.hostname = opts.hostname || opts.host || null;
}
if (parsed.port == null && typeof opts.port) {
parsed.port = String(opts.port);
}
if (parsed.port === '80') {
// if port is 80, then we can remove the port so that the
// ":80" portion is not on the produced URL
parsed.port = '';
}
// Change the `http.ClientRequest` instance's "path" field
// to the absolute path of the URL that will be requested.
req.path = url_1.default.format(parsed);
// Inject the `Proxy-Authorization` header if necessary.
if (proxy.auth) {
req.setHeader('Proxy-Authorization', `Basic ${Buffer.from(proxy.auth).toString('base64')}`);
}
// Create a socket connection to the proxy server.
let socket;
if (secureProxy) {
debug('Creating `tls.Socket`: %o', proxy);
socket = tls_1.default.connect(proxy);
}
else {
debug('Creating `net.Socket`: %o', proxy);
socket = net_1.default.connect(proxy);
}
// At this point, the http ClientRequest's internal `_header` field
// might have already been set. If this is the case then we'll need
// to re-generate the string since we just changed the `req.path`.
if (req._header) {
let first;
let endOfHeaders;
debug('Regenerating stored HTTP header string for request');
req._header = null;
req._implicitHeader();
if (req.output && req.output.length > 0) {
// Node < 12
debug('Patching connection write() output buffer with updated header');
first = req.output[0];
endOfHeaders = first.indexOf('\r\n\r\n') + 4;
req.output[0] = req._header + first.substring(endOfHeaders);
debug('Output buffer: %o', req.output);
}
else if (req.outputData && req.outputData.length > 0) {
// Node >= 12
debug('Patching connection write() output buffer with updated header');
first = req.outputData[0].data;
endOfHeaders = first.indexOf('\r\n\r\n') + 4;
req.outputData[0].data =
req._header + first.substring(endOfHeaders);
debug('Output buffer: %o', req.outputData[0].data);
}
}
// Wait for the socket's `connect` event, so that this `callback()`
// function throws instead of the `http` request machinery. This is
// important for i.e. `PacProxyAgent` which determines a failed proxy
// connection via the `callback()` function throwing.
yield (0, once_1.default)(socket, 'connect');
return socket;
});
}
}
exports.default = HttpProxyAgent;
//# sourceMappingURL=agent.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"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"}

View file

@ -0,0 +1,21 @@
/// <reference types="node" />
import net from 'net';
import tls from 'tls';
import { Url } from 'url';
import { AgentOptions } from 'agent-base';
import _HttpProxyAgent from './agent';
declare function createHttpProxyAgent(opts: string | createHttpProxyAgent.HttpProxyAgentOptions): _HttpProxyAgent;
declare namespace createHttpProxyAgent {
interface BaseHttpProxyAgentOptions {
secureProxy?: boolean;
host?: string | null;
path?: string | null;
port?: string | number | null;
}
export interface HttpProxyAgentOptions extends AgentOptions, BaseHttpProxyAgentOptions, Partial<Omit<Url & net.NetConnectOpts & tls.ConnectionOptions, keyof BaseHttpProxyAgentOptions>> {
}
export type HttpProxyAgent = _HttpProxyAgent;
export const HttpProxyAgent: typeof _HttpProxyAgent;
export {};
}
export = createHttpProxyAgent;

View file

@ -0,0 +1,14 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
const agent_1 = __importDefault(require("./agent"));
function createHttpProxyAgent(opts) {
return new agent_1.default(opts);
}
(function (createHttpProxyAgent) {
createHttpProxyAgent.HttpProxyAgent = agent_1.default;
createHttpProxyAgent.prototype = agent_1.default.prototype;
})(createHttpProxyAgent || (createHttpProxyAgent = {}));
module.exports = createHttpProxyAgent;
//# sourceMappingURL=index.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAIA,oDAAsC;AAEtC,SAAS,oBAAoB,CAC5B,IAAyD;IAEzD,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC;AAED,WAAU,oBAAoB;IAmBhB,mCAAc,GAAG,eAAe,CAAC;IAE9C,oBAAoB,CAAC,SAAS,GAAG,eAAe,CAAC,SAAS,CAAC;AAC5D,CAAC,EAtBS,oBAAoB,KAApB,oBAAoB,QAsB7B;AAED,iBAAS,oBAAoB,CAAC"}

View file

@ -0,0 +1,30 @@
/// <reference types="node" />
import net from 'net';
import { Agent, ClientRequest, RequestOptions } from 'agent-base';
import { HttpsProxyAgentOptions } from '.';
/**
* The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to
* the specified "HTTP(s) proxy server" in order to proxy HTTPS requests.
*
* Outgoing HTTP requests are first tunneled through the proxy server using the
* `CONNECT` HTTP request method to establish a connection to the proxy server,
* and then the proxy server connects to the destination target and issues the
* HTTP request from the proxy server.
*
* `https:` requests have their socket connection upgraded to TLS once
* the connection to the proxy server has been established.
*
* @api public
*/
export default class HttpsProxyAgent extends Agent {
private secureProxy;
private proxy;
constructor(_opts: string | HttpsProxyAgentOptions);
/**
* Called when the node-core HTTP client library is creating a
* new HTTP request.
*
* @api protected
*/
callback(req: ClientRequest, opts: RequestOptions): Promise<net.Socket>;
}

View file

@ -0,0 +1,177 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const net_1 = __importDefault(require("net"));
const tls_1 = __importDefault(require("tls"));
const url_1 = __importDefault(require("url"));
const assert_1 = __importDefault(require("assert"));
const debug_1 = __importDefault(require("debug"));
const agent_base_1 = require("agent-base");
const parse_proxy_response_1 = __importDefault(require("./parse-proxy-response"));
const debug = debug_1.default('https-proxy-agent:agent');
/**
* The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to
* the specified "HTTP(s) proxy server" in order to proxy HTTPS requests.
*
* Outgoing HTTP requests are first tunneled through the proxy server using the
* `CONNECT` HTTP request method to establish a connection to the proxy server,
* and then the proxy server connects to the destination target and issues the
* HTTP request from the proxy server.
*
* `https:` requests have their socket connection upgraded to TLS once
* the connection to the proxy server has been established.
*
* @api public
*/
class HttpsProxyAgent extends agent_base_1.Agent {
constructor(_opts) {
let opts;
if (typeof _opts === 'string') {
opts = url_1.default.parse(_opts);
}
else {
opts = _opts;
}
if (!opts) {
throw new Error('an HTTP(S) proxy server `host` and `port` must be specified!');
}
debug('creating new HttpsProxyAgent instance: %o', opts);
super(opts);
const proxy = Object.assign({}, opts);
// If `true`, then connect to the proxy server over TLS.
// Defaults to `false`.
this.secureProxy = opts.secureProxy || isHTTPS(proxy.protocol);
// Prefer `hostname` over `host`, and set the `port` if needed.
proxy.host = proxy.hostname || proxy.host;
if (typeof proxy.port === 'string') {
proxy.port = parseInt(proxy.port, 10);
}
if (!proxy.port && proxy.host) {
proxy.port = this.secureProxy ? 443 : 80;
}
// ALPN is supported by Node.js >= v5.
// attempt to negotiate http/1.1 for proxy servers that support http/2
if (this.secureProxy && !('ALPNProtocols' in proxy)) {
proxy.ALPNProtocols = ['http 1.1'];
}
if (proxy.host && proxy.path) {
// If both a `host` and `path` are specified then it's most likely
// the result of a `url.parse()` call... we need to remove the
// `path` portion so that `net.connect()` doesn't attempt to open
// that as a Unix socket file.
delete proxy.path;
delete proxy.pathname;
}
this.proxy = proxy;
}
/**
* Called when the node-core HTTP client library is creating a
* new HTTP request.
*
* @api protected
*/
callback(req, opts) {
return __awaiter(this, void 0, void 0, function* () {
const { proxy, secureProxy } = this;
// Create a socket connection to the proxy server.
let socket;
if (secureProxy) {
debug('Creating `tls.Socket`: %o', proxy);
socket = tls_1.default.connect(proxy);
}
else {
debug('Creating `net.Socket`: %o', proxy);
socket = net_1.default.connect(proxy);
}
const headers = Object.assign({}, proxy.headers);
const hostname = `${opts.host}:${opts.port}`;
let payload = `CONNECT ${hostname} HTTP/1.1\r\n`;
// Inject the `Proxy-Authorization` header if necessary.
if (proxy.auth) {
headers['Proxy-Authorization'] = `Basic ${Buffer.from(proxy.auth).toString('base64')}`;
}
// The `Host` header should only include the port
// number when it is not the default port.
let { host, port, secureEndpoint } = opts;
if (!isDefaultPort(port, secureEndpoint)) {
host += `:${port}`;
}
headers.Host = host;
headers.Connection = 'close';
for (const name of Object.keys(headers)) {
payload += `${name}: ${headers[name]}\r\n`;
}
const proxyResponsePromise = parse_proxy_response_1.default(socket);
socket.write(`${payload}\r\n`);
const { statusCode, buffered } = yield proxyResponsePromise;
if (statusCode === 200) {
req.once('socket', resume);
if (opts.secureEndpoint) {
// The proxy is connecting to a TLS server, so upgrade
// this socket connection to a TLS connection.
debug('Upgrading socket connection to TLS');
const servername = opts.servername || opts.host;
return tls_1.default.connect(Object.assign(Object.assign({}, omit(opts, 'host', 'hostname', 'path', 'port')), { socket,
servername }));
}
return socket;
}
// Some other status code that's not 200... need to re-play the HTTP
// header "data" events onto the socket once the HTTP machinery is
// attached so that the node core `http` can parse and handle the
// error status code.
// Close the original socket, and a new "fake" socket is returned
// instead, so that the proxy doesn't get the HTTP request
// written to it (which may contain `Authorization` headers or other
// sensitive data).
//
// See: https://hackerone.com/reports/541502
socket.destroy();
const fakeSocket = new net_1.default.Socket({ writable: false });
fakeSocket.readable = true;
// Need to wait for the "socket" event to re-play the "data" events.
req.once('socket', (s) => {
debug('replaying proxy buffer for failed request');
assert_1.default(s.listenerCount('data') > 0);
// Replay the "buffered" Buffer onto the fake `socket`, since at
// this point the HTTP module machinery has been hooked up for
// the user.
s.push(buffered);
s.push(null);
});
return fakeSocket;
});
}
}
exports.default = HttpsProxyAgent;
function resume(socket) {
socket.resume();
}
function isDefaultPort(port, secure) {
return Boolean((!secure && port === 80) || (secure && port === 443));
}
function isHTTPS(protocol) {
return typeof protocol === 'string' ? /^https:?$/i.test(protocol) : false;
}
function omit(obj, ...keys) {
const ret = {};
let key;
for (key in obj) {
if (!keys.includes(key)) {
ret[key] = obj[key];
}
}
return ret;
}
//# sourceMappingURL=agent.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"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"}

View file

@ -0,0 +1,23 @@
/// <reference types="node" />
import net from 'net';
import tls from 'tls';
import { Url } from 'url';
import { AgentOptions } from 'agent-base';
import { OutgoingHttpHeaders } from 'http';
import _HttpsProxyAgent from './agent';
declare function createHttpsProxyAgent(opts: string | createHttpsProxyAgent.HttpsProxyAgentOptions): _HttpsProxyAgent;
declare namespace createHttpsProxyAgent {
interface BaseHttpsProxyAgentOptions {
headers?: OutgoingHttpHeaders;
secureProxy?: boolean;
host?: string | null;
path?: string | null;
port?: string | number | null;
}
export interface HttpsProxyAgentOptions extends AgentOptions, BaseHttpsProxyAgentOptions, Partial<Omit<Url & net.NetConnectOpts & tls.ConnectionOptions, keyof BaseHttpsProxyAgentOptions>> {
}
export type HttpsProxyAgent = _HttpsProxyAgent;
export const HttpsProxyAgent: typeof _HttpsProxyAgent;
export {};
}
export = createHttpsProxyAgent;

Some files were not shown because too many files have changed in this diff Show more