Compare commits
3 commits
master
...
feature/zo
Author | SHA1 | Date | |
---|---|---|---|
Ingolf Wagner | bf29908788 | ||
Ingolf Wagner | b7c31cbb59 | ||
Ingolf Wagner | 797c285037 |
|
@ -1,6 +1 @@
|
|||
[tech.ingolf-wagner.de](https://tech.ingolf-wagner.de) source code.
|
||||
|
||||
```
|
||||
nix run # to run local server
|
||||
nix run ".#publish" # to publish site
|
||||
```
|
161
Rakefile
|
@ -1,161 +0,0 @@
|
|||
|
||||
#
|
||||
# configuration
|
||||
#
|
||||
|
||||
@viewer = "feh" # just comment out if you don't want the viewr task
|
||||
|
||||
#
|
||||
# default task
|
||||
#
|
||||
|
||||
desc "create all files"
|
||||
task :all
|
||||
task :default => :all
|
||||
|
||||
#
|
||||
# tasks I need for all files
|
||||
#
|
||||
|
||||
def rest_tasks(name, file, png_file, svg_file)
|
||||
|
||||
desc "generate all files for ./#{file}"
|
||||
task name => png_file
|
||||
task name => svg_file
|
||||
|
||||
if @viewer
|
||||
|
||||
show_name = "view_#{name}"
|
||||
desc "#{@viewer} ./#{png_file}"
|
||||
task show_name => png_file do
|
||||
sh "#{@viewer} #{png_file}"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# append tasks to default task
|
||||
task :all => png_file
|
||||
task :all => svg_file
|
||||
|
||||
end
|
||||
|
||||
#
|
||||
# tasks for blockdiag files
|
||||
#
|
||||
Dir['src/images/**/*.diag'].each do |diag_file|
|
||||
|
||||
name = diag_file[0..-6]
|
||||
svg_file = "#{name}.svg"
|
||||
png_file = "#{name}.png"
|
||||
|
||||
|
||||
task svg_file do
|
||||
sh "blockdiag -Tsvg -o #{name}.svg #{diag_file}"
|
||||
end
|
||||
|
||||
task png_file do
|
||||
sh "blockdiag --no-transparency -Tpng -o #{name}.png #{diag_file}"
|
||||
end
|
||||
|
||||
rest_tasks(name, diag_file, png_file, svg_file)
|
||||
|
||||
end
|
||||
|
||||
#
|
||||
# tasks for nwdiag files
|
||||
#
|
||||
Dir['src/images/**/*.nwdiag'].each do |diag_file|
|
||||
|
||||
name = diag_file[0..-8]
|
||||
svg_file = "#{name}.svg"
|
||||
png_file = "#{name}.png"
|
||||
|
||||
|
||||
task svg_file do
|
||||
sh "nwdiag -Tsvg -o #{name}.svg #{diag_file}"
|
||||
end
|
||||
|
||||
task png_file do
|
||||
sh "nwdiag --no-transparency -Tpng -o #{name}.png #{diag_file}"
|
||||
end
|
||||
|
||||
rest_tasks(name, diag_file, png_file, svg_file)
|
||||
|
||||
end
|
||||
|
||||
#
|
||||
# tasks for seqdiag files
|
||||
#
|
||||
Dir['src/images/**/*.seqdiag'].each do |diag_file|
|
||||
|
||||
name = diag_file[0..-9]
|
||||
svg_file = "#{name}.svg"
|
||||
png_file = "#{name}.png"
|
||||
|
||||
|
||||
task svg_file do
|
||||
sh "seqdiag -Tsvg -o #{name}.svg #{diag_file}"
|
||||
end
|
||||
|
||||
task png_file do
|
||||
sh "seqdiag --no-transparency -Tpng -o #{name}.png #{diag_file}"
|
||||
end
|
||||
|
||||
rest_tasks(name, diag_file, png_file, svg_file)
|
||||
|
||||
end
|
||||
|
||||
#
|
||||
# tasks for actdiag files
|
||||
#
|
||||
Dir['src/images/**/*.actdiag'].each do |diag_file|
|
||||
|
||||
name = diag_file[0..-9]
|
||||
svg_file = "#{name}.svg"
|
||||
png_file = "#{name}.png"
|
||||
|
||||
|
||||
task svg_file do
|
||||
sh "actdiag -Tsvg -o #{name}.svg #{diag_file}"
|
||||
end
|
||||
|
||||
task png_file do
|
||||
sh "actdiag --no-transparency -Tpng -o #{name}.png #{diag_file}"
|
||||
end
|
||||
|
||||
rest_tasks(name, diag_file, png_file, svg_file)
|
||||
|
||||
end
|
||||
|
||||
|
||||
#
|
||||
# hugo server
|
||||
#
|
||||
desc "start the hugo server"
|
||||
task :run_server => [:build_css] do
|
||||
sh "hugo serve"
|
||||
end
|
||||
|
||||
|
||||
#
|
||||
# publish
|
||||
#
|
||||
desc "publish"
|
||||
task :publish => [:all] do
|
||||
sh "./publish.ion"
|
||||
end
|
||||
|
||||
desc "preview"
|
||||
task :preview => [:all] do
|
||||
sh "./preview.ion"
|
||||
end
|
||||
|
||||
|
||||
|
||||
desc "build css"
|
||||
task :build_css do
|
||||
sh "lessc src/lessc/page/main.less static/css/main.css"
|
||||
sh "lessc src/lessc/remark/main-light.less static/css/remark-light.css"
|
||||
sh "lessc src/lessc/remark/main-dark.less static/css/remark-dark.css"
|
||||
end
|
||||
task :all => :build_css
|
|
@ -5,13 +5,13 @@ vars:
|
|||
SERVER_PATH: /srv/www/tech
|
||||
|
||||
tasks:
|
||||
server:
|
||||
serve:
|
||||
deps: [assets]
|
||||
cmds: ["hugo serve"]
|
||||
cmds: ["zola serve"]
|
||||
|
||||
build:
|
||||
deps: [assets]
|
||||
cmds: ["hugo"]
|
||||
cmds: ["zola"]
|
||||
|
||||
assets:
|
||||
deps: [css]
|
||||
|
|
24
config.toml
Normal file
|
@ -0,0 +1,24 @@
|
|||
# The URL the site will be built for
|
||||
base_url = "https://tech.ingolf-wagner.de"
|
||||
|
||||
# Whether to automatically compile all Sass files in the sass directory
|
||||
compile_sass = true
|
||||
|
||||
# Whether to build a search index to be used later on by a JavaScript library
|
||||
build_search_index = true
|
||||
|
||||
[markdown]
|
||||
# Whether to do syntax highlighting
|
||||
# Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola
|
||||
highlight_code = true
|
||||
|
||||
# The theme to use for code highlighting.
|
||||
# See below for list of allowed values.
|
||||
highlight_theme = "gruvbox-light"
|
||||
|
||||
# When set to "true", emoji aliases translated to their corresponding
|
||||
# Unicode emoji equivalent in the rendered Markdown files. (e.g.: :smile: => 😄)
|
||||
render_emoji = true
|
||||
|
||||
[extra]
|
||||
# Put all your custom variables here
|
|
@ -1,3 +1,4 @@
|
|||
# old delete if not needed anymore
|
||||
baseURL: "http://tech.ingolf-wagner.de"
|
||||
languageCode: "en-us"
|
||||
title: "Techblog - Ingolf Wagner"
|
||||
|
|
|
@ -1,14 +1,3 @@
|
|||
---
|
||||
title: "tech"
|
||||
date: 2018-09-28T21:43:24+02:00
|
||||
---
|
||||
|
||||
Hey here are some articles about technical issues.
|
||||
Most of them are about
|
||||
[NixOS](https://nixos.org) topics,
|
||||
because it is the Operation System of my choice.
|
||||
|
||||
If you are interested in more output of me please visit
|
||||
["my other page"](https://ingolf-wagner.de).
|
||||
|
||||
## Featured
|
||||
+++
|
||||
template = "index.html"
|
||||
+++
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
title: About me
|
||||
---
|
||||
+++
|
||||
title = "About me"
|
||||
template = "page.html"
|
||||
+++
|
||||
|
||||
I'm a freelancing Mathematician, Full Stack Developer and DevOps Engineer.
|
||||
[NixOS](https://nixos.org) is my Operating System of choice.
|
11
content/nixos/index.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
+++
|
||||
title = "NixOS Articles"
|
||||
template = "page.html"
|
||||
page_template = "page.html"
|
||||
+++
|
||||
|
||||
Hey here are some articles about technical issues.
|
||||
Most of them are about
|
||||
[NixOS](https://nixos.org)
|
||||
related topics,
|
||||
because it is the OS of my choice.
|
|
@ -1,16 +1,9 @@
|
|||
---
|
||||
title: "vsketch and NixOS"
|
||||
date: 2023-07-09T15:26:24+02:00
|
||||
tags:
|
||||
- NixOS
|
||||
- Plotting
|
||||
- vsketch
|
||||
summary: >
|
||||
Adventures with vsketch, axidraw and NixOS.
|
||||
---
|
||||
|
||||
|
||||
# vsketch and NixOS
|
||||
+++
|
||||
title = "vsketch and NixOS"
|
||||
date = 2023-07-09T15:26:24+02:00
|
||||
tags = [ "NixOS","Plotting","vsketch"]
|
||||
summary = "Adventures with vsketch, axidraw and NixOS."
|
||||
+++
|
||||
|
||||
I like to plotter. I like to draw pictures with my [axidraw](https://axidraw.com/) and ogle with the [terrapen](https://terrapen.xyz/products/terrapen-a2-pen-plotter) .
|
||||
|
||||
|
@ -22,7 +15,7 @@ But lately I got introduced to [pipenv](https://pipenv.pypa.io/en/latest/) which
|
|||
Setup
|
||||
-----
|
||||
|
||||
I simple use a combination of `direnv` `shell.nix` , `steam-run` and `pipenv` to make everything work.
|
||||
I simply use a combination of `direnv` `shell.nix` , `steam-run` and `pipenv` to make everything work.
|
||||
|
||||
### shell.nix
|
||||
|
||||
|
@ -34,9 +27,9 @@ use nix
|
|||
|
||||
in the repositories `.envrc` file.
|
||||
|
||||
In the `shell.nix` I simple define a all packages I need and override the `steam-run` binary to add some package. Getting to this point, was a bit fiddly, but once it works, it works :D This is my `shell.nix`
|
||||
In the `shell.nix` I simply define a all packages I need and override the `steam-run` binary to add some package. Getting to this point, was a bit fiddly, but once it works, it works :D This is my `shell.nix`
|
||||
|
||||
```text-plain
|
||||
```nix
|
||||
{ pkgs ? import <nixpkgs> { } }:
|
||||
pkgs.mkShell {
|
||||
buildInputs =
|
||||
|
@ -76,7 +69,7 @@ pkgs.mkShell {
|
|||
|
||||
Now `pipenv` has all needed dependencies for it's thing to do. But we need to set up `pipenv` itself as well, of course. Here is my `Pipfile`:
|
||||
|
||||
```text-plain
|
||||
```toml
|
||||
[[source]]
|
||||
url = "https://pypi.org/simple"
|
||||
verify_ssl = true
|
||||
|
@ -95,7 +88,7 @@ python_full_version = "3.10.11"
|
|||
|
||||
Now I can run
|
||||
|
||||
```text-plain
|
||||
```shell
|
||||
pipenv install
|
||||
```
|
||||
|
||||
|
@ -106,7 +99,7 @@ My first sketch
|
|||
|
||||
After running
|
||||
|
||||
```text-plain
|
||||
```shell
|
||||
vsk init SimpleRings
|
||||
```
|
||||
|
||||
|
@ -116,7 +109,7 @@ I'm amazed how fast my development cycle was. I could instantly see results, and
|
|||
|
||||
Here is my first script + some screenshots and photos of the results:
|
||||
|
||||
```text-plain
|
||||
```python
|
||||
import vsketch
|
||||
|
||||
class SimpleRingsSketch(vsketch.SketchClass):
|
||||
|
@ -164,11 +157,6 @@ if __name__ == "__main__":
|
|||
SimpleRingsSketch.display()
|
||||
```
|
||||
|
||||
{{< card >}}
|
||||
{{<figure src="./images/screenshot.png" width=100% >}}
|
||||
{{< /card >}}
|
||||
|
||||
{{< card >}}
|
||||
{{<figure src="./images/plot01.jpg" width=100% >}}
|
||||
{{<figure src="./images/plot02.jpg" width=100% >}}
|
||||
{{< /card >}}
|
||||
![](screenshot.png)
|
||||
![](plot01.jpg)
|
||||
![](plot02.jpg)
|
||||
|
|
Before Width: | Height: | Size: 199 KiB After Width: | Height: | Size: 199 KiB |
Before Width: | Height: | Size: 210 KiB After Width: | Height: | Size: 210 KiB |
Before Width: | Height: | Size: 193 KiB After Width: | Height: | Size: 193 KiB |
Before Width: | Height: | Size: 4 MiB After Width: | Height: | Size: 4 MiB |
Before Width: | Height: | Size: 4 MiB After Width: | Height: | Size: 4 MiB |
Before Width: | Height: | Size: 4.2 MiB After Width: | Height: | Size: 4.2 MiB |
Before Width: | Height: | Size: 3.6 MiB After Width: | Height: | Size: 3.6 MiB |
Before Width: | Height: | Size: 4.4 MiB After Width: | Height: | Size: 4.4 MiB |
Before Width: | Height: | Size: 3.5 MiB After Width: | Height: | Size: 3.5 MiB |
Before Width: | Height: | Size: 3.8 MiB After Width: | Height: | Size: 3.8 MiB |
Before Width: | Height: | Size: 3.6 MiB After Width: | Height: | Size: 3.6 MiB |
Before Width: | Height: | Size: 4 MiB After Width: | Height: | Size: 4 MiB |
Before Width: | Height: | Size: 3.3 MiB After Width: | Height: | Size: 3.3 MiB |
Before Width: | Height: | Size: 4.1 MiB After Width: | Height: | Size: 4.1 MiB |
Before Width: | Height: | Size: 3.8 MiB After Width: | Height: | Size: 3.8 MiB |
Before Width: | Height: | Size: 4.4 MiB After Width: | Height: | Size: 4.4 MiB |
Before Width: | Height: | Size: 3.7 MiB After Width: | Height: | Size: 3.7 MiB |
Before Width: | Height: | Size: 3.2 MiB After Width: | Height: | Size: 3.2 MiB |
Before Width: | Height: | Size: 3.5 MiB After Width: | Height: | Size: 3.5 MiB |
Before Width: | Height: | Size: 2.8 MiB After Width: | Height: | Size: 2.8 MiB |
Before Width: | Height: | Size: 3.3 MiB After Width: | Height: | Size: 3.3 MiB |
Before Width: | Height: | Size: 3.6 MiB After Width: | Height: | Size: 3.6 MiB |
Before Width: | Height: | Size: 3.2 MiB After Width: | Height: | Size: 3.2 MiB |
Before Width: | Height: | Size: 4.4 MiB After Width: | Height: | Size: 4.4 MiB |
Before Width: | Height: | Size: 3.2 MiB After Width: | Height: | Size: 3.2 MiB |
Before Width: | Height: | Size: 3.5 MiB After Width: | Height: | Size: 3.5 MiB |
Before Width: | Height: | Size: 4.3 MiB After Width: | Height: | Size: 4.3 MiB |
Before Width: | Height: | Size: 4.4 MiB After Width: | Height: | Size: 4.4 MiB |
Before Width: | Height: | Size: 3.7 MiB After Width: | Height: | Size: 3.7 MiB |
Before Width: | Height: | Size: 3.1 MiB After Width: | Height: | Size: 3.1 MiB |
Before Width: | Height: | Size: 5.7 MiB After Width: | Height: | Size: 5.7 MiB |
Before Width: | Height: | Size: 2.9 MiB After Width: | Height: | Size: 2.9 MiB |
Before Width: | Height: | Size: 2.4 MiB After Width: | Height: | Size: 2.4 MiB |
Before Width: | Height: | Size: 2.7 MiB After Width: | Height: | Size: 2.7 MiB |
Before Width: | Height: | Size: 4.1 MiB After Width: | Height: | Size: 4.1 MiB |
Before Width: | Height: | Size: 3.7 MiB After Width: | Height: | Size: 3.7 MiB |
Before Width: | Height: | Size: 3.7 MiB After Width: | Height: | Size: 3.7 MiB |
Before Width: | Height: | Size: 3.8 MiB After Width: | Height: | Size: 3.8 MiB |
Before Width: | Height: | Size: 3.5 MiB After Width: | Height: | Size: 3.5 MiB |
Before Width: | Height: | Size: 3.7 MiB After Width: | Height: | Size: 3.7 MiB |
Before Width: | Height: | Size: 5.7 MiB After Width: | Height: | Size: 5.7 MiB |
Before Width: | Height: | Size: 3.5 MiB After Width: | Height: | Size: 3.5 MiB |
Before Width: | Height: | Size: 3.5 MiB After Width: | Height: | Size: 3.5 MiB |
Before Width: | Height: | Size: 3.3 MiB After Width: | Height: | Size: 3.3 MiB |
Before Width: | Height: | Size: 3 MiB After Width: | Height: | Size: 3 MiB |
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 9.9 KiB |
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 83 KiB |
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
BIN
content_asdf/nixos/vsketch-and-NixOS/images/plot01.jpg
Normal file
After Width: | Height: | Size: 199 KiB |
BIN
content_asdf/nixos/vsketch-and-NixOS/images/plot02.jpg
Normal file
After Width: | Height: | Size: 210 KiB |
BIN
content_asdf/nixos/vsketch-and-NixOS/images/screenshot.png
Normal file
After Width: | Height: | Size: 193 KiB |
174
content_asdf/nixos/vsketch-and-NixOS/index.md
Normal file
|
@ -0,0 +1,174 @@
|
|||
---
|
||||
title: "vsketch and NixOS"
|
||||
date: 2023-07-09T15:26:24+02:00
|
||||
tags:
|
||||
- NixOS
|
||||
- Plotting
|
||||
- vsketch
|
||||
summary: >
|
||||
Adventures with vsketch, axidraw and NixOS.
|
||||
---
|
||||
|
||||
|
||||
# vsketch and NixOS
|
||||
|
||||
I like to plotter. I like to draw pictures with my [axidraw](https://axidraw.com/) and ogle with the [terrapen](https://terrapen.xyz/products/terrapen-a2-pen-plotter) .
|
||||
|
||||
I had a few tries using [vsketch](https://vsketch.readthedocs.io/en/latest/) in [NixOS](https://nixos.org) but because I don't know much about Python and never had enough time to dig into it,
|
||||
I never made [vsketch](https://vsketch.readthedocs.io/en/latest/) work under NixOS. Same holds for the [axidraw cli](https://axidraw.com/doc/cli_api/#introduction).
|
||||
|
||||
But lately I got introduced to [pipenv](https://pipenv.pypa.io/en/latest/) which made everything possible and very easy.
|
||||
|
||||
Setup
|
||||
-----
|
||||
|
||||
I simple use a combination of `direnv` `shell.nix` , `steam-run` and `pipenv` to make everything work.
|
||||
|
||||
### shell.nix
|
||||
|
||||
The shell nix is called by `direnv` simply by putting
|
||||
|
||||
```text-plain
|
||||
use nix
|
||||
```
|
||||
|
||||
in the repositories `.envrc` file.
|
||||
|
||||
In the `shell.nix` I simple define a all packages I need and override the `steam-run` binary to add some package. Getting to this point, was a bit fiddly, but once it works, it works :D This is my `shell.nix`
|
||||
|
||||
```text-plain
|
||||
{ pkgs ? import <nixpkgs> { } }:
|
||||
pkgs.mkShell {
|
||||
buildInputs =
|
||||
let
|
||||
steamrun = (pkgs.steam.override {
|
||||
extraPkgs = pkgs: [
|
||||
(pkgs.python3.withPackages (ps: with ps; [
|
||||
matplotlib
|
||||
pyside6
|
||||
setuptools
|
||||
scikitlearn
|
||||
toml
|
||||
]))
|
||||
pkgs.qt6.qtbase
|
||||
];
|
||||
extraLibraries = pkgs: [ pkgs.libkrb5 ];
|
||||
}).run;
|
||||
in
|
||||
[
|
||||
(pkgs.writers.writeDashBin "vsk" ''
|
||||
${steamrun}/bin/steam-run pipenv run vsk "$@"
|
||||
'')
|
||||
(pkgs.writers.writeDashBin "axicli" ''
|
||||
${steamrun}/bin/steam-run pipenv run axicli "$@"
|
||||
'')
|
||||
(pkgs.writers.writeDashBin "python" ''
|
||||
${steamrun}/bin/steam-run ${pkgs.pipenv}/bin/pipenv run python "$@"
|
||||
'')
|
||||
(pkgs.writers.writeDashBin "pipenv" ''
|
||||
${steamrun}/bin/steam-run ${pkgs.pipenv}/bin/pipenv "$@"
|
||||
'')
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
### Pipenv
|
||||
|
||||
Now `pipenv` has all needed dependencies for it's thing to do. But we need to set up `pipenv` itself as well, of course. Here is my `Pipfile`:
|
||||
|
||||
```text-plain
|
||||
[[source]]
|
||||
url = "https://pypi.org/simple"
|
||||
verify_ssl = true
|
||||
name = "pypi"
|
||||
|
||||
[packages]
|
||||
vsketch = {editable = true, git = "https://github.com/abey79/vsketch"}
|
||||
axicli = {file = "https://cdn.evilmadscientist.com/dl/ad/public/AxiDraw_API.zip" }
|
||||
|
||||
[dev-packages]
|
||||
|
||||
[requires]
|
||||
python_version = "3.10"
|
||||
python_full_version = "3.10.11"
|
||||
```
|
||||
|
||||
Now I can run
|
||||
|
||||
```text-plain
|
||||
pipenv install
|
||||
```
|
||||
|
||||
and magically the shell command `vsk` (which is defined in the `shell.nix`) works like charm.
|
||||
|
||||
My first sketch
|
||||
---------------
|
||||
|
||||
After running
|
||||
|
||||
```text-plain
|
||||
vsk init SimpleRings
|
||||
```
|
||||
|
||||
I could instantly start fiddling around with the code.
|
||||
|
||||
I'm amazed how fast my development cycle was. I could instantly see results, and play around with seed and parameters. And once I liked something. I can just hit **Like** and it will be saved as svg.
|
||||
|
||||
Here is my first script + some screenshots and photos of the results:
|
||||
|
||||
```text-plain
|
||||
import vsketch
|
||||
|
||||
class SimpleRingsSketch(vsketch.SketchClass):
|
||||
amount = vsketch.Param(3)
|
||||
space = vsketch.Param(30, min_value=10)
|
||||
min_radius = vsketch.Param(30, min_value=1)
|
||||
base_rotation = vsketch.Param(1)
|
||||
show_rings = vsketch.Param(True)
|
||||
show_rings_randomly = vsketch.Param(True)
|
||||
show_lines = vsketch.Param(True)
|
||||
|
||||
def draw(self, vsk: vsketch.Vsketch) -> None:
|
||||
vsk.size("a4", landscape=False)
|
||||
|
||||
# vsk.scale("mm")
|
||||
# height and width are in pixels (not mm)
|
||||
max_radius = min(vsk.height / 2, vsk.width / 2) - self.space
|
||||
|
||||
for i in range(self.amount):
|
||||
radius = vsk.random(self.min_radius, max_radius)
|
||||
amount_of_lines = int(vsk.random(1, radius))
|
||||
line_length = vsk.random(1, 20)
|
||||
circle_line_height = vsk.random(1, line_length)
|
||||
|
||||
# vsk.random() consumes the seed, so we have to consume it in every step, other changing the
|
||||
# options would result in different results in the other routines.
|
||||
if vsk.random(0, 1) > 0.5 or not self.show_rings_randomly:
|
||||
if self.show_rings:
|
||||
vsk.circle(0, 0, radius - circle_line_height, mode="radius")
|
||||
|
||||
if not self.show_lines:
|
||||
continue
|
||||
vsk.rotate(self.base_rotation, degrees=True)
|
||||
with vsk.pushMatrix():
|
||||
angle = 360.0 / amount_of_lines
|
||||
for j in range(0, amount_of_lines):
|
||||
vsk.rotate(angle, degrees=True)
|
||||
vsk.line(0, radius, 0, radius - line_length)
|
||||
|
||||
def finalize(self, vsk: vsketch.Vsketch) -> None:
|
||||
vsk.vpype("linemerge linesimplify reloop linesort")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
SimpleRingsSketch.display()
|
||||
```
|
||||
|
||||
{{< card >}}
|
||||
{{<figure src="./images/screenshot.png" width=100% >}}
|
||||
{{< /card >}}
|
||||
|
||||
{{< card >}}
|
||||
{{<figure src="./images/plot01.jpg" width=100% >}}
|
||||
{{<figure src="./images/plot02.jpg" width=100% >}}
|
||||
{{< /card >}}
|
67
flake.lock
|
@ -1,39 +1,76 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1659877975,
|
||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
||||
"lastModified": 1725024810,
|
||||
"narHash": "sha256-ODYRm8zHfLTH3soTFWE452ydPYz2iTvr9T8ftDMUQ3E=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "af510d4a62d071ea13925ce41c95e3dec816c01d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1666171135,
|
||||
"narHash": "sha256-+0AIbPDd24ZVjZgFobJH3uuJuyLVZjiH0oQNb01hyWE=",
|
||||
"owner": "nixos",
|
||||
"lastModified": 1725103162,
|
||||
"narHash": "sha256-Ym04C5+qovuQDYL/rKWSR+WESseQBbNAe5DsXNx5trY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "5720791e7fcdcc89834732e11848d73151356966",
|
||||
"rev": "12228ff1752d7b7624a54e9c1af4b222b3c1073b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1722555339,
|
||||
"narHash": "sha256-uFf2QeW7eAHlYXuDktm9c25OxOyCoUOQmh5SZ9amE5Q=",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
"flake-parts": "flake-parts",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1724833132,
|
||||
"narHash": "sha256-F4djBvyNRAXGusJiNYInqR6zIMI3rvlp6WiKwsRISos=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "3ffd842a5f50f435d3e603312eefa4790db46af5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
67
flake.nix
|
@ -1,48 +1,27 @@
|
|||
{
|
||||
description = "my website";
|
||||
description = "Description for the project";
|
||||
|
||||
inputs.nixpkgs.url = "github:nixos/nixpkgs";
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
inputs = {
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
treefmt-nix.url = "github:numtide/treefmt-nix";
|
||||
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
(flake-utils.lib.eachDefaultSystem (system:
|
||||
let pkgs = nixpkgs.legacyPackages.${system};
|
||||
in {
|
||||
|
||||
# nix develop
|
||||
devShell = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [ hugo lessc rake go-task feh ion inotify-tools ];
|
||||
};
|
||||
|
||||
# nix run
|
||||
apps.default = self.apps.${system}.server;
|
||||
|
||||
# nix run ".#server"
|
||||
apps.server = {
|
||||
type = "app";
|
||||
program = toString (pkgs.writers.writeBash "server" ''
|
||||
set -e
|
||||
set -o pipefail
|
||||
PATH=${
|
||||
pkgs.lib.makeBinPath [ pkgs.lessc pkgs.go-task pkgs.ion pkgs.hugo ]
|
||||
}
|
||||
task server
|
||||
'');
|
||||
};
|
||||
|
||||
# nix run ".#publish"
|
||||
apps.publish = {
|
||||
type = "app";
|
||||
program = toString (pkgs.writers.writeBash "publish" ''
|
||||
set -e
|
||||
set -o pipefail
|
||||
PATH=${
|
||||
pkgs.lib.makeBinPath [ pkgs.lessc pkgs.go-task pkgs.ion pkgs.hugo pkgs.rsync pkgs.openssh ]
|
||||
}
|
||||
task publish
|
||||
''
|
||||
);
|
||||
};
|
||||
|
||||
}));
|
||||
outputs =
|
||||
inputs@{ flake-parts, ... }:
|
||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
imports = [
|
||||
./nix/formatter.nix
|
||||
./nix/devshells.nix
|
||||
];
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
];
|
||||
flake = {
|
||||
# The usual flake attributes can be defined here, including system-
|
||||
# agnostic ones like nixosModule and system-enumerating ones, although
|
||||
# those are more easily expressed in perSystem.
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
39
nix/devshells.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
_: {
|
||||
perSystem =
|
||||
{
|
||||
pkgs,
|
||||
self',
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
{
|
||||
devShells = {
|
||||
default = pkgs.mkShell {
|
||||
packages = [
|
||||
|
||||
pkgs.blockdiag
|
||||
pkgs.nwdiag
|
||||
pkgs.seqdiag
|
||||
pkgs.actdiag
|
||||
|
||||
pkgs.lessc
|
||||
|
||||
pkgs.pandoc
|
||||
|
||||
pkgs.go-task
|
||||
|
||||
pkgs.zola
|
||||
pkgs.sass
|
||||
#(pkgs.writers.writeBashBin "publish" ''
|
||||
# ${getExe pkgs.go-task} publish
|
||||
#'')
|
||||
(pkgs.writers.writeBashBin "serve" ''
|
||||
${getExe pkgs.go-task} serve
|
||||
'')
|
||||
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
14
nix/formatter.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{ inputs, ... }:
|
||||
{
|
||||
imports = [ inputs.treefmt-nix.flakeModule ];
|
||||
|
||||
perSystem = _: {
|
||||
treefmt = {
|
||||
# https://flake.parts/options/treefmt-nix < for all options
|
||||
projectRootFile = ".git/config";
|
||||
programs.nixfmt.enable = true;
|
||||
#programs.prettier.enable = true;
|
||||
#programs.prettier.includes = [ "*.md" ];
|
||||
};
|
||||
};
|
||||
}
|
45
node_modules/.package-lock.json
generated
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"name": "tech-ingolf-wagner-de",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/@popperjs/core": {
|
||||
"version": "2.11.8",
|
||||
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz",
|
||||
"integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==",
|
||||
"peer": true,
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/popperjs"
|
||||
}
|
||||
},
|
||||
"node_modules/bootstrap": {
|
||||
"version": "5.3.3",
|
||||
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.3.3.tgz",
|
||||
"integrity": "sha512-8HLCdWgyoMguSO9o+aH+iuZ+aht+mzW0u3HIMzVu7Srrpv7EBBxTnrFlSCskwdY1+EOFQSm7uMJhNQHkdPcmjg==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/twbs"
|
||||
},
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/bootstrap"
|
||||
}
|
||||
],
|
||||
"peerDependencies": {
|
||||
"@popperjs/core": "^2.11.8"
|
||||
}
|
||||
},
|
||||
"node_modules/normalize.css": {
|
||||
"version": "8.0.1",
|
||||
"resolved": "https://registry.npmjs.org/normalize.css/-/normalize.css-8.0.1.tgz",
|
||||
"integrity": "sha512-qizSNPO93t1YUuUhP22btGOo3chcvDFqFaj2TRybP0DMxkHOCTYwp3n34fel4a31ORXy4m1Xq0Gyqpb5m33qIg=="
|
||||
},
|
||||
"node_modules/sakura.css": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/sakura.css/-/sakura.css-1.5.0.tgz",
|
||||
"integrity": "sha512-AcAZa9F4SCs2xaKLWcXQxJxKfeod2PN3sR31+R22MKuyoJxNChH1wBG4mQaY9gVpJ3VpNA1XHPOrOM9hFo9cSw=="
|
||||
}
|
||||
}
|
||||
}
|
20
node_modules/@popperjs/core/LICENSE.md
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019 Federico Zivolo
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
376
node_modules/@popperjs/core/README.md
generated
vendored
Normal file
|
@ -0,0 +1,376 @@
|
|||
<!-- <HEADER> // IGNORE IT -->
|
||||
<p align="center">
|
||||
<img src="https://rawcdn.githack.com/popperjs/popper-core/8805a5d7599e14619c9e7ac19a3713285d8e5d7f/docs/src/images/popper-logo-outlined.svg" alt="Popper" height="300px"/>
|
||||
</p>
|
||||
|
||||
<div align="center">
|
||||
<h1>Tooltip & Popover Positioning Engine</h1>
|
||||
</div>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://www.npmjs.com/package/@popperjs/core">
|
||||
<img src="https://img.shields.io/npm/v/@popperjs/core?style=for-the-badge" alt="npm version" />
|
||||
</a>
|
||||
<a href="https://www.npmjs.com/package/@popperjs/core">
|
||||
<img src="https://img.shields.io/endpoint?style=for-the-badge&url=https://runkit.io/fezvrasta/combined-npm-downloads/1.0.0?packages=popper.js,@popperjs/core" alt="npm downloads per month (popper.js + @popperjs/core)" />
|
||||
</a>
|
||||
<a href="https://rollingversions.com/popperjs/popper-core">
|
||||
<img src="https://img.shields.io/badge/Rolling%20Versions-Enabled-brightgreen?style=for-the-badge" alt="Rolling Versions" />
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<br />
|
||||
<!-- </HEADER> // NOW BEGINS THE README -->
|
||||
|
||||
**Positioning tooltips and popovers is difficult. Popper is here to help!**
|
||||
|
||||
Given an element, such as a button, and a tooltip element describing it, Popper
|
||||
will automatically put the tooltip in the right place near the button.
|
||||
|
||||
It will position _any_ UI element that "pops out" from the flow of your document
|
||||
and floats near a target element. The most common example is a tooltip, but it
|
||||
also includes popovers, drop-downs, and more. All of these can be generically
|
||||
described as a "popper" element.
|
||||
|
||||
## Demo
|
||||
|
||||
[![Popper visualized](https://i.imgur.com/F7qWsmV.jpg)](https://popper.js.org)
|
||||
|
||||
## Docs
|
||||
|
||||
- [v2.x (latest)](https://popper.js.org/docs/v2/)
|
||||
- [v1.x](https://popper.js.org/docs/v1/)
|
||||
|
||||
We've created a
|
||||
[Migration Guide](https://popper.js.org/docs/v2/migration-guide/) to help you
|
||||
migrate from Popper 1 to Popper 2.
|
||||
|
||||
To contribute to the Popper website and documentation, please visit the
|
||||
[dedicated repository](https://github.com/popperjs/website).
|
||||
|
||||
## Why not use pure CSS?
|
||||
|
||||
- **Clipping and overflow issues**: Pure CSS poppers will not be prevented from
|
||||
overflowing clipping boundaries, such as the viewport. It will get partially
|
||||
cut off or overflows if it's near the edge since there is no dynamic
|
||||
positioning logic. When using Popper, your popper will always be positioned in
|
||||
the right place without needing manual adjustments.
|
||||
- **No flipping**: CSS poppers will not flip to a different placement to fit
|
||||
better in view if necessary. While you can manually adjust for the main axis
|
||||
overflow, this feature cannot be achieved via CSS alone. Popper automatically
|
||||
flips the tooltip to make it fit in view as best as possible for the user.
|
||||
- **No virtual positioning**: CSS poppers cannot follow the mouse cursor or be
|
||||
used as a context menu. Popper allows you to position your tooltip relative to
|
||||
any coordinates you desire.
|
||||
- **Slower development cycle**: When pure CSS is used to position popper
|
||||
elements, the lack of dynamic positioning means they must be carefully placed
|
||||
to consider overflow on all screen sizes. In reusable component libraries,
|
||||
this means a developer can't just add the component anywhere on the page,
|
||||
because these issues need to be considered and adjusted for every time. With
|
||||
Popper, you can place your elements anywhere and they will be positioned
|
||||
correctly, without needing to consider different screen sizes, layouts, etc.
|
||||
This massively speeds up development time because this work is automatically
|
||||
offloaded to Popper.
|
||||
- **Lack of extensibility**: CSS poppers cannot be easily extended to fit any
|
||||
arbitrary use case you may need to adjust for. Popper is built with
|
||||
extensibility in mind.
|
||||
|
||||
## Why Popper?
|
||||
|
||||
With the CSS drawbacks out of the way, we now move on to Popper in the
|
||||
JavaScript space itself.
|
||||
|
||||
Naive JavaScript tooltip implementations usually have the following problems:
|
||||
|
||||
- **Scrolling containers**: They don't ensure the tooltip stays with the
|
||||
reference element while scrolling when inside any number of scrolling
|
||||
containers.
|
||||
- **DOM context**: They often require the tooltip move outside of its original
|
||||
DOM context because they don't handle `offsetParent` contexts.
|
||||
- **Compatibility**: Popper handles an incredible number of edge cases regarding
|
||||
different browsers and environments (mobile viewports, RTL, scrollbars enabled
|
||||
or disabled, etc.). Popper is a popular and well-maintained library, so you
|
||||
can be confident positioning will work for your users on any device.
|
||||
- **Configurability**: They often lack advanced configurability to suit any
|
||||
possible use case.
|
||||
- **Size**: They are usually relatively large in size, or require an ancient
|
||||
jQuery dependency.
|
||||
- **Performance**: They often have runtime performance issues and update the
|
||||
tooltip position too slowly.
|
||||
|
||||
**Popper solves all of these key problems in an elegant, performant manner.** It
|
||||
is a lightweight ~3 kB library that aims to provide a reliable and extensible
|
||||
positioning engine you can use to ensure all your popper elements are positioned
|
||||
in the right place.
|
||||
|
||||
When you start writing your own popper implementation, you'll quickly run into
|
||||
all of the problems mentioned above. These widgets are incredibly common in our
|
||||
UIs; we've done the hard work figuring this out so you don't need to spend hours
|
||||
fixing and handling numerous edge cases that we already ran into while building
|
||||
the library!
|
||||
|
||||
Popper is used in popular libraries like Bootstrap, Foundation, Material UI, and
|
||||
more. It's likely you've already used popper elements on the web positioned by
|
||||
Popper at some point in the past few years.
|
||||
|
||||
Since we write UIs using powerful abstraction libraries such as React or Angular
|
||||
nowadays, you'll also be glad to know Popper can fully integrate with them and
|
||||
be a good citizen together with your other components. Check out `react-popper`
|
||||
for the official Popper wrapper for React.
|
||||
|
||||
## Installation
|
||||
|
||||
### 1. Package Manager
|
||||
|
||||
```bash
|
||||
# With npm
|
||||
npm i @popperjs/core
|
||||
|
||||
# With Yarn
|
||||
yarn add @popperjs/core
|
||||
```
|
||||
|
||||
### 2. CDN
|
||||
|
||||
```html
|
||||
<!-- Development version -->
|
||||
<script src="https://unpkg.com/@popperjs/core@2/dist/umd/popper.js"></script>
|
||||
|
||||
<!-- Production version -->
|
||||
<script src="https://unpkg.com/@popperjs/core@2"></script>
|
||||
```
|
||||
|
||||
### 3. Direct Download?
|
||||
|
||||
Managing dependencies by "directly downloading" them and placing them into your
|
||||
source code is not recommended for a variety of reasons, including missing out
|
||||
on feat/fix updates easily. Please use a versioning management system like a CDN
|
||||
or npm/Yarn.
|
||||
|
||||
## Usage
|
||||
|
||||
The most straightforward way to get started is to import Popper from the `unpkg`
|
||||
CDN, which includes all of its features. You can call the `Popper.createPopper`
|
||||
constructor to create new popper instances.
|
||||
|
||||
Here is a complete example:
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<title>Popper example</title>
|
||||
|
||||
<style>
|
||||
#tooltip {
|
||||
background-color: #333;
|
||||
color: white;
|
||||
padding: 5px 10px;
|
||||
border-radius: 4px;
|
||||
font-size: 13px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<button id="button" aria-describedby="tooltip">I'm a button</button>
|
||||
<div id="tooltip" role="tooltip">I'm a tooltip</div>
|
||||
|
||||
<script src="https://unpkg.com/@popperjs/core@^2.0.0"></script>
|
||||
<script>
|
||||
const button = document.querySelector('#button');
|
||||
const tooltip = document.querySelector('#tooltip');
|
||||
|
||||
// Pass the button, the tooltip, and some options, and Popper will do the
|
||||
// magic positioning for you:
|
||||
Popper.createPopper(button, tooltip, {
|
||||
placement: 'right',
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
Visit the [tutorial](https://popper.js.org/docs/v2/tutorial/) for an example of
|
||||
how to build your own tooltip from scratch using Popper.
|
||||
|
||||
### Module bundlers
|
||||
|
||||
You can import the `createPopper` constructor from the fully-featured file:
|
||||
|
||||
```js
|
||||
import { createPopper } from '@popperjs/core';
|
||||
|
||||
const button = document.querySelector('#button');
|
||||
const tooltip = document.querySelector('#tooltip');
|
||||
|
||||
// Pass the button, the tooltip, and some options, and Popper will do the
|
||||
// magic positioning for you:
|
||||
createPopper(button, tooltip, {
|
||||
placement: 'right',
|
||||
});
|
||||
```
|
||||
|
||||
All the modifiers listed in the docs menu will be enabled and "just work", so
|
||||
you don't need to think about setting Popper up. The size of Popper including
|
||||
all of its features is about 5 kB minzipped, but it may grow a bit in the
|
||||
future.
|
||||
|
||||
#### Popper Lite (tree-shaking)
|
||||
|
||||
If bundle size is important, you'll want to take advantage of tree-shaking. The
|
||||
library is built in a modular way to allow to import only the parts you really
|
||||
need.
|
||||
|
||||
```js
|
||||
import { createPopperLite as createPopper } from '@popperjs/core';
|
||||
```
|
||||
|
||||
The Lite version includes the most necessary modifiers that will compute the
|
||||
offsets of the popper, compute and add the positioning styles, and add event
|
||||
listeners. This is close in bundle size to pure CSS tooltip libraries, and
|
||||
behaves somewhat similarly.
|
||||
|
||||
However, this does not include the features that makes Popper truly useful.
|
||||
|
||||
The two most useful modifiers not included in Lite are `preventOverflow` and
|
||||
`flip`:
|
||||
|
||||
```js
|
||||
import {
|
||||
createPopperLite as createPopper,
|
||||
preventOverflow,
|
||||
flip,
|
||||
} from '@popperjs/core';
|
||||
|
||||
const button = document.querySelector('#button');
|
||||
const tooltip = document.querySelector('#tooltip');
|
||||
|
||||
createPopper(button, tooltip, {
|
||||
modifiers: [preventOverflow, flip],
|
||||
});
|
||||
```
|
||||
|
||||
As you make more poppers, you may be finding yourself needing other modifiers
|
||||
provided by the library.
|
||||
|
||||
See [tree-shaking](https://popper.js.org/docs/v2/performance/#tree-shaking) for more
|
||||
information.
|
||||
|
||||
## Distribution targets
|
||||
|
||||
Popper is distributed in 3 different versions, in 3 different file formats.
|
||||
|
||||
The 3 file formats are:
|
||||
|
||||
- `esm` (works with `import` syntax — **recommended**)
|
||||
- `umd` (works with `<script>` tags or RequireJS)
|
||||
- `cjs` (works with `require()` syntax)
|
||||
|
||||
There are two different `esm` builds, one for bundler consumers (e.g. webpack,
|
||||
Rollup, etc..), which is located under `/lib`, and one for browsers with native
|
||||
support for ES Modules, under `/dist/esm`. The only difference within the two,
|
||||
is that the browser-compatible version doesn't make use of
|
||||
`process.env.NODE_ENV` to run development checks.
|
||||
|
||||
The 3 versions are:
|
||||
|
||||
- `popper`: includes all the modifiers (features) in one file (**default**);
|
||||
- `popper-lite`: includes only the minimum amount of modifiers to provide the
|
||||
basic functionality;
|
||||
- `popper-base`: doesn't include any modifier, you must import them separately;
|
||||
|
||||
Below you can find the size of each version, minified and compressed with the
|
||||
[Brotli compression algorithm](https://medium.com/groww-engineering/enable-brotli-compression-in-webpack-with-fallback-to-gzip-397a57cf9fc6):
|
||||
|
||||
<!-- Don't change the labels to use hyphens, it breaks, even when encoded -->
|
||||
|
||||
![](https://badge-size.now.sh/https://unpkg.com/@popperjs/core/dist/umd/popper.min.js?compression=brotli&label=popper)
|
||||
![](https://badge-size.now.sh/https://unpkg.com/@popperjs/core/dist/umd/popper-lite.min.js?compression=brotli&label=popper%20lite)
|
||||
![](https://badge-size.now.sh/https://unpkg.com/@popperjs/core/dist/umd/popper-base.min.js?compression=brotli&label=popper%20base)
|
||||
|
||||
## Hacking the library
|
||||
|
||||
If you want to play with the library, implement new features, fix a bug you
|
||||
found, or simply experiment with it, this section is for you!
|
||||
|
||||
First of all, make sure to have
|
||||
[Yarn installed](https://yarnpkg.com/lang/en/docs/install).
|
||||
|
||||
Install the development dependencies:
|
||||
|
||||
```bash
|
||||
yarn install
|
||||
```
|
||||
|
||||
And run the development environment:
|
||||
|
||||
```bash
|
||||
yarn dev
|
||||
```
|
||||
|
||||
Then, simply open one the development server web page:
|
||||
|
||||
```bash
|
||||
# macOS and Linux
|
||||
open localhost:5000
|
||||
|
||||
# Windows
|
||||
start localhost:5000
|
||||
```
|
||||
|
||||
From there, you can open any of the examples (`.html` files) to fiddle with
|
||||
them.
|
||||
|
||||
Now any change you will made to the source code, will be automatically compiled,
|
||||
you just need to refresh the page.
|
||||
|
||||
If the page is not working properly, try to go in _"Developer Tools >
|
||||
Application > Clear storage"_ and click on "_Clear site data_".
|
||||
To run the examples you need a browser with
|
||||
[JavaScript modules via script tag support](https://caniuse.com/#feat=es6-module).
|
||||
|
||||
## Test Suite
|
||||
|
||||
Popper is currently tested with unit tests, and functional tests. Both of them
|
||||
are run by Jest.
|
||||
|
||||
### Unit Tests
|
||||
|
||||
The unit tests use JSDOM to provide a primitive document object API, they are
|
||||
used to ensure the utility functions behave as expected in isolation.
|
||||
|
||||
### Functional Tests
|
||||
|
||||
The functional tests run with Puppeteer, to take advantage of a complete browser
|
||||
environment. They are currently running on Chromium, and Firefox.
|
||||
|
||||
You can run them with `yarn test:functional`. Set the `PUPPETEER_BROWSER`
|
||||
environment variable to `firefox` to run them on the Mozilla browser.
|
||||
|
||||
The assertions are written in form of image snapshots, so that it's easy to
|
||||
assert for the correct Popper behavior without having to write a lot of offsets
|
||||
comparisons manually.
|
||||
|
||||
You can mark a `*.test.js` file to run in the Puppeteer environment by
|
||||
prepending a `@jest-environment puppeteer` JSDoc comment to the interested file.
|
||||
|
||||
Here's an example of a basic functional test:
|
||||
|
||||
```js
|
||||
/**
|
||||
* @jest-environment puppeteer
|
||||
* @flow
|
||||
*/
|
||||
import { screenshot } from '../utils/puppeteer.js';
|
||||
|
||||
it('should position the popper on the right', async () => {
|
||||
const page = await browser.newPage();
|
||||
await page.goto(`${TEST_URL}/basic.html`);
|
||||
|
||||
expect(await screenshot(page)).toMatchImageSnapshot();
|
||||
});
|
||||
```
|
||||
|
||||
You can find the complete
|
||||
[`jest-puppeteer` documentation here](https://github.com/smooth-code/jest-puppeteer#api),
|
||||
and the
|
||||
[`jest-image-snapshot` documentation here](https://github.com/americanexpress/jest-image-snapshot#%EF%B8%8F-api).
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
65
node_modules/@popperjs/core/dist/cjs/enums.js
generated
vendored
Normal file
|
@ -0,0 +1,65 @@
|
|||
/**
|
||||
* @popperjs/core v2.11.8 - MIT License
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var top = 'top';
|
||||
var bottom = 'bottom';
|
||||
var right = 'right';
|
||||
var left = 'left';
|
||||
var auto = 'auto';
|
||||
var basePlacements = [top, bottom, right, left];
|
||||
var start = 'start';
|
||||
var end = 'end';
|
||||
var clippingParents = 'clippingParents';
|
||||
var viewport = 'viewport';
|
||||
var popper = 'popper';
|
||||
var reference = 'reference';
|
||||
var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
|
||||
return acc.concat([placement + "-" + start, placement + "-" + end]);
|
||||
}, []);
|
||||
var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
|
||||
return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
|
||||
}, []); // modifiers that need to read the DOM
|
||||
|
||||
var beforeRead = 'beforeRead';
|
||||
var read = 'read';
|
||||
var afterRead = 'afterRead'; // pure-logic modifiers
|
||||
|
||||
var beforeMain = 'beforeMain';
|
||||
var main = 'main';
|
||||
var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
|
||||
|
||||
var beforeWrite = 'beforeWrite';
|
||||
var write = 'write';
|
||||
var afterWrite = 'afterWrite';
|
||||
var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
|
||||
|
||||
exports.afterMain = afterMain;
|
||||
exports.afterRead = afterRead;
|
||||
exports.afterWrite = afterWrite;
|
||||
exports.auto = auto;
|
||||
exports.basePlacements = basePlacements;
|
||||
exports.beforeMain = beforeMain;
|
||||
exports.beforeRead = beforeRead;
|
||||
exports.beforeWrite = beforeWrite;
|
||||
exports.bottom = bottom;
|
||||
exports.clippingParents = clippingParents;
|
||||
exports.end = end;
|
||||
exports.left = left;
|
||||
exports.main = main;
|
||||
exports.modifierPhases = modifierPhases;
|
||||
exports.placements = placements;
|
||||
exports.popper = popper;
|
||||
exports.read = read;
|
||||
exports.reference = reference;
|
||||
exports.right = right;
|
||||
exports.start = start;
|
||||
exports.top = top;
|
||||
exports.variationPlacements = variationPlacements;
|
||||
exports.viewport = viewport;
|
||||
exports.write = write;
|
||||
//# sourceMappingURL=enums.js.map
|
3
node_modules/@popperjs/core/dist/cjs/enums.js.flow
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
// @flow
|
||||
|
||||
export * from '../../lib/enums.js'
|
1
node_modules/@popperjs/core/dist/cjs/enums.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"enums.js","sources":["../../src/enums.js"],"sourcesContent":["// @flow\nexport const top: 'top' = 'top';\nexport const bottom: 'bottom' = 'bottom';\nexport const right: 'right' = 'right';\nexport const left: 'left' = 'left';\nexport const auto: 'auto' = 'auto';\nexport type BasePlacement =\n | typeof top\n | typeof bottom\n | typeof right\n | typeof left;\nexport const basePlacements: Array<BasePlacement> = [top, bottom, right, left];\n\nexport const start: 'start' = 'start';\nexport const end: 'end' = 'end';\nexport type Variation = typeof start | typeof end;\n\nexport const clippingParents: 'clippingParents' = 'clippingParents';\nexport const viewport: 'viewport' = 'viewport';\nexport type Boundary = Element | Array<Element> | typeof clippingParents;\nexport type RootBoundary = typeof viewport | 'document';\n\nexport const popper: 'popper' = 'popper';\nexport const reference: 'reference' = 'reference';\nexport type Context = typeof popper | typeof reference;\n\nexport type VariationPlacement =\n | 'top-start'\n | 'top-end'\n | 'bottom-start'\n | 'bottom-end'\n | 'right-start'\n | 'right-end'\n | 'left-start'\n | 'left-end';\nexport type AutoPlacement = 'auto' | 'auto-start' | 'auto-end';\nexport type ComputedPlacement = VariationPlacement | BasePlacement;\nexport type Placement = AutoPlacement | BasePlacement | VariationPlacement;\n\nexport const variationPlacements: Array<VariationPlacement> = basePlacements.reduce(\n (acc: Array<VariationPlacement>, placement: BasePlacement) =>\n acc.concat([(`${placement}-${start}`: any), (`${placement}-${end}`: any)]),\n []\n);\nexport const placements: Array<Placement> = [...basePlacements, auto].reduce(\n (\n acc: Array<Placement>,\n placement: BasePlacement | typeof auto\n ): Array<Placement> =>\n acc.concat([\n placement,\n (`${placement}-${start}`: any),\n (`${placement}-${end}`: any),\n ]),\n []\n);\n\n// modifiers that need to read the DOM\nexport const beforeRead: 'beforeRead' = 'beforeRead';\nexport const read: 'read' = 'read';\nexport const afterRead: 'afterRead' = 'afterRead';\n// pure-logic modifiers\nexport const beforeMain: 'beforeMain' = 'beforeMain';\nexport const main: 'main' = 'main';\nexport const afterMain: 'afterMain' = 'afterMain';\n// modifier with the purpose to write to the DOM (or write into a framework state)\nexport const beforeWrite: 'beforeWrite' = 'beforeWrite';\nexport const write: 'write' = 'write';\nexport const afterWrite: 'afterWrite' = 'afterWrite';\nexport const modifierPhases: Array<ModifierPhases> = [\n beforeRead,\n read,\n afterRead,\n beforeMain,\n main,\n afterMain,\n beforeWrite,\n write,\n afterWrite,\n];\n\nexport type ModifierPhases =\n | typeof beforeRead\n | typeof read\n | typeof afterRead\n | typeof beforeMain\n | typeof main\n | typeof afterMain\n | typeof beforeWrite\n | typeof write\n | typeof afterWrite;\n"],"names":["top","bottom","right","left","auto","basePlacements","start","end","clippingParents","viewport","popper","reference","variationPlacements","reduce","acc","placement","concat","placements","beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite","modifierPhases"],"mappings":";;;;;;;;IACaA,GAAU,GAAG;IACbC,MAAgB,GAAG;IACnBC,KAAc,GAAG;IACjBC,IAAY,GAAG;IACfC,IAAY,GAAG;IAMfC,cAAoC,GAAG,CAACL,GAAD,EAAMC,MAAN,EAAcC,KAAd,EAAqBC,IAArB;IAEvCG,KAAc,GAAG;IACjBC,GAAU,GAAG;IAGbC,eAAkC,GAAG;IACrCC,QAAoB,GAAG;IAIvBC,MAAgB,GAAG;IACnBC,SAAsB,GAAG;IAgBzBC,mBAA8C,gBAAGP,cAAc,CAACQ,MAAf,CAC5D,UAACC,GAAD,EAAiCC,SAAjC;AAAA,SACED,GAAG,CAACE,MAAJ,CAAW,CAAKD,SAAL,SAAkBT,KAAlB,EAAqCS,SAArC,SAAkDR,GAAlD,CAAX,CADF;AAAA,CAD4D,EAG5D,EAH4D;IAKjDU,UAA4B,gBAAG,UAAIZ,cAAJ,GAAoBD,IAApB,GAA0BS,MAA1B,CAC1C,UACEC,GADF,EAEEC,SAFF;AAAA,SAIED,GAAG,CAACE,MAAJ,CAAW,CACTD,SADS,EAELA,SAFK,SAEQT,KAFR,EAGLS,SAHK,SAGQR,GAHR,CAAX,CAJF;AAAA,CAD0C,EAU1C,EAV0C;;IAc/BW,UAAwB,GAAG;IAC3BC,IAAY,GAAG;IACfC,SAAsB,GAAG;;IAEzBC,UAAwB,GAAG;IAC3BC,IAAY,GAAG;IACfC,SAAsB,GAAG;;IAEzBC,WAA0B,GAAG;IAC7BC,KAAc,GAAG;IACjBC,UAAwB,GAAG;IAC3BC,cAAqC,GAAG,CACnDT,UADmD,EAEnDC,IAFmD,EAGnDC,SAHmD,EAInDC,UAJmD,EAKnDC,IALmD,EAMnDC,SANmD,EAOnDC,WAPmD,EAQnDC,KARmD,EASnDC,UATmD;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
939
node_modules/@popperjs/core/dist/cjs/popper-base.js
generated
vendored
Normal file
|
@ -0,0 +1,939 @@
|
|||
/**
|
||||
* @popperjs/core v2.11.8 - MIT License
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
function getWindow(node) {
|
||||
if (node == null) {
|
||||
return window;
|
||||
}
|
||||
|
||||
if (node.toString() !== '[object Window]') {
|
||||
var ownerDocument = node.ownerDocument;
|
||||
return ownerDocument ? ownerDocument.defaultView || window : window;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
function isElement(node) {
|
||||
var OwnElement = getWindow(node).Element;
|
||||
return node instanceof OwnElement || node instanceof Element;
|
||||
}
|
||||
|
||||
function isHTMLElement(node) {
|
||||
var OwnElement = getWindow(node).HTMLElement;
|
||||
return node instanceof OwnElement || node instanceof HTMLElement;
|
||||
}
|
||||
|
||||
function isShadowRoot(node) {
|
||||
// IE 11 has no ShadowRoot
|
||||
if (typeof ShadowRoot === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
|
||||
var OwnElement = getWindow(node).ShadowRoot;
|
||||
return node instanceof OwnElement || node instanceof ShadowRoot;
|
||||
}
|
||||
|
||||
var max = Math.max;
|
||||
var min = Math.min;
|
||||
var round = Math.round;
|
||||
|
||||
function getUAString() {
|
||||
var uaData = navigator.userAgentData;
|
||||
|
||||
if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
|
||||
return uaData.brands.map(function (item) {
|
||||
return item.brand + "/" + item.version;
|
||||
}).join(' ');
|
||||
}
|
||||
|
||||
return navigator.userAgent;
|
||||
}
|
||||
|
||||
function isLayoutViewport() {
|
||||
return !/^((?!chrome|android).)*safari/i.test(getUAString());
|
||||
}
|
||||
|
||||
function getBoundingClientRect(element, includeScale, isFixedStrategy) {
|
||||
if (includeScale === void 0) {
|
||||
includeScale = false;
|
||||
}
|
||||
|
||||
if (isFixedStrategy === void 0) {
|
||||
isFixedStrategy = false;
|
||||
}
|
||||
|
||||
var clientRect = element.getBoundingClientRect();
|
||||
var scaleX = 1;
|
||||
var scaleY = 1;
|
||||
|
||||
if (includeScale && isHTMLElement(element)) {
|
||||
scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
|
||||
scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
|
||||
}
|
||||
|
||||
var _ref = isElement(element) ? getWindow(element) : window,
|
||||
visualViewport = _ref.visualViewport;
|
||||
|
||||
var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
|
||||
var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
|
||||
var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
|
||||
var width = clientRect.width / scaleX;
|
||||
var height = clientRect.height / scaleY;
|
||||
return {
|
||||
width: width,
|
||||
height: height,
|
||||
top: y,
|
||||
right: x + width,
|
||||
bottom: y + height,
|
||||
left: x,
|
||||
x: x,
|
||||
y: y
|
||||
};
|
||||
}
|
||||
|
||||
function getWindowScroll(node) {
|
||||
var win = getWindow(node);
|
||||
var scrollLeft = win.pageXOffset;
|
||||
var scrollTop = win.pageYOffset;
|
||||
return {
|
||||
scrollLeft: scrollLeft,
|
||||
scrollTop: scrollTop
|
||||
};
|
||||
}
|
||||
|
||||
function getHTMLElementScroll(element) {
|
||||
return {
|
||||
scrollLeft: element.scrollLeft,
|
||||
scrollTop: element.scrollTop
|
||||
};
|
||||
}
|
||||
|
||||
function getNodeScroll(node) {
|
||||
if (node === getWindow(node) || !isHTMLElement(node)) {
|
||||
return getWindowScroll(node);
|
||||
} else {
|
||||
return getHTMLElementScroll(node);
|
||||
}
|
||||
}
|
||||
|
||||
function getNodeName(element) {
|
||||
return element ? (element.nodeName || '').toLowerCase() : null;
|
||||
}
|
||||
|
||||
function getDocumentElement(element) {
|
||||
// $FlowFixMe[incompatible-return]: assume body is always available
|
||||
return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
|
||||
element.document) || window.document).documentElement;
|
||||
}
|
||||
|
||||
function getWindowScrollBarX(element) {
|
||||
// If <html> has a CSS width greater than the viewport, then this will be
|
||||
// incorrect for RTL.
|
||||
// Popper 1 is broken in this case and never had a bug report so let's assume
|
||||
// it's not an issue. I don't think anyone ever specifies width on <html>
|
||||
// anyway.
|
||||
// Browsers where the left scrollbar doesn't cause an issue report `0` for
|
||||
// this (e.g. Edge 2019, IE11, Safari)
|
||||
return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
|
||||
}
|
||||
|
||||
function getComputedStyle(element) {
|
||||
return getWindow(element).getComputedStyle(element);
|
||||
}
|
||||
|
||||
function isScrollParent(element) {
|
||||
// Firefox wants us to check `-x` and `-y` variations as well
|
||||
var _getComputedStyle = getComputedStyle(element),
|
||||
overflow = _getComputedStyle.overflow,
|
||||
overflowX = _getComputedStyle.overflowX,
|
||||
overflowY = _getComputedStyle.overflowY;
|
||||
|
||||
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
|
||||
}
|
||||
|
||||
function isElementScaled(element) {
|
||||
var rect = element.getBoundingClientRect();
|
||||
var scaleX = round(rect.width) / element.offsetWidth || 1;
|
||||
var scaleY = round(rect.height) / element.offsetHeight || 1;
|
||||
return scaleX !== 1 || scaleY !== 1;
|
||||
} // Returns the composite rect of an element relative to its offsetParent.
|
||||
// Composite means it takes into account transforms as well as layout.
|
||||
|
||||
|
||||
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
||||
if (isFixed === void 0) {
|
||||
isFixed = false;
|
||||
}
|
||||
|
||||
var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
||||
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
|
||||
var documentElement = getDocumentElement(offsetParent);
|
||||
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
|
||||
var scroll = {
|
||||
scrollLeft: 0,
|
||||
scrollTop: 0
|
||||
};
|
||||
var offsets = {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
|
||||
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
||||
if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
|
||||
isScrollParent(documentElement)) {
|
||||
scroll = getNodeScroll(offsetParent);
|
||||
}
|
||||
|
||||
if (isHTMLElement(offsetParent)) {
|
||||
offsets = getBoundingClientRect(offsetParent, true);
|
||||
offsets.x += offsetParent.clientLeft;
|
||||
offsets.y += offsetParent.clientTop;
|
||||
} else if (documentElement) {
|
||||
offsets.x = getWindowScrollBarX(documentElement);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
x: rect.left + scroll.scrollLeft - offsets.x,
|
||||
y: rect.top + scroll.scrollTop - offsets.y,
|
||||
width: rect.width,
|
||||
height: rect.height
|
||||
};
|
||||
}
|
||||
|
||||
// means it doesn't take into account transforms.
|
||||
|
||||
function getLayoutRect(element) {
|
||||
var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
|
||||
// Fixes https://github.com/popperjs/popper-core/issues/1223
|
||||
|
||||
var width = element.offsetWidth;
|
||||
var height = element.offsetHeight;
|
||||
|
||||
if (Math.abs(clientRect.width - width) <= 1) {
|
||||
width = clientRect.width;
|
||||
}
|
||||
|
||||
if (Math.abs(clientRect.height - height) <= 1) {
|
||||
height = clientRect.height;
|
||||
}
|
||||
|
||||
return {
|
||||
x: element.offsetLeft,
|
||||
y: element.offsetTop,
|
||||
width: width,
|
||||
height: height
|
||||
};
|
||||
}
|
||||
|
||||
function getParentNode(element) {
|
||||
if (getNodeName(element) === 'html') {
|
||||
return element;
|
||||
}
|
||||
|
||||
return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
|
||||
// $FlowFixMe[incompatible-return]
|
||||
// $FlowFixMe[prop-missing]
|
||||
element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
|
||||
element.parentNode || ( // DOM Element detected
|
||||
isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
|
||||
// $FlowFixMe[incompatible-call]: HTMLElement is a Node
|
||||
getDocumentElement(element) // fallback
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
function getScrollParent(node) {
|
||||
if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
|
||||
// $FlowFixMe[incompatible-return]: assume body is always available
|
||||
return node.ownerDocument.body;
|
||||
}
|
||||
|
||||
if (isHTMLElement(node) && isScrollParent(node)) {
|
||||
return node;
|
||||
}
|
||||
|
||||
return getScrollParent(getParentNode(node));
|
||||
}
|
||||
|
||||
/*
|
||||
given a DOM element, return the list of all scroll parents, up the list of ancesors
|
||||
until we get to the top window object. This list is what we attach scroll listeners
|
||||
to, because if any of these parent elements scroll, we'll need to re-calculate the
|
||||
reference element's position.
|
||||
*/
|
||||
|
||||
function listScrollParents(element, list) {
|
||||
var _element$ownerDocumen;
|
||||
|
||||
if (list === void 0) {
|
||||
list = [];
|
||||
}
|
||||
|
||||
var scrollParent = getScrollParent(element);
|
||||
var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
|
||||
var win = getWindow(scrollParent);
|
||||
var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
|
||||
var updatedList = list.concat(target);
|
||||
return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
|
||||
updatedList.concat(listScrollParents(getParentNode(target)));
|
||||
}
|
||||
|
||||
function isTableElement(element) {
|
||||
return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
|
||||
}
|
||||
|
||||
function getTrueOffsetParent(element) {
|
||||
if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
|
||||
getComputedStyle(element).position === 'fixed') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return element.offsetParent;
|
||||
} // `.offsetParent` reports `null` for fixed elements, while absolute elements
|
||||
// return the containing block
|
||||
|
||||
|
||||
function getContainingBlock(element) {
|
||||
var isFirefox = /firefox/i.test(getUAString());
|
||||
var isIE = /Trident/i.test(getUAString());
|
||||
|
||||
if (isIE && isHTMLElement(element)) {
|
||||
// In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
|
||||
var elementCss = getComputedStyle(element);
|
||||
|
||||
if (elementCss.position === 'fixed') {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
var currentNode = getParentNode(element);
|
||||
|
||||
if (isShadowRoot(currentNode)) {
|
||||
currentNode = currentNode.host;
|
||||
}
|
||||
|
||||
while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
|
||||
var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
|
||||
// create a containing block.
|
||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
||||
|
||||
if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
|
||||
return currentNode;
|
||||
} else {
|
||||
currentNode = currentNode.parentNode;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
} // Gets the closest ancestor positioned element. Handles some edge cases,
|
||||
// such as table ancestors and cross browser bugs.
|
||||
|
||||
|
||||
function getOffsetParent(element) {
|
||||
var window = getWindow(element);
|
||||
var offsetParent = getTrueOffsetParent(element);
|
||||
|
||||
while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
|
||||
offsetParent = getTrueOffsetParent(offsetParent);
|
||||
}
|
||||
|
||||
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
|
||||
return window;
|
||||
}
|
||||
|
||||
return offsetParent || getContainingBlock(element) || window;
|
||||
}
|
||||
|
||||
var top = 'top';
|
||||
var bottom = 'bottom';
|
||||
var right = 'right';
|
||||
var left = 'left';
|
||||
var basePlacements = [top, bottom, right, left];
|
||||
var start = 'start';
|
||||
var end = 'end';
|
||||
var clippingParents = 'clippingParents';
|
||||
var viewport = 'viewport';
|
||||
var popper = 'popper';
|
||||
var reference = 'reference';
|
||||
|
||||
var beforeRead = 'beforeRead';
|
||||
var read = 'read';
|
||||
var afterRead = 'afterRead'; // pure-logic modifiers
|
||||
|
||||
var beforeMain = 'beforeMain';
|
||||
var main = 'main';
|
||||
var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
|
||||
|
||||
var beforeWrite = 'beforeWrite';
|
||||
var write = 'write';
|
||||
var afterWrite = 'afterWrite';
|
||||
var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
|
||||
|
||||
function order(modifiers) {
|
||||
var map = new Map();
|
||||
var visited = new Set();
|
||||
var result = [];
|
||||
modifiers.forEach(function (modifier) {
|
||||
map.set(modifier.name, modifier);
|
||||
}); // On visiting object, check for its dependencies and visit them recursively
|
||||
|
||||
function sort(modifier) {
|
||||
visited.add(modifier.name);
|
||||
var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
|
||||
requires.forEach(function (dep) {
|
||||
if (!visited.has(dep)) {
|
||||
var depModifier = map.get(dep);
|
||||
|
||||
if (depModifier) {
|
||||
sort(depModifier);
|
||||
}
|
||||
}
|
||||
});
|
||||
result.push(modifier);
|
||||
}
|
||||
|
||||
modifiers.forEach(function (modifier) {
|
||||
if (!visited.has(modifier.name)) {
|
||||
// check for visited object
|
||||
sort(modifier);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
function orderModifiers(modifiers) {
|
||||
// order based on dependencies
|
||||
var orderedModifiers = order(modifiers); // order based on phase
|
||||
|
||||
return modifierPhases.reduce(function (acc, phase) {
|
||||
return acc.concat(orderedModifiers.filter(function (modifier) {
|
||||
return modifier.phase === phase;
|
||||
}));
|
||||
}, []);
|
||||
}
|
||||
|
||||
function debounce(fn) {
|
||||
var pending;
|
||||
return function () {
|
||||
if (!pending) {
|
||||
pending = new Promise(function (resolve) {
|
||||
Promise.resolve().then(function () {
|
||||
pending = undefined;
|
||||
resolve(fn());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return pending;
|
||||
};
|
||||
}
|
||||
|
||||
function mergeByName(modifiers) {
|
||||
var merged = modifiers.reduce(function (merged, current) {
|
||||
var existing = merged[current.name];
|
||||
merged[current.name] = existing ? Object.assign({}, existing, current, {
|
||||
options: Object.assign({}, existing.options, current.options),
|
||||
data: Object.assign({}, existing.data, current.data)
|
||||
}) : current;
|
||||
return merged;
|
||||
}, {}); // IE11 does not support Object.values
|
||||
|
||||
return Object.keys(merged).map(function (key) {
|
||||
return merged[key];
|
||||
});
|
||||
}
|
||||
|
||||
function getViewportRect(element, strategy) {
|
||||
var win = getWindow(element);
|
||||
var html = getDocumentElement(element);
|
||||
var visualViewport = win.visualViewport;
|
||||
var width = html.clientWidth;
|
||||
var height = html.clientHeight;
|
||||
var x = 0;
|
||||
var y = 0;
|
||||
|
||||
if (visualViewport) {
|
||||
width = visualViewport.width;
|
||||
height = visualViewport.height;
|
||||
var layoutViewport = isLayoutViewport();
|
||||
|
||||
if (layoutViewport || !layoutViewport && strategy === 'fixed') {
|
||||
x = visualViewport.offsetLeft;
|
||||
y = visualViewport.offsetTop;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
width: width,
|
||||
height: height,
|
||||
x: x + getWindowScrollBarX(element),
|
||||
y: y
|
||||
};
|
||||
}
|
||||
|
||||
// of the `<html>` and `<body>` rect bounds if horizontally scrollable
|
||||
|
||||
function getDocumentRect(element) {
|
||||
var _element$ownerDocumen;
|
||||
|
||||
var html = getDocumentElement(element);
|
||||
var winScroll = getWindowScroll(element);
|
||||
var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
|
||||
var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
||||
var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
||||
var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
|
||||
var y = -winScroll.scrollTop;
|
||||
|
||||
if (getComputedStyle(body || html).direction === 'rtl') {
|
||||
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
||||
}
|
||||
|
||||
return {
|
||||
width: width,
|
||||
height: height,
|
||||
x: x,
|
||||
y: y
|
||||
};
|
||||
}
|
||||
|
||||
function contains(parent, child) {
|
||||
var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
|
||||
|
||||
if (parent.contains(child)) {
|
||||
return true;
|
||||
} // then fallback to custom implementation with Shadow DOM support
|
||||
else if (rootNode && isShadowRoot(rootNode)) {
|
||||
var next = child;
|
||||
|
||||
do {
|
||||
if (next && parent.isSameNode(next)) {
|
||||
return true;
|
||||
} // $FlowFixMe[prop-missing]: need a better way to handle this...
|
||||
|
||||
|
||||
next = next.parentNode || next.host;
|
||||
} while (next);
|
||||
} // Give up, the result is false
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function rectToClientRect(rect) {
|
||||
return Object.assign({}, rect, {
|
||||
left: rect.x,
|
||||
top: rect.y,
|
||||
right: rect.x + rect.width,
|
||||
bottom: rect.y + rect.height
|
||||
});
|
||||
}
|
||||
|
||||
function getInnerBoundingClientRect(element, strategy) {
|
||||
var rect = getBoundingClientRect(element, false, strategy === 'fixed');
|
||||
rect.top = rect.top + element.clientTop;
|
||||
rect.left = rect.left + element.clientLeft;
|
||||
rect.bottom = rect.top + element.clientHeight;
|
||||
rect.right = rect.left + element.clientWidth;
|
||||
rect.width = element.clientWidth;
|
||||
rect.height = element.clientHeight;
|
||||
rect.x = rect.left;
|
||||
rect.y = rect.top;
|
||||
return rect;
|
||||
}
|
||||
|
||||
function getClientRectFromMixedType(element, clippingParent, strategy) {
|
||||
return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
||||
} // A "clipping parent" is an overflowable container with the characteristic of
|
||||
// clipping (or hiding) overflowing elements with a position different from
|
||||
// `initial`
|
||||
|
||||
|
||||
function getClippingParents(element) {
|
||||
var clippingParents = listScrollParents(getParentNode(element));
|
||||
var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
|
||||
var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
|
||||
|
||||
if (!isElement(clipperElement)) {
|
||||
return [];
|
||||
} // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
|
||||
|
||||
|
||||
return clippingParents.filter(function (clippingParent) {
|
||||
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
|
||||
});
|
||||
} // Gets the maximum area that the element is visible in due to any number of
|
||||
// clipping parents
|
||||
|
||||
|
||||
function getClippingRect(element, boundary, rootBoundary, strategy) {
|
||||
var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
|
||||
var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
|
||||
var firstClippingParent = clippingParents[0];
|
||||
var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
|
||||
var rect = getClientRectFromMixedType(element, clippingParent, strategy);
|
||||
accRect.top = max(rect.top, accRect.top);
|
||||
accRect.right = min(rect.right, accRect.right);
|
||||
accRect.bottom = min(rect.bottom, accRect.bottom);
|
||||
accRect.left = max(rect.left, accRect.left);
|
||||
return accRect;
|
||||
}, getClientRectFromMixedType(element, firstClippingParent, strategy));
|
||||
clippingRect.width = clippingRect.right - clippingRect.left;
|
||||
clippingRect.height = clippingRect.bottom - clippingRect.top;
|
||||
clippingRect.x = clippingRect.left;
|
||||
clippingRect.y = clippingRect.top;
|
||||
return clippingRect;
|
||||
}
|
||||
|
||||
function getBasePlacement(placement) {
|
||||
return placement.split('-')[0];
|
||||
}
|
||||
|
||||
function getVariation(placement) {
|
||||
return placement.split('-')[1];
|
||||
}
|
||||
|
||||
function getMainAxisFromPlacement(placement) {
|
||||
return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
|
||||
}
|
||||
|
||||
function computeOffsets(_ref) {
|
||||
var reference = _ref.reference,
|
||||
element = _ref.element,
|
||||
placement = _ref.placement;
|
||||
var basePlacement = placement ? getBasePlacement(placement) : null;
|
||||
var variation = placement ? getVariation(placement) : null;
|
||||
var commonX = reference.x + reference.width / 2 - element.width / 2;
|
||||
var commonY = reference.y + reference.height / 2 - element.height / 2;
|
||||
var offsets;
|
||||
|
||||
switch (basePlacement) {
|
||||
case top:
|
||||
offsets = {
|
||||
x: commonX,
|
||||
y: reference.y - element.height
|
||||
};
|
||||
break;
|
||||
|
||||
case bottom:
|
||||
offsets = {
|
||||
x: commonX,
|
||||
y: reference.y + reference.height
|
||||
};
|
||||
break;
|
||||
|
||||
case right:
|
||||
offsets = {
|
||||
x: reference.x + reference.width,
|
||||
y: commonY
|
||||
};
|
||||
break;
|
||||
|
||||
case left:
|
||||
offsets = {
|
||||
x: reference.x - element.width,
|
||||
y: commonY
|
||||
};
|
||||
break;
|
||||
|
||||
default:
|
||||
offsets = {
|
||||
x: reference.x,
|
||||
y: reference.y
|
||||
};
|
||||
}
|
||||
|
||||
var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
|
||||
|
||||
if (mainAxis != null) {
|
||||
var len = mainAxis === 'y' ? 'height' : 'width';
|
||||
|
||||
switch (variation) {
|
||||
case start:
|
||||
offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
|
||||
break;
|
||||
|
||||
case end:
|
||||
offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return offsets;
|
||||
}
|
||||
|
||||
function getFreshSideObject() {
|
||||
return {
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
left: 0
|
||||
};
|
||||
}
|
||||
|
||||
function mergePaddingObject(paddingObject) {
|
||||
return Object.assign({}, getFreshSideObject(), paddingObject);
|
||||
}
|
||||
|
||||
function expandToHashMap(value, keys) {
|
||||
return keys.reduce(function (hashMap, key) {
|
||||
hashMap[key] = value;
|
||||
return hashMap;
|
||||
}, {});
|
||||
}
|
||||
|
||||
function detectOverflow(state, options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
var _options = options,
|
||||
_options$placement = _options.placement,
|
||||
placement = _options$placement === void 0 ? state.placement : _options$placement,
|
||||
_options$strategy = _options.strategy,
|
||||
strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,
|
||||
_options$boundary = _options.boundary,
|
||||
boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
|
||||
_options$rootBoundary = _options.rootBoundary,
|
||||
rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
|
||||
_options$elementConte = _options.elementContext,
|
||||
elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
|
||||
_options$altBoundary = _options.altBoundary,
|
||||
altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
|
||||
_options$padding = _options.padding,
|
||||
padding = _options$padding === void 0 ? 0 : _options$padding;
|
||||
var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
|
||||
var altContext = elementContext === popper ? reference : popper;
|
||||
var popperRect = state.rects.popper;
|
||||
var element = state.elements[altBoundary ? altContext : elementContext];
|
||||
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
|
||||
var referenceClientRect = getBoundingClientRect(state.elements.reference);
|
||||
var popperOffsets = computeOffsets({
|
||||
reference: referenceClientRect,
|
||||
element: popperRect,
|
||||
strategy: 'absolute',
|
||||
placement: placement
|
||||
});
|
||||
var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
|
||||
var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
|
||||
// 0 or negative = within the clipping rect
|
||||
|
||||
var overflowOffsets = {
|
||||
top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
|
||||
bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
|
||||
left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
|
||||
right: elementClientRect.right - clippingClientRect.right + paddingObject.right
|
||||
};
|
||||
var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
|
||||
|
||||
if (elementContext === popper && offsetData) {
|
||||
var offset = offsetData[placement];
|
||||
Object.keys(overflowOffsets).forEach(function (key) {
|
||||
var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
|
||||
var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
|
||||
overflowOffsets[key] += offset[axis] * multiply;
|
||||
});
|
||||
}
|
||||
|
||||
return overflowOffsets;
|
||||
}
|
||||
|
||||
var DEFAULT_OPTIONS = {
|
||||
placement: 'bottom',
|
||||
modifiers: [],
|
||||
strategy: 'absolute'
|
||||
};
|
||||
|
||||
function areValidElements() {
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
return !args.some(function (element) {
|
||||
return !(element && typeof element.getBoundingClientRect === 'function');
|
||||
});
|
||||
}
|
||||
|
||||
function popperGenerator(generatorOptions) {
|
||||
if (generatorOptions === void 0) {
|
||||
generatorOptions = {};
|
||||
}
|
||||
|
||||
var _generatorOptions = generatorOptions,
|
||||
_generatorOptions$def = _generatorOptions.defaultModifiers,
|
||||
defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
|
||||
_generatorOptions$def2 = _generatorOptions.defaultOptions,
|
||||
defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
|
||||
return function createPopper(reference, popper, options) {
|
||||
if (options === void 0) {
|
||||
options = defaultOptions;
|
||||
}
|
||||
|
||||
var state = {
|
||||
placement: 'bottom',
|
||||
orderedModifiers: [],
|
||||
options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
|
||||
modifiersData: {},
|
||||
elements: {
|
||||
reference: reference,
|
||||
popper: popper
|
||||
},
|
||||
attributes: {},
|
||||
styles: {}
|
||||
};
|
||||
var effectCleanupFns = [];
|
||||
var isDestroyed = false;
|
||||
var instance = {
|
||||
state: state,
|
||||
setOptions: function setOptions(setOptionsAction) {
|
||||
var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
|
||||
cleanupModifierEffects();
|
||||
state.options = Object.assign({}, defaultOptions, state.options, options);
|
||||
state.scrollParents = {
|
||||
reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
|
||||
popper: listScrollParents(popper)
|
||||
}; // Orders the modifiers based on their dependencies and `phase`
|
||||
// properties
|
||||
|
||||
var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
|
||||
|
||||
state.orderedModifiers = orderedModifiers.filter(function (m) {
|
||||
return m.enabled;
|
||||
});
|
||||
runModifierEffects();
|
||||
return instance.update();
|
||||
},
|
||||
// Sync update – it will always be executed, even if not necessary. This
|
||||
// is useful for low frequency updates where sync behavior simplifies the
|
||||
// logic.
|
||||
// For high frequency updates (e.g. `resize` and `scroll` events), always
|
||||
// prefer the async Popper#update method
|
||||
forceUpdate: function forceUpdate() {
|
||||
if (isDestroyed) {
|
||||
return;
|
||||
}
|
||||
|
||||
var _state$elements = state.elements,
|
||||
reference = _state$elements.reference,
|
||||
popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
|
||||
// anymore
|
||||
|
||||
if (!areValidElements(reference, popper)) {
|
||||
return;
|
||||
} // Store the reference and popper rects to be read by modifiers
|
||||
|
||||
|
||||
state.rects = {
|
||||
reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
|
||||
popper: getLayoutRect(popper)
|
||||
}; // Modifiers have the ability to reset the current update cycle. The
|
||||
// most common use case for this is the `flip` modifier changing the
|
||||
// placement, which then needs to re-run all the modifiers, because the
|
||||
// logic was previously ran for the previous placement and is therefore
|
||||
// stale/incorrect
|
||||
|
||||
state.reset = false;
|
||||
state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
|
||||
// is filled with the initial data specified by the modifier. This means
|
||||
// it doesn't persist and is fresh on each update.
|
||||
// To ensure persistent data, use `${name}#persistent`
|
||||
|
||||
state.orderedModifiers.forEach(function (modifier) {
|
||||
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
|
||||
});
|
||||
|
||||
for (var index = 0; index < state.orderedModifiers.length; index++) {
|
||||
if (state.reset === true) {
|
||||
state.reset = false;
|
||||
index = -1;
|
||||
continue;
|
||||
}
|
||||
|
||||
var _state$orderedModifie = state.orderedModifiers[index],
|
||||
fn = _state$orderedModifie.fn,
|
||||
_state$orderedModifie2 = _state$orderedModifie.options,
|
||||
_options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
|
||||
name = _state$orderedModifie.name;
|
||||
|
||||
if (typeof fn === 'function') {
|
||||
state = fn({
|
||||
state: state,
|
||||
options: _options,
|
||||
name: name,
|
||||
instance: instance
|
||||
}) || state;
|
||||
}
|
||||
}
|
||||
},
|
||||
// Async and optimistically optimized update – it will not be executed if
|
||||
// not necessary (debounced to run at most once-per-tick)
|
||||
update: debounce(function () {
|
||||
return new Promise(function (resolve) {
|
||||
instance.forceUpdate();
|
||||
resolve(state);
|
||||
});
|
||||
}),
|
||||
destroy: function destroy() {
|
||||
cleanupModifierEffects();
|
||||
isDestroyed = true;
|
||||
}
|
||||
};
|
||||
|
||||
if (!areValidElements(reference, popper)) {
|
||||
return instance;
|
||||
}
|
||||
|
||||
instance.setOptions(options).then(function (state) {
|
||||
if (!isDestroyed && options.onFirstUpdate) {
|
||||
options.onFirstUpdate(state);
|
||||
}
|
||||
}); // Modifiers have the ability to execute arbitrary code before the first
|
||||
// update cycle runs. They will be executed in the same order as the update
|
||||
// cycle. This is useful when a modifier adds some persistent data that
|
||||
// other modifiers need to use, but the modifier is run after the dependent
|
||||
// one.
|
||||
|
||||
function runModifierEffects() {
|
||||
state.orderedModifiers.forEach(function (_ref) {
|
||||
var name = _ref.name,
|
||||
_ref$options = _ref.options,
|
||||
options = _ref$options === void 0 ? {} : _ref$options,
|
||||
effect = _ref.effect;
|
||||
|
||||
if (typeof effect === 'function') {
|
||||
var cleanupFn = effect({
|
||||
state: state,
|
||||
name: name,
|
||||
instance: instance,
|
||||
options: options
|
||||
});
|
||||
|
||||
var noopFn = function noopFn() {};
|
||||
|
||||
effectCleanupFns.push(cleanupFn || noopFn);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function cleanupModifierEffects() {
|
||||
effectCleanupFns.forEach(function (fn) {
|
||||
return fn();
|
||||
});
|
||||
effectCleanupFns = [];
|
||||
}
|
||||
|
||||
return instance;
|
||||
};
|
||||
}
|
||||
var createPopper = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules
|
||||
|
||||
exports.createPopper = createPopper;
|
||||
exports.detectOverflow = detectOverflow;
|
||||
exports.popperGenerator = popperGenerator;
|
||||
//# sourceMappingURL=popper-base.js.map
|
3
node_modules/@popperjs/core/dist/cjs/popper-base.js.flow
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
// @flow
|
||||
|
||||
export * from '../../lib/popper-base.js'
|
1
node_modules/@popperjs/core/dist/cjs/popper-base.js.map
generated
vendored
Normal file
1260
node_modules/@popperjs/core/dist/cjs/popper-lite.js
generated
vendored
Normal file
3
node_modules/@popperjs/core/dist/cjs/popper-lite.js.flow
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
// @flow
|
||||
|
||||
export * from '../../lib/popper-lite.js'
|
1
node_modules/@popperjs/core/dist/cjs/popper-lite.js.map
generated
vendored
Normal file
1819
node_modules/@popperjs/core/dist/cjs/popper.js
generated
vendored
Normal file
3
node_modules/@popperjs/core/dist/cjs/popper.js.flow
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
// @flow
|
||||
|
||||
export * from '../../lib/popper.js'
|
1
node_modules/@popperjs/core/dist/cjs/popper.js.map
generated
vendored
Normal file
199
node_modules/@popperjs/core/dist/esm/createPopper.js
generated
vendored
Normal file
|
@ -0,0 +1,199 @@
|
|||
import getCompositeRect from "./dom-utils/getCompositeRect.js";
|
||||
import getLayoutRect from "./dom-utils/getLayoutRect.js";
|
||||
import listScrollParents from "./dom-utils/listScrollParents.js";
|
||||
import getOffsetParent from "./dom-utils/getOffsetParent.js";
|
||||
import orderModifiers from "./utils/orderModifiers.js";
|
||||
import debounce from "./utils/debounce.js";
|
||||
import mergeByName from "./utils/mergeByName.js";
|
||||
import detectOverflow from "./utils/detectOverflow.js";
|
||||
import { isElement } from "./dom-utils/instanceOf.js";
|
||||
var DEFAULT_OPTIONS = {
|
||||
placement: 'bottom',
|
||||
modifiers: [],
|
||||
strategy: 'absolute'
|
||||
};
|
||||
|
||||
function areValidElements() {
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
return !args.some(function (element) {
|
||||
return !(element && typeof element.getBoundingClientRect === 'function');
|
||||
});
|
||||
}
|
||||
|
||||
export function popperGenerator(generatorOptions) {
|
||||
if (generatorOptions === void 0) {
|
||||
generatorOptions = {};
|
||||
}
|
||||
|
||||
var _generatorOptions = generatorOptions,
|
||||
_generatorOptions$def = _generatorOptions.defaultModifiers,
|
||||
defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
|
||||
_generatorOptions$def2 = _generatorOptions.defaultOptions,
|
||||
defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
|
||||
return function createPopper(reference, popper, options) {
|
||||
if (options === void 0) {
|
||||
options = defaultOptions;
|
||||
}
|
||||
|
||||
var state = {
|
||||
placement: 'bottom',
|
||||
orderedModifiers: [],
|
||||
options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
|
||||
modifiersData: {},
|
||||
elements: {
|
||||
reference: reference,
|
||||
popper: popper
|
||||
},
|
||||
attributes: {},
|
||||
styles: {}
|
||||
};
|
||||
var effectCleanupFns = [];
|
||||
var isDestroyed = false;
|
||||
var instance = {
|
||||
state: state,
|
||||
setOptions: function setOptions(setOptionsAction) {
|
||||
var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
|
||||
cleanupModifierEffects();
|
||||
state.options = Object.assign({}, defaultOptions, state.options, options);
|
||||
state.scrollParents = {
|
||||
reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
|
||||
popper: listScrollParents(popper)
|
||||
}; // Orders the modifiers based on their dependencies and `phase`
|
||||
// properties
|
||||
|
||||
var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
|
||||
|
||||
state.orderedModifiers = orderedModifiers.filter(function (m) {
|
||||
return m.enabled;
|
||||
});
|
||||
runModifierEffects();
|
||||
return instance.update();
|
||||
},
|
||||
// Sync update – it will always be executed, even if not necessary. This
|
||||
// is useful for low frequency updates where sync behavior simplifies the
|
||||
// logic.
|
||||
// For high frequency updates (e.g. `resize` and `scroll` events), always
|
||||
// prefer the async Popper#update method
|
||||
forceUpdate: function forceUpdate() {
|
||||
if (isDestroyed) {
|
||||
return;
|
||||
}
|
||||
|
||||
var _state$elements = state.elements,
|
||||
reference = _state$elements.reference,
|
||||
popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
|
||||
// anymore
|
||||
|
||||
if (!areValidElements(reference, popper)) {
|
||||
return;
|
||||
} // Store the reference and popper rects to be read by modifiers
|
||||
|
||||
|
||||
state.rects = {
|
||||
reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
|
||||
popper: getLayoutRect(popper)
|
||||
}; // Modifiers have the ability to reset the current update cycle. The
|
||||
// most common use case for this is the `flip` modifier changing the
|
||||
// placement, which then needs to re-run all the modifiers, because the
|
||||
// logic was previously ran for the previous placement and is therefore
|
||||
// stale/incorrect
|
||||
|
||||
state.reset = false;
|
||||
state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
|
||||
// is filled with the initial data specified by the modifier. This means
|
||||
// it doesn't persist and is fresh on each update.
|
||||
// To ensure persistent data, use `${name}#persistent`
|
||||
|
||||
state.orderedModifiers.forEach(function (modifier) {
|
||||
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
|
||||
});
|
||||
|
||||
for (var index = 0; index < state.orderedModifiers.length; index++) {
|
||||
if (state.reset === true) {
|
||||
state.reset = false;
|
||||
index = -1;
|
||||
continue;
|
||||
}
|
||||
|
||||
var _state$orderedModifie = state.orderedModifiers[index],
|
||||
fn = _state$orderedModifie.fn,
|
||||
_state$orderedModifie2 = _state$orderedModifie.options,
|
||||
_options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
|
||||
name = _state$orderedModifie.name;
|
||||
|
||||
if (typeof fn === 'function') {
|
||||
state = fn({
|
||||
state: state,
|
||||
options: _options,
|
||||
name: name,
|
||||
instance: instance
|
||||
}) || state;
|
||||
}
|
||||
}
|
||||
},
|
||||
// Async and optimistically optimized update – it will not be executed if
|
||||
// not necessary (debounced to run at most once-per-tick)
|
||||
update: debounce(function () {
|
||||
return new Promise(function (resolve) {
|
||||
instance.forceUpdate();
|
||||
resolve(state);
|
||||
});
|
||||
}),
|
||||
destroy: function destroy() {
|
||||
cleanupModifierEffects();
|
||||
isDestroyed = true;
|
||||
}
|
||||
};
|
||||
|
||||
if (!areValidElements(reference, popper)) {
|
||||
return instance;
|
||||
}
|
||||
|
||||
instance.setOptions(options).then(function (state) {
|
||||
if (!isDestroyed && options.onFirstUpdate) {
|
||||
options.onFirstUpdate(state);
|
||||
}
|
||||
}); // Modifiers have the ability to execute arbitrary code before the first
|
||||
// update cycle runs. They will be executed in the same order as the update
|
||||
// cycle. This is useful when a modifier adds some persistent data that
|
||||
// other modifiers need to use, but the modifier is run after the dependent
|
||||
// one.
|
||||
|
||||
function runModifierEffects() {
|
||||
state.orderedModifiers.forEach(function (_ref) {
|
||||
var name = _ref.name,
|
||||
_ref$options = _ref.options,
|
||||
options = _ref$options === void 0 ? {} : _ref$options,
|
||||
effect = _ref.effect;
|
||||
|
||||
if (typeof effect === 'function') {
|
||||
var cleanupFn = effect({
|
||||
state: state,
|
||||
name: name,
|
||||
instance: instance,
|
||||
options: options
|
||||
});
|
||||
|
||||
var noopFn = function noopFn() {};
|
||||
|
||||
effectCleanupFns.push(cleanupFn || noopFn);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function cleanupModifierEffects() {
|
||||
effectCleanupFns.forEach(function (fn) {
|
||||
return fn();
|
||||
});
|
||||
effectCleanupFns = [];
|
||||
}
|
||||
|
||||
return instance;
|
||||
};
|
||||
}
|
||||
export var createPopper = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules
|
||||
|
||||
export { detectOverflow };
|
23
node_modules/@popperjs/core/dist/esm/dom-utils/contains.js
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
import { isShadowRoot } from "./instanceOf.js";
|
||||
export default function contains(parent, child) {
|
||||
var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
|
||||
|
||||
if (parent.contains(child)) {
|
||||
return true;
|
||||
} // then fallback to custom implementation with Shadow DOM support
|
||||
else if (rootNode && isShadowRoot(rootNode)) {
|
||||
var next = child;
|
||||
|
||||
do {
|
||||
if (next && parent.isSameNode(next)) {
|
||||
return true;
|
||||
} // $FlowFixMe[prop-missing]: need a better way to handle this...
|
||||
|
||||
|
||||
next = next.parentNode || next.host;
|
||||
} while (next);
|
||||
} // Give up, the result is false
|
||||
|
||||
|
||||
return false;
|
||||
}
|
41
node_modules/@popperjs/core/dist/esm/dom-utils/getBoundingClientRect.js
generated
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
import { isElement, isHTMLElement } from "./instanceOf.js";
|
||||
import { round } from "../utils/math.js";
|
||||
import getWindow from "./getWindow.js";
|
||||
import isLayoutViewport from "./isLayoutViewport.js";
|
||||
export default function getBoundingClientRect(element, includeScale, isFixedStrategy) {
|
||||
if (includeScale === void 0) {
|
||||
includeScale = false;
|
||||
}
|
||||
|
||||
if (isFixedStrategy === void 0) {
|
||||
isFixedStrategy = false;
|
||||
}
|
||||
|
||||
var clientRect = element.getBoundingClientRect();
|
||||
var scaleX = 1;
|
||||
var scaleY = 1;
|
||||
|
||||
if (includeScale && isHTMLElement(element)) {
|
||||
scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
|
||||
scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
|
||||
}
|
||||
|
||||
var _ref = isElement(element) ? getWindow(element) : window,
|
||||
visualViewport = _ref.visualViewport;
|
||||
|
||||
var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
|
||||
var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
|
||||
var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
|
||||
var width = clientRect.width / scaleX;
|
||||
var height = clientRect.height / scaleY;
|
||||
return {
|
||||
width: width,
|
||||
height: height,
|
||||
top: y,
|
||||
right: x + width,
|
||||
bottom: y + height,
|
||||
left: x,
|
||||
x: x,
|
||||
y: y
|
||||
};
|
||||
}
|
70
node_modules/@popperjs/core/dist/esm/dom-utils/getClippingRect.js
generated
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
import { viewport } from "../enums.js";
|
||||
import getViewportRect from "./getViewportRect.js";
|
||||
import getDocumentRect from "./getDocumentRect.js";
|
||||
import listScrollParents from "./listScrollParents.js";
|
||||
import getOffsetParent from "./getOffsetParent.js";
|
||||
import getDocumentElement from "./getDocumentElement.js";
|
||||
import getComputedStyle from "./getComputedStyle.js";
|
||||
import { isElement, isHTMLElement } from "./instanceOf.js";
|
||||
import getBoundingClientRect from "./getBoundingClientRect.js";
|
||||
import getParentNode from "./getParentNode.js";
|
||||
import contains from "./contains.js";
|
||||
import getNodeName from "./getNodeName.js";
|
||||
import rectToClientRect from "../utils/rectToClientRect.js";
|
||||
import { max, min } from "../utils/math.js";
|
||||
|
||||
function getInnerBoundingClientRect(element, strategy) {
|
||||
var rect = getBoundingClientRect(element, false, strategy === 'fixed');
|
||||
rect.top = rect.top + element.clientTop;
|
||||
rect.left = rect.left + element.clientLeft;
|
||||
rect.bottom = rect.top + element.clientHeight;
|
||||
rect.right = rect.left + element.clientWidth;
|
||||
rect.width = element.clientWidth;
|
||||
rect.height = element.clientHeight;
|
||||
rect.x = rect.left;
|
||||
rect.y = rect.top;
|
||||
return rect;
|
||||
}
|
||||
|
||||
function getClientRectFromMixedType(element, clippingParent, strategy) {
|
||||
return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
||||
} // A "clipping parent" is an overflowable container with the characteristic of
|
||||
// clipping (or hiding) overflowing elements with a position different from
|
||||
// `initial`
|
||||
|
||||
|
||||
function getClippingParents(element) {
|
||||
var clippingParents = listScrollParents(getParentNode(element));
|
||||
var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
|
||||
var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
|
||||
|
||||
if (!isElement(clipperElement)) {
|
||||
return [];
|
||||
} // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
|
||||
|
||||
|
||||
return clippingParents.filter(function (clippingParent) {
|
||||
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
|
||||
});
|
||||
} // Gets the maximum area that the element is visible in due to any number of
|
||||
// clipping parents
|
||||
|
||||
|
||||
export default function getClippingRect(element, boundary, rootBoundary, strategy) {
|
||||
var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
|
||||
var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
|
||||
var firstClippingParent = clippingParents[0];
|
||||
var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
|
||||
var rect = getClientRectFromMixedType(element, clippingParent, strategy);
|
||||
accRect.top = max(rect.top, accRect.top);
|
||||
accRect.right = min(rect.right, accRect.right);
|
||||
accRect.bottom = min(rect.bottom, accRect.bottom);
|
||||
accRect.left = max(rect.left, accRect.left);
|
||||
return accRect;
|
||||
}, getClientRectFromMixedType(element, firstClippingParent, strategy));
|
||||
clippingRect.width = clippingRect.right - clippingRect.left;
|
||||
clippingRect.height = clippingRect.bottom - clippingRect.top;
|
||||
clippingRect.x = clippingRect.left;
|
||||
clippingRect.y = clippingRect.top;
|
||||
return clippingRect;
|
||||
}
|
58
node_modules/@popperjs/core/dist/esm/dom-utils/getCompositeRect.js
generated
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
import getBoundingClientRect from "./getBoundingClientRect.js";
|
||||
import getNodeScroll from "./getNodeScroll.js";
|
||||
import getNodeName from "./getNodeName.js";
|
||||
import { isHTMLElement } from "./instanceOf.js";
|
||||
import getWindowScrollBarX from "./getWindowScrollBarX.js";
|
||||
import getDocumentElement from "./getDocumentElement.js";
|
||||
import isScrollParent from "./isScrollParent.js";
|
||||
import { round } from "../utils/math.js";
|
||||
|
||||
function isElementScaled(element) {
|
||||
var rect = element.getBoundingClientRect();
|
||||
var scaleX = round(rect.width) / element.offsetWidth || 1;
|
||||
var scaleY = round(rect.height) / element.offsetHeight || 1;
|
||||
return scaleX !== 1 || scaleY !== 1;
|
||||
} // Returns the composite rect of an element relative to its offsetParent.
|
||||
// Composite means it takes into account transforms as well as layout.
|
||||
|
||||
|
||||
export default function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
||||
if (isFixed === void 0) {
|
||||
isFixed = false;
|
||||
}
|
||||
|
||||
var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
||||
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
|
||||
var documentElement = getDocumentElement(offsetParent);
|
||||
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
|
||||
var scroll = {
|
||||
scrollLeft: 0,
|
||||
scrollTop: 0
|
||||
};
|
||||
var offsets = {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
|
||||
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
||||
if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
|
||||
isScrollParent(documentElement)) {
|
||||
scroll = getNodeScroll(offsetParent);
|
||||
}
|
||||
|
||||
if (isHTMLElement(offsetParent)) {
|
||||
offsets = getBoundingClientRect(offsetParent, true);
|
||||
offsets.x += offsetParent.clientLeft;
|
||||
offsets.y += offsetParent.clientTop;
|
||||
} else if (documentElement) {
|
||||
offsets.x = getWindowScrollBarX(documentElement);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
x: rect.left + scroll.scrollLeft - offsets.x,
|
||||
y: rect.top + scroll.scrollTop - offsets.y,
|
||||
width: rect.width,
|
||||
height: rect.height
|
||||
};
|
||||
}
|
4
node_modules/@popperjs/core/dist/esm/dom-utils/getComputedStyle.js
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
import getWindow from "./getWindow.js";
|
||||
export default function getComputedStyle(element) {
|
||||
return getWindow(element).getComputedStyle(element);
|
||||
}
|