diff --git a/.nvmrc b/.nvmrc index b872caf..6f4247a 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1,2 +1 @@ -18.20.8 - +26 diff --git a/README.md b/README.md index 59c9ccf..a6707f3 100644 --- a/README.md +++ b/README.md @@ -114,6 +114,62 @@ else. Feel free, too, to simply use it as a model on which to build your own. +### Stylesheets + +Audimance provides default stylesheets for the spatial mixing room and the track list pages. It also provides parts of the Pure CSS framework and a collection of mobile styles. These can be overridden by show-specific templates as needed. For example: + +```html + + + + + +``` + +### Localizing an Audimance Performance + +The Audimance server supports shows in multiple languages. Supported languages are defined in `agenda.yaml` as BCP 47 tags. For example: + +```yaml +languages: [en, zh-TW] +``` + +The first language listed is the default, and is used whenever a user's preferred language doesn't match any of the languages supported by the show. + +The user's language is resolved in the following order: + +1. The `lang` query parameter +2. The browser's `Accept-Language` header +3. The default language. + +Localized views are stored in directories for each language code (e.g. `views/zh-TW/index.html`). If a page doesn't have a translated version, the server will fall back to using the default template in `views/`. + +All source and point of interest labels are paramterized by language code. The +`name` property serves as both an identifier and the fall-back option when there is no label for the user's current language. For example: + +```yaml +sources: + - name: "Choreography" + labels: + zh-TW: "編舞" +``` + +HTML templates can refer to a label using `{{.Label}}`. For example: + +```html +{{ range .Room.Sources }} + +{{ end }} +``` + +The label in this template renders as `編舞` for on a device set to `zh-TW`, and as `Choreography` for any other language. + +The spatial room's play button can be localized in each language-specific template. For example: + +```html +
+``` + ### Dependencies Because Audimance is intended to be run at venues with unreliable internet, all @@ -139,4 +195,3 @@ Audimance accepts cues on a UDP port (9001, by default) to be fed from external synchronization sources, such as from Figure53's [QLab](https://figure53.com/qlab/). It expects the cue label to be received in case-sensitive plain text on the UDP port to trigger the cue. - diff --git a/agenda/agenda.go b/agenda/agenda.go index ea052d1..bcdc5b9 100644 --- a/agenda/agenda.go +++ b/agenda/agenda.go @@ -1,30 +1,40 @@ package agenda import ( + "bytes" "crypto/md5" "encoding/hex" + "errors" "fmt" + "io" "os" "slices" "strings" "time" "github.com/gofrs/uuid" + "golang.org/x/text/language" yaml "gopkg.in/yaml.v3" ) var fileFormats = []string{"mp3", "m4a", "webm"} -// New attempts to load an agenda from the given filename -func New(filename string) (*Agenda, error) { +// Load reads an agenda from a YAML file. +func Load(filename string) (*Agenda, error) { data, err := os.ReadFile(filename) if err != nil { return nil, fmt.Errorf("failed to read agenda from file: %w", err) } + return New(bytes.NewReader(data)) +} + +// New reads an agenda from a YAML stream reader. +func New(src io.Reader) (*Agenda, error) { a := new(Agenda) - if err := yaml.Unmarshal(data, a); err != nil { + err := yaml.NewDecoder(src).Decode(a) + if err != nil { return nil, fmt.Errorf("failed to read YAML: %w", err) } @@ -58,6 +68,13 @@ func New(filename string) (*Agenda, error) { return nil, fmt.Errorf("failed to generate announcement %s: %w", ann.Name, err) } } + + if err = a.validateLanguages(); err != nil { + return nil, err + } + + a.localizeLabels(a.defaultLanguage()) + return a, err } @@ -97,6 +114,87 @@ type Agenda struct { // server, and so not validation should be performed, and no modifications // of the prefix be made. This is not recommended. RemoteMedia bool `json:"remoteMedia" yaml:"remoteMedia"` + + // BCP 47 tags. First entry is the default language. + Languages []string `json:"languages" yaml:"languages"` +} + +func (a *Agenda) defaultLanguage() string { + if len(a.Languages) == 0 { + return "" + } + + return a.Languages[0] +} + +// Localized returns a copy of the agenda with each source and point of interest labeled in the specified language. +func (a *Agenda) Localized(lang string) *Agenda { + out := *a + + out.Rooms = make([]*Room, len(a.Rooms)) + for i, r := range a.Rooms { + room := *r + + room.PointsOfInterest = make([]*PointOfInterest, len(r.PointsOfInterest)) + for j, p := range r.PointsOfInterest { + poi := *p + room.PointsOfInterest[j] = &poi + } + + room.Sources = make([]*Source, len(r.Sources)) + for j, s := range r.Sources { + src := *s + room.Sources[j] = &src + } + + out.Rooms[i] = &room + } + + out.localizeLabels(lang) + + return &out +} + +func (a *Agenda) localizeLabels(lang string) { + for _, p := range a.allPointsOfInterest() { + p.Label = p.labelFor(lang) + } +} + +func (a *Agenda) allPointsOfInterest() (out []*PointOfInterest) { + for _, r := range a.Rooms { + out = append(out, r.PointsOfInterest...) + + for _, s := range r.Sources { + out = append(out, &s.PointOfInterest) + } + } + + return out +} + +func (a *Agenda) validateLanguages() error { + if err := validateLanguageTags(a.Languages); err != nil { + return err + } + + for _, p := range a.allPointsOfInterest() { + if err := p.validateLabels(a.Languages); err != nil { + return err + } + } + + return nil +} + +func validateLanguageTags(languages []string) error { + for _, lang := range languages { + if _, err := language.Parse(lang); err != nil { + return fmt.Errorf("invalid language %q: %w", lang, err) + } + } + + return nil } // AllTracks returns the list of all tracks for all rooms and announcements so @@ -342,11 +440,39 @@ type PointOfInterest struct { // Name is the unique, human-friendly name for this source Name string `json:"name" yaml:"name"` + // Labels contains display text in each supported language, keyed by language code. + Labels map[string]string `json:"-" yaml:"labels"` + + // Label is the display text in the language the agenda was localized to, or the name if there is no label. + Label string `json:"label" yaml:"-"` + // Location indicates a specific 3-dimensional coordinate in the room from // which the audio of this source emanates Location Point `json:"location" yaml:"location"` } +func (p *PointOfInterest) labelFor(lang string) string { + if label := p.Labels[lang]; label != "" { + return label + } + + return p.Name +} + +// ErrUnlistedLanguage is returned when an agenda contains a label in a language it doesn't support. +var ErrUnlistedLanguage = errors.New("label is in a language that is not specified in the agenda's list of supported languages") + +// validateLabels checks that all POI labels are in one of the specified languages. +func (p *PointOfInterest) validateLabels(languages []string) error { + for lang := range p.Labels { + if !slices.Contains(languages, lang) { + return fmt.Errorf("%w: %q is labeled in %q, but the agenda lists %v", ErrUnlistedLanguage, p.Name, lang, languages) + } + } + + return nil +} + func (p *PointOfInterest) generateID() error { // If we don't have a name, generate one if p.Name == "" { diff --git a/agenda/agenda_test.go b/agenda/agenda_test.go new file mode 100644 index 0000000..1ebb9c6 --- /dev/null +++ b/agenda/agenda_test.go @@ -0,0 +1,44 @@ +package agenda_test + +import ( + "testing" + + "github.com/CyCoreSystems/audimance/agenda" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestLabelsFallBackToNames(t *testing.T) { + a, err := agenda.Load("testdata/no-languages.yaml") + require.NoError(t, err) + + room := a.Rooms[0] + assert.Equal(t, "Downstage center", room.PointsOfInterest[0].Label) + assert.Equal(t, "Choreography", room.Sources[0].Label) +} + +func TestLocalizedLabels(t *testing.T) { + a, err := agenda.Load("testdata/bilingual.yaml") + require.NoError(t, err) + + zh := a.Localized("zh-TW") + source, original := zh.Rooms[0].Sources[0], a.Rooms[0].Sources[0] + + assert.Equal(t, "編舞", source.Label) + assert.Equal(t, "Downstage center", zh.Rooms[0].PointsOfInterest[0].Label, "untranslated labels fall back to the name") + assert.Equal(t, original.ID, source.ID) + assert.Equal(t, original.Name, source.Name) + assert.Equal(t, "Choreography", original.Label, "localizing changed the original") +} + +func TestLabelsDefaultToFirstLanguage(t *testing.T) { + a, err := agenda.Load("testdata/chinese-first.yaml") + require.NoError(t, err) + + assert.Equal(t, "編舞", a.Rooms[0].Sources[0].Label) +} + +func TestRejectsLabelInUnlistedLanguage(t *testing.T) { + _, err := agenda.Load("testdata/label-in-unlisted-language.yaml") + assert.ErrorIs(t, err, agenda.ErrUnlistedLanguage) +} diff --git a/agenda/testdata/bilingual.yaml b/agenda/testdata/bilingual.yaml new file mode 100644 index 0000000..1c619e4 --- /dev/null +++ b/agenda/testdata/bilingual.yaml @@ -0,0 +1,9 @@ +languages: [en, zh-TW] +rooms: + - name: stage + pointsOfInterest: + - name: Downstage center + sources: + - name: Choreography + labels: + zh-TW: 編舞 diff --git a/agenda/testdata/chinese-first.yaml b/agenda/testdata/chinese-first.yaml new file mode 100644 index 0000000..43bd059 --- /dev/null +++ b/agenda/testdata/chinese-first.yaml @@ -0,0 +1,9 @@ +languages: [zh-TW, en] +rooms: + - name: stage + pointsOfInterest: + - name: Downstage center + sources: + - name: Choreography + labels: + zh-TW: 編舞 diff --git a/agenda/testdata/label-in-unlisted-language.yaml b/agenda/testdata/label-in-unlisted-language.yaml new file mode 100644 index 0000000..34f2e79 --- /dev/null +++ b/agenda/testdata/label-in-unlisted-language.yaml @@ -0,0 +1,9 @@ +languages: [en, zh-TW] +rooms: + - name: stage + pointsOfInterest: + - name: Downstage center + sources: + - name: Choreography + labels: + zh-Hant: 編舞 diff --git a/agenda/testdata/no-languages.yaml b/agenda/testdata/no-languages.yaml new file mode 100644 index 0000000..984e613 --- /dev/null +++ b/agenda/testdata/no-languages.yaml @@ -0,0 +1,6 @@ +rooms: + - name: stage + pointsOfInterest: + - name: Downstage center + sources: + - name: Choreography diff --git a/flake.nix b/flake.nix index 06e92ec..9083fc5 100644 --- a/flake.nix +++ b/flake.nix @@ -23,6 +23,7 @@ buildInputs = with pkgs; [ gci + git gofumpt golangci-lint pkgLint @@ -35,12 +36,13 @@ ]; pkgLint = pkgs.writeScriptBin "lint" '' - ${pkgs.nodejs_26}/bin/npm run build && - golangci-lint run ./ - ''; + ${pkgs.nodejs_26}/bin/npm run build && + golangci-lint run ./ + ''; in { - devShells.default = pkgs.mkShell { + # On macOS, mkShell breaks /usr/bin/git. + devShells.default = (if pkgs.stdenv.hostPlatform.isDarwin then pkgs.mkShellNoCC else pkgs.mkShell) { inherit buildInputs nativeBuildInputs @@ -61,7 +63,7 @@ ; vendorHash = "sha256-Up6pjR9C2Z5wX6yLnEytdqjGCqKMCbLUvEzTZIMN8sU="; - npmDepsHash = "sha256-6dDY4qR40LYpcVA8lkhSc3McupBpkYAOK8eDS35/Fvo="; + npmDepsHash = "sha256-u2MkAOFI0qVjii6z2Mbv4R7P3HbYfh0sYECuhSeK3rw="; npmDepsFetcherVersion = 2; }; @@ -76,10 +78,10 @@ preBuild = '' mkdir app - cp ${self.packages.${system}.app}/lib/node_modules/audimance-app/app/* app/ + cp -r ${self.packages.${system}.app}/lib/node_modules/audimance-app/app/* app/ ''; - vendorHash = "sha256-O03GmLuBuWegNMQJ3PMsojgFR/6bPRER4bjvxHxdUBw="; + vendorHash = "sha256-lpmE99NjL0WaheoLfs2KCdhSuUF1yz/w9/Y5Ev9h7+0="; }; }; diff --git a/go.mod b/go.mod index 2dad336..3a891d0 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,9 @@ require ( github.com/labstack/echo/v4 v4.16.3 github.com/labstack/gommon v0.5.0 github.com/prometheus/client_golang v1.25.0 + github.com/stretchr/testify v1.12.1 golang.org/x/net v0.62.0 + golang.org/x/text v0.44.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -25,9 +27,9 @@ require ( github.com/prometheus/procfs v0.23.0 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/crypto v0.58.0 // indirect golang.org/x/sys v0.50.0 // indirect - golang.org/x/text v0.44.0 // indirect golang.org/x/time v0.16.0 // indirect google.golang.org/protobuf v1.36.12 // indirect ) diff --git a/internal/i18n/resolver.go b/internal/i18n/resolver.go new file mode 100644 index 0000000..66609d1 --- /dev/null +++ b/internal/i18n/resolver.go @@ -0,0 +1,37 @@ +package i18n + +import ( + "golang.org/x/text/language" +) + +// Resolver chooses which language to use for a request. +type Resolver struct { + supported []string + matcher language.Matcher +} + +// NewResolver returns a Resolver for the specified list of languages. The first language is the default. +func NewResolver(supported []string) *Resolver { + tags := make([]language.Tag, len(supported)) + for i, lang := range supported { + tags[i] = language.Make(lang) + } + + return &Resolver{ + supported: supported, + matcher: language.NewMatcher(tags), + } +} + +// Resolve returns the language to use, given a request's lang query +// parameter and Accept-Language header. Returns "" for shows that don't list any languages. +func (r *Resolver) Resolve(query, acceptLanguage string) string { + if len(r.supported) == 0 { + return "" + } + + // Ignore the returned tag, which can have extra parts like "en-u-rg-gbzzzz". + _, index := language.MatchStrings(r.matcher, query, acceptLanguage) + + return r.supported[index] +} diff --git a/internal/i18n/resolver_test.go b/internal/i18n/resolver_test.go new file mode 100644 index 0000000..85e9786 --- /dev/null +++ b/internal/i18n/resolver_test.go @@ -0,0 +1,37 @@ +package i18n_test + +import ( + "testing" + + "github.com/CyCoreSystems/audimance/internal/i18n" + "github.com/stretchr/testify/assert" +) + +func TestResolve(t *testing.T) { + t.Run("empty-languages", func(t *testing.T) { + assert.Empty(t, i18n.NewResolver(nil).Resolve("zh-Hant", "zh-TW")) + }) + + t.Run("populated-languages", func(t *testing.T) { + r := i18n.NewResolver([]string{"en", "zh-TW"}) + + for _, c := range []struct { + query, acceptLanguage, want string + }{ + // The iOS app passes its preferred localization as a query parameter. + {"zh-Hant", "", "zh-TW"}, + {"en", "zh-TW", "en"}, + // If the lang query parameter doesn't contain a supported language, Accept-Language should be used instead. + {"fr", "zh-TW", "zh-TW"}, + {"not a tag!", "zh-TW", "zh-TW"}, + // For zh-CN, the language library's matched tag is zh-TW-u-rg-cnzzzz. + // This checks that Resolve returns zh-TW as listed in the agenda. + {"", "zh-CN", "zh-TW"}, + // Anything else gets the default. + {"", "fr-FR", "en"}, + {"", "", "en"}, + } { + assert.Equal(t, c.want, r.Resolve(c.query, c.acceptLanguage), "Resolve(%q, %q)", c.query, c.acceptLanguage) + } + }) +} diff --git a/main.go b/main.go index b660613..9877aad 100644 --- a/main.go +++ b/main.go @@ -1,17 +1,23 @@ package main import ( + "crypto/sha256" "embed" + "encoding/hex" "flag" "fmt" "html/template" "io" + "io/fs" "net/http" "os" "os/signal" + "path" + "strings" "syscall" "github.com/CyCoreSystems/audimance/agenda" + "github.com/CyCoreSystems/audimance/internal/i18n" "github.com/CyCoreSystems/audimance/internal/osc" "github.com/CyCoreSystems/audimance/showtime" "github.com/labstack/echo-contrib/prometheus" @@ -56,14 +62,78 @@ func init() { }, []string{"room"}) } -// Template contains an HTML templates for the web service +// Template contains an HTML templates for the web service, keyed by language code. type Template struct { - templates *template.Template + templates map[string]*template.Template } // Render adapts the native template to the echo web server renderer interface func (t *Template) Render(w io.Writer, name string, data interface{}, ctx echo.Context) error { - return t.templates.ExecuteTemplate(w, name, data) + setLanguageHeaders(ctx) + + lang, _ := ctx.Get("lang").(string) + + return t.templates[lang].ExecuteTemplate(w, name, data) +} + +// setLanguageHeaders ensures caches won't reuse a response for a request in a different language. +func setLanguageHeaders(ctx echo.Context) { + if lang, _ := ctx.Get("lang").(string); lang != "" { + ctx.Response().Header().Set("Content-Language", lang) + ctx.Response().Header().Add("Vary", "Accept-Language") + } +} + +// noCache makes browsers check with the server before reusing a response. +// iOS in particular seems to really hold on to old cached versions of the CSS. +func noCache(next echo.HandlerFunc) echo.HandlerFunc { + return func(c echo.Context) error { + c.Response().Header().Set("Cache-Control", "no-cache") + return next(c) + } +} + +// appFileServer serves the built files in app/ with caching headers, and +// ETags are generated for embedded files because they lack modification times. +func appFileServer(files fs.FS) (echo.HandlerFunc, error) { + etags := map[string]string{} + err := fs.WalkDir(files, ".", func(name string, d fs.DirEntry, err error) error { + if err != nil || d.IsDir() { + return err + } + + data, err := fs.ReadFile(files, name) + if err != nil { + return err + } + + sum := sha256.Sum256(data) + etags["/"+name] = `"` + hex.EncodeToString(sum[:]) + `"` + return nil + }) + if err != nil { + return nil, err + } + + server := http.FileServer(http.FS(files)) + + return func(c echo.Context) error { + urlPath := c.Request().URL.Path + if etag, ok := etags[urlPath]; ok { + header := c.Response().Header() + header.Set("ETag", etag) + + // Cache chunk files forever because they're named with a hash already. + if strings.HasPrefix(path.Base(urlPath), "chunk-") { + header.Set("Cache-Control", "max-age=31536000, immutable") + } else { + header.Set("Cache-Control", "no-cache") + } + } + + server.ServeHTTP(c.Response(), c.Request()) + return nil + }, nil } // CustomContext extends the Echo context to allow for custom data @@ -89,7 +159,7 @@ func main() { flag.Parse() // Read the Agenda - a, err := agenda.New("agenda.yaml") + a, err := agenda.Load("agenda.yaml") if err != nil { fmt.Printf("failed to read agenda: %s", err.Error()) os.Exit(1) @@ -109,12 +179,17 @@ func main() { } }() + resolver := i18n.NewResolver(a.Languages) + // Attach middleware e.Use(func(h echo.HandlerFunc) echo.HandlerFunc { return func(ctx echo.Context) error { + lang := resolver.Resolve(ctx.QueryParam("lang"), ctx.Request().Header.Get("Accept-Language")) + ctx.Set("lang", lang) + c := &CustomContext{ Context: ctx, - Agenda: a, + Agenda: a.Localized(lang), ShowTime: svc, } return h(c) @@ -141,23 +216,32 @@ func main() { } // Compile and attach templates + templates, err := loadTemplates(os.DirFS("views"), a.Languages) + if err != nil { + fmt.Printf("failed to parse views: %s", err.Error()) + os.Exit(1) + } e.Renderer = &Template{ - templates: template.Must(template.ParseGlob("views/*.html")), + templates: templates, } // Attach handlers // Handle the index e.GET("/", func(c echo.Context) error { - return c.Render(200, "index.html", a) + return c.Render(200, "index.html", c.(*CustomContext).Agenda) }) - // Serve internal javascript files - e.GET("/app/*", echo.WrapHandler(http.FileServer(http.FS(content)))) + // Serve Audimance's built-in JavaScript and stylesheets + appFiles, err := appFileServer(content) + if err != nil { + log.Fatalf("failed to read the app files: %s", err.Error()) + } + e.GET("/app/*", appFiles) // Serve user-supplied assets e.Static("/js", "js") - e.Static("/css", "css") + e.Group("/css", noCache).Static("/", "css") e.Static("/media", "media") e.GET("/admin", admin) @@ -197,6 +281,8 @@ func main() { func agendaJSON(c echo.Context) error { ctx := c.(*CustomContext) + setLanguageHeaders(ctx) + return ctx.JSON(200, ctx.Agenda) } diff --git a/package-lock.json b/package-lock.json index 9137937..c22d036 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "Apache-2.0", "dependencies": { "@3den.club/resonance-audio": "^1.0.1", - "d3": "^7.9.0", + "d3": "^7.9.2", "lodash": "^4.18.1", "nosleep.js": "^0.12.0" }, @@ -482,50 +482,50 @@ } }, "node_modules/d3": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/d3/-/d3-7.9.0.tgz", - "integrity": "sha512-e1U46jVP+w7Iut8Jt8ri1YsPOvFpg46k+K8TpCb0P+zjCkjkPnV7WzfDJzMHy1LnA+wj5pLT1wjO901gLXeEhA==", + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/d3/-/d3-7.9.2.tgz", + "integrity": "sha512-ZKb/mONPVKzaO5UlcWcwN8bS4ezvQaYu+bsou+XgNABdGC800kwH651ADTbbTxMPHW13UlvbQafdmJQDk1w7Mg==", "license": "ISC", "dependencies": { - "d3-array": "3", - "d3-axis": "3", - "d3-brush": "3", - "d3-chord": "3", - "d3-color": "3", - "d3-contour": "4", - "d3-delaunay": "6", - "d3-dispatch": "3", - "d3-drag": "3", - "d3-dsv": "3", - "d3-ease": "3", - "d3-fetch": "3", - "d3-force": "3", - "d3-format": "3", - "d3-geo": "3", - "d3-hierarchy": "3", - "d3-interpolate": "3", - "d3-path": "3", - "d3-polygon": "3", - "d3-quadtree": "3", - "d3-random": "3", - "d3-scale": "4", - "d3-scale-chromatic": "3", - "d3-selection": "3", - "d3-shape": "3", - "d3-time": "3", - "d3-time-format": "4", - "d3-timer": "3", - "d3-transition": "3", - "d3-zoom": "3" + "d3-array": "^3.2.5", + "d3-axis": "^3.0.1", + "d3-brush": "^3.0.1", + "d3-chord": "^3.0.2", + "d3-color": "^3.1.1", + "d3-contour": "^4.0.3", + "d3-delaunay": "^6.0.6", + "d3-dispatch": "^3.0.2", + "d3-drag": "^3.0.1", + "d3-dsv": "^3.0.2", + "d3-ease": "^3.0.2", + "d3-fetch": "^3.0.2", + "d3-force": "^3.0.1", + "d3-format": "^3.1.3", + "d3-geo": "^3.1.2", + "d3-hierarchy": "^3.1.3", + "d3-interpolate": "^3.0.2", + "d3-path": "^3.1.1", + "d3-polygon": "^3.0.2", + "d3-quadtree": "^3.0.2", + "d3-random": "^3.0.2", + "d3-scale": "^4.0.3", + "d3-scale-chromatic": "^3.1.1", + "d3-selection": "^3.0.1", + "d3-shape": "^3.2.1", + "d3-time": "^3.1.1", + "d3-time-format": "^4.1.1", + "d3-timer": "^3.0.2", + "d3-transition": "^3.0.2", + "d3-zoom": "^3.0.1" }, "engines": { "node": ">=12" } }, "node_modules/d3-array": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz", - "integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.5.tgz", + "integrity": "sha512-Th8qGXoBalmWsstpkuhmBuTsBQIFqYOJtjlBvNVvBfJ8E3uYusBUwUR8HU20U0qKKQkgCvKyR1YjiozWadk5QA==", "license": "ISC", "dependencies": { "internmap": "1 - 2" @@ -535,18 +535,18 @@ } }, "node_modules/d3-axis": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/d3-axis/-/d3-axis-3.0.0.tgz", - "integrity": "sha512-IH5tgjV4jE/GhHkRV0HiVYPDtvfjHQlQfJHs0usq7M30XcSBvOotpmH1IgkcXsO/5gEQZD43B//fc7SRT5S+xw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-axis/-/d3-axis-3.0.1.tgz", + "integrity": "sha512-E5QCXfaf/uJZEHHiqoWRq+bQEm2PzoVFv2rDC7CZ3wwI0MjfMW3w83J3ubobG4IJj3lShAI5eiPJhOu/8wHofA==", "license": "ISC", "engines": { "node": ">=12" } }, "node_modules/d3-brush": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/d3-brush/-/d3-brush-3.0.0.tgz", - "integrity": "sha512-ALnjWlVYkXsVIGlOsuWH1+3udkYFI48Ljihfnh8FZPF2QS9o+PzGLBslO0PjzVoHLZ2KCVgAM8NVkXPJB2aNnQ==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-brush/-/d3-brush-3.0.1.tgz", + "integrity": "sha512-L5Glqa/Gb7LU3ndIOMtA5mDzlJ0aXKp5ELP2X09ctWF23jO7+faIUVDbmaIi+D6k3EemXFWn1F3lkfguExoVhA==", "license": "ISC", "dependencies": { "d3-dispatch": "1 - 3", @@ -560,9 +560,9 @@ } }, "node_modules/d3-chord": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/d3-chord/-/d3-chord-3.0.1.tgz", - "integrity": "sha512-VE5S6TNa+j8msksl7HwjxMHDM2yNK3XCkusIlpX5kwauBfXuyLAtNg9jCp/iHH61tgI4sb6R/EIMWCqEIdjT/g==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/d3-chord/-/d3-chord-3.0.2.tgz", + "integrity": "sha512-cGmADo5M2PTi3ewJZ2lcE32eURd4JmHtQ5JwRIUcas5L1SXqufG9yPyjWp8fW0gRi7aZi9bgbZPFZO1eyZ+1CQ==", "license": "ISC", "dependencies": { "d3-path": "1 - 3" @@ -572,30 +572,30 @@ } }, "node_modules/d3-color": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz", - "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.1.tgz", + "integrity": "sha512-lfab8x0Bj0UO7SNsY8dZSbNIA6ipbkE3X0NG9nqjCu6CfCHZseuDnOSJY7hidKrjpP++i1M2qT+FlAdPKYRilA==", "license": "ISC", "engines": { "node": ">=12" } }, "node_modules/d3-contour": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/d3-contour/-/d3-contour-4.0.2.tgz", - "integrity": "sha512-4EzFTRIikzs47RGmdxbeUvLWtGedDUNkTcmzoeyg4sP/dvCexO47AaQL7VKy/gul85TOxw+IBgA8US2xwbToNA==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/d3-contour/-/d3-contour-4.0.3.tgz", + "integrity": "sha512-5DYURc8KwXPOhSUBblU0P9rVcArsSPxPOxsfO0Eud0s28oU0sB2e80aRHRL9AZW3usT8ikFKyIHpHHLNWLdRVA==", "license": "ISC", "dependencies": { - "d3-array": "^3.2.0" + "d3-array": "^3.2.4" }, "engines": { "node": ">=12" } }, "node_modules/d3-delaunay": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/d3-delaunay/-/d3-delaunay-6.0.4.tgz", - "integrity": "sha512-mdjtIZ1XLAM8bm/hx3WwjfHt6Sggek7qH043O8KEjDXN40xi3vx/6pYSVTwLjEgiXQTbvaouWKynLBiUZ6SK6A==", + "version": "6.0.6", + "resolved": "https://registry.npmjs.org/d3-delaunay/-/d3-delaunay-6.0.6.tgz", + "integrity": "sha512-DMQIEvSJhZCB6pwedcXaAlQ+MeKU5LlM2XakKtc73b/VM+RBiI1SRXycOEOKg2jsKj4zZ9F0KGYG6nCGwwWu/g==", "license": "ISC", "dependencies": { "delaunator": "5" @@ -605,18 +605,18 @@ } }, "node_modules/d3-dispatch": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-3.0.1.tgz", - "integrity": "sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-3.0.2.tgz", + "integrity": "sha512-sAzH4Y4nsLo8eSqw5jKiZt+LU2wZmL/qS+OkxQGjhwazB/D7TY34R/QK1eshfGr7cZEKymKZ/Haem7m+lu98Sg==", "license": "ISC", "engines": { "node": ">=12" } }, "node_modules/d3-drag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/d3-drag/-/d3-drag-3.0.0.tgz", - "integrity": "sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-drag/-/d3-drag-3.0.1.tgz", + "integrity": "sha512-OWeoayCq8J69hUIjvL+Mb6Q6Oaj/fyHV5XaXByEUAG+JUjIfTGDnk3qGpcXrD3VmQ3BSV96fcbM6fqq7C0tbPA==", "license": "ISC", "dependencies": { "d3-dispatch": "1 - 3", @@ -627,9 +627,9 @@ } }, "node_modules/d3-dsv": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/d3-dsv/-/d3-dsv-3.0.1.tgz", - "integrity": "sha512-UG6OvdI5afDIFP9w4G0mNq50dSOsXHJaRE8arAS5o9ApWnIElp8GZw1Dun8vP8OyHOZ/QJUKUJwxiiCCnUwm+Q==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/d3-dsv/-/d3-dsv-3.0.2.tgz", + "integrity": "sha512-FUnXhX7I4/AXyRCZzwfZTDGSq8PGZ4oR0tiCBqNGOZMsDrQ+6sIWNQnBzcCGhzJKZ6uCvCezTwflUqI209RRiQ==", "license": "ISC", "dependencies": { "commander": "7", @@ -652,18 +652,18 @@ } }, "node_modules/d3-ease": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz", - "integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.2.tgz", + "integrity": "sha512-B5znKqRmKROAN4oHWQ50W/qisVjA9GXh2WMsVKdFVp4DxWmcrOsweqgUOUVsv5th96kwaZlokU6SlV4J3gak1w==", "license": "BSD-3-Clause", "engines": { "node": ">=12" } }, "node_modules/d3-fetch": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/d3-fetch/-/d3-fetch-3.0.1.tgz", - "integrity": "sha512-kpkQIM20n3oLVBKGg6oHrUchHM3xODkTzjMoj7aWQFq5QEM+R6E4WkzT5+tojDY7yjez8KgCBRoj4aEr99Fdqw==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/d3-fetch/-/d3-fetch-3.0.2.tgz", + "integrity": "sha512-1wGF62bgjMRbF6mqbD+6rRWBL2hwWVYQjFO2UP3Wm1nIAvJZKaQxXM5caVY7athoCa8wIq9lCf7g44lPWFk50g==", "license": "ISC", "dependencies": { "d3-dsv": "1 - 3" @@ -673,9 +673,9 @@ } }, "node_modules/d3-force": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/d3-force/-/d3-force-3.0.0.tgz", - "integrity": "sha512-zxV/SsA+U4yte8051P4ECydjD/S+qeYtnaIyAs9tgHCqfguma/aAQDjo85A9Z6EKhBirHRJHXIgJUlffT4wdLg==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-force/-/d3-force-3.0.1.tgz", + "integrity": "sha512-kAaaHLFebBYwgi5cYBXAI8vKrQFMCD2MEswj2QuPKKbdU1wYLc8WXtS7O8F/b6POCIe3gJjY6hkDstHi1yMETQ==", "license": "ISC", "dependencies": { "d3-dispatch": "1 - 3", @@ -687,18 +687,18 @@ } }, "node_modules/d3-format": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.2.tgz", - "integrity": "sha512-AJDdYOdnyRDV5b6ArilzCPPwc1ejkHcoyFarqlPqT7zRYjhavcT3uSrqcMvsgh2CgoPbK3RCwyHaVyxYcP2Arg==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.3.tgz", + "integrity": "sha512-+F+/49swqmGuQJmSKnVMIDH/QkEFV5li9QRj0xm/KhyAUBv099O5PrvpQFxBp24PYph17Mnvt9mjKQV0ii0nMA==", "license": "ISC", "engines": { "node": ">=12" } }, "node_modules/d3-geo": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-3.1.1.tgz", - "integrity": "sha512-637ln3gXKXOwhalDzinUgY83KzNWZRKbYubaG+fGVuc/dxO64RRljtCTnf5ecMyE1RIdtqpkVcq0IbtU2S8j2Q==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-3.1.2.tgz", + "integrity": "sha512-5R8ZgDQorIxmauv7R6gpE/ndz+Z0qAZssigq0aXFdvPHdY41RqtW02jrRUQAL724NdPABYXo1+gQEGBBr7uKNg==", "license": "ISC", "dependencies": { "d3-array": "2.5.0 - 3" @@ -708,18 +708,18 @@ } }, "node_modules/d3-hierarchy": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-3.1.2.tgz", - "integrity": "sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-3.1.3.tgz", + "integrity": "sha512-GRajN5ZcnEwYFWqqdzhG1qJ3+fDg6WWzk47TJg7ePY7yvYAgRfD2r1mUx+wviBOWuCwamCUzjwMSdato43jbGA==", "license": "ISC", "engines": { "node": ">=12" } }, "node_modules/d3-interpolate": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz", - "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.2.tgz", + "integrity": "sha512-IRzGU62DtxhvsnSTWMQIdnoZ6gA+BCWwBon1EJI6SjoN595799b6z/QRBzXfFhE8iupUPp3042yBNo0STPqnzQ==", "license": "ISC", "dependencies": { "d3-color": "1 - 3" @@ -729,45 +729,45 @@ } }, "node_modules/d3-path": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz", - "integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.1.tgz", + "integrity": "sha512-jsbgV8zIT38ReB9O7X7gcLndTQRONSqNNd+oGIaTBdUug4r5jFmp0N6RY9R5GWbdUDucn0qoTGyfjapT4tDhcg==", "license": "ISC", "engines": { "node": ">=12" } }, "node_modules/d3-polygon": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/d3-polygon/-/d3-polygon-3.0.1.tgz", - "integrity": "sha512-3vbA7vXYwfe1SYhED++fPUQlWSYTTGmFmQiany/gdbiWgU/iEyQzyymwL9SkJjFFuCS4902BSzewVGsHHmHtXg==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/d3-polygon/-/d3-polygon-3.0.2.tgz", + "integrity": "sha512-WAUvPudGU1Dn4mDPfb6+JnnbeVEV53hG/BoT+bxts6AkZsOpTEiV1jHYX+2vtwCICNFG9Wxv8QS+eW1zE/Dwfg==", "license": "ISC", "engines": { "node": ">=12" } }, "node_modules/d3-quadtree": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/d3-quadtree/-/d3-quadtree-3.0.1.tgz", - "integrity": "sha512-04xDrxQTDTCFwP5H6hRhsRcb9xxv2RzkcsygFzmkSIOJy3PeRJP7sNk3VRIbKXcog561P9oU0/rVH6vDROAgUw==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/d3-quadtree/-/d3-quadtree-3.0.2.tgz", + "integrity": "sha512-9Lu9mqJKRbIk0d6mKDjpvPURaPdwHVK5CYbcdd0/4vBgz4ldz/7TIOse3kNERsByGNfld58KEco507AztJWyTQ==", "license": "ISC", "engines": { "node": ">=12" } }, "node_modules/d3-random": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/d3-random/-/d3-random-3.0.1.tgz", - "integrity": "sha512-FXMe9GfxTxqd5D6jFsQ+DJ8BJS4E/fT5mqqdjovykEB2oFbTMDVdg1MGFxfQW+FBOGoB++k8swBrgwSHT1cUXQ==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/d3-random/-/d3-random-3.0.2.tgz", + "integrity": "sha512-PxJi9LNV+7mulaYO77nd+oGurXGL1fhedXjHnB3pWLUcqDnQtF4VASoqnQGHgoXLByVdv5QJ/2kfwkGn5HTS8g==", "license": "ISC", "engines": { "node": ">=12" } }, "node_modules/d3-scale": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz", - "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.3.tgz", + "integrity": "sha512-66cWobCNzcMvlfoaDHCxuIv9TBUWG1BLOWdv9kHHFuCr1JdqAWPvTmsaEYDD5NRMyWZ5+7u0GqiCDfMXMqh3hg==", "license": "ISC", "dependencies": { "d3-array": "2.10.0 - 3", @@ -781,43 +781,44 @@ } }, "node_modules/d3-scale-chromatic": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/d3-scale-chromatic/-/d3-scale-chromatic-3.1.0.tgz", - "integrity": "sha512-A3s5PWiZ9YCXFye1o246KoscMWqf8BsD9eRiJ3He7C9OBaxKhAd5TFCdEx/7VbKtxxTsu//1mMJFrEt572cEyQ==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/d3-scale-chromatic/-/d3-scale-chromatic-3.1.1.tgz", + "integrity": "sha512-lA5gfN2yMvmChubmptnDiBfeGpHD7Yb1EbvCz0TZE0WHXhyR6W2allPuhKtzV5ILQRqeOdefF0qYtERReLUBDg==", "license": "ISC", "dependencies": { "d3-color": "1 - 3", - "d3-interpolate": "1 - 3" + "d3-interpolate": "1 - 3", + "d3-scale": "1 - 4" }, "engines": { "node": ">=12" } }, "node_modules/d3-selection": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.0.tgz", - "integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.1.tgz", + "integrity": "sha512-ODSf35vqCrlCfp7hrm0eZjvOosSXSYLjqvIlhMBV9q9VOx7EBJG6pc+uXBswEZNJgCGJ+qnKYcWutbZDIxe/Xg==", "license": "ISC", "engines": { "node": ">=12" } }, "node_modules/d3-shape": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz", - "integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.1.tgz", + "integrity": "sha512-dm2o+lbKdzg9tY7GEag/dB9hcbodLfwkE/DkvqbELJXaMz0yKzWWhZqhbI7CKubukA7HnRyz0avdtvi7EPxPvw==", "license": "ISC", "dependencies": { - "d3-path": "^3.1.0" + "d3-path": "^3.1.1" }, "engines": { "node": ">=12" } }, "node_modules/d3-time": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz", - "integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.1.tgz", + "integrity": "sha512-Ze7rjrhMzdeulh0/hjcfFj7XLAHOfowtEMfsoG6DU866HPynQNW7Wfen6hzXcqKTv8XzxvF6Hzr5XD6bMHr2ug==", "license": "ISC", "dependencies": { "d3-array": "2 - 3" @@ -827,9 +828,9 @@ } }, "node_modules/d3-time-format": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz", - "integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.1.tgz", + "integrity": "sha512-22XaqjyCjpqgda20erhsOjGmC3vvYwTNYniKAd45W5UWLDF43moeOuV9qYpRqobIlsnK0UhnKZjUUJm3VgORUA==", "license": "ISC", "dependencies": { "d3-time": "1 - 3" @@ -839,18 +840,18 @@ } }, "node_modules/d3-timer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz", - "integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.2.tgz", + "integrity": "sha512-1Il1aliroVSErrv5aulRBxAY+7+DnaoLIWGd1C6SsBTWDeobWiP/V69vwb8vT6abR1kKwaNe1196pmaQ1fK90A==", "license": "ISC", "engines": { "node": ">=12" } }, "node_modules/d3-transition": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/d3-transition/-/d3-transition-3.0.1.tgz", - "integrity": "sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/d3-transition/-/d3-transition-3.0.2.tgz", + "integrity": "sha512-RcjCsdFgyFoDB+QXLC5m60ZkTN0k9zH+ovoLlTdJnDS1AbfbcuowiM4pCKSTOclNibS4f4J4cbv2m7O7y8NTOQ==", "license": "ISC", "dependencies": { "d3-color": "1 - 3", @@ -867,9 +868,9 @@ } }, "node_modules/d3-zoom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/d3-zoom/-/d3-zoom-3.0.0.tgz", - "integrity": "sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-zoom/-/d3-zoom-3.0.1.tgz", + "integrity": "sha512-kfjD3BDQu/FOatpZ6JdMSyIoDwTxIpI29ySTI2J5ZlDaH1WbuJGQJ2Q9oJkWTEZEW98j6idezoomSD3Cn2zwiw==", "license": "ISC", "dependencies": { "d3-dispatch": "1 - 3", diff --git a/package.json b/package.json index 6c8e673..0a1e31b 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "type": "module", "main": "app.js", "scripts": { - "build": "esbuild src/*.js --bundle --format=esm --splitting --outdir=app --outbase=src" + "build": "esbuild src/*.js src/css/*.css --bundle --format=esm --splitting --outdir=app --outbase=src --loader:.css=copy" }, "files": [ "app/*" @@ -33,7 +33,7 @@ }, "dependencies": { "@3den.club/resonance-audio": "^1.0.1", - "d3": "^7.9.0", + "d3": "^7.9.2", "lodash": "^4.18.1", "nosleep.js": "^0.12.0" } diff --git a/src/agenda.js b/src/agenda.js index 2b605a8..6674116 100644 --- a/src/agenda.js +++ b/src/agenda.js @@ -6,7 +6,9 @@ export function LoadAgenda(cb) { return } - fetch('/agenda.json') + // Fetches the agenda in the page's language. + let lang = document.documentElement.lang + fetch(lang ? '/agenda.json?lang=' + encodeURIComponent(lang) : '/agenda.json') .then(function(resp) { return resp.json(); }) diff --git a/src/css/admin.css b/src/css/admin.css new file mode 100644 index 0000000..66e7160 --- /dev/null +++ b/src/css/admin.css @@ -0,0 +1,45 @@ +body { + background-color: black; + color: #b0b0b0; +} + +ul li { + list-style: none; + padding-top: 10px; + padding-bottom: 10px; + } + +li:hover { + background-color: #202020; +} + +.status { + width: 100%; + display: block; + position: fixed; +} + +.statusText { + font-size: 30px; +} + +.sourceText { + font-size: 20px; +} + +.cueList { + width: 100%; +} + +button { + background-color: #101010; + color: #b0b0b0; + border: 2px solid #004000; +} + +.referenceTime { padding-left: 7px; } + +.cueNotes { + font-style: italic; + text-align: left; +} diff --git a/src/css/checkbox.css b/src/css/checkbox.css new file mode 100644 index 0000000..d871300 --- /dev/null +++ b/src/css/checkbox.css @@ -0,0 +1,51 @@ +* { + --select-box-width: 3.1rem; + --select-box-height: 1.8rem; + --select-box-border-width: 0.1rem; +} + +input[type="checkbox"] { + position: relative; + -webkit-appearance: none; + appearance: none; + outline: none; + min-width: var(--select-box-width); + min-height: var(--select-box-height); + background-color: rgb(230, 230, 232); + border-radius: calc(var(--select-box-height) / 2); + margin: auto 0.5em auto 0; + vertical-align: middle; +} + +input[type="checkbox"]:after { + content: ""; + position: absolute; + height: calc(var(--select-box-height) - 5%); + width: calc(var(--select-box-height) - 5%); + top: calc(var(--select-box-height) * 0.025); + left: calc(var(--select-box-width) * 0.05); + border-radius: 50%; + background-color: white; +} + +input[type="checkbox"]:checked { + background-color: rgb(89, 187, 87); +} + +input[type="checkbox"]:checked:after { + left: calc((var(--select-box-width) / 2) - 5%); +} + +@media (prefers-color-scheme: dark) { + input[type="checkbox"] { + background-color: rgb(50, 50, 53); + } + + input[type="checkbox"]:after { + background-color: rgb(230, 230, 232); + } + + input[type="checkbox"]:checked { + background-color: rgb(92, 198, 88); + } +} diff --git a/src/css/master.css b/src/css/master.css new file mode 100644 index 0000000..b6f6fb2 --- /dev/null +++ b/src/css/master.css @@ -0,0 +1,114 @@ +* { + box-sizing: border-box; + margin: 0; + padding: 0; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; + font-size: 1em; + line-height: 1.1em; +} + +body { + background: rgb(240, 240, 245); + color: black; + padding: 1em; +} + + +@media (min-width: 768px) { + ul#preshow { + width: 95% !important; + } + + ul#preshow li div { + font-size: 150%; + } +} + +@media (prefers-color-scheme: dark) { + body { + background: black; + color: white; + } + + ul#preshow { + background: rgb(26, 26, 28) !important; + } + + ul#preshow li { + border-bottom-color: rgb(34, 34, 36) !important; + } +} + +h1 { + font-size: 225%; + padding-bottom: 1rem; +} + +h2 { + font-size: 175%; + padding: 2rem 0.25rem 1rem 0.25rem; +} + +ul { + list-style: none; + width: 100%; + height: 100%; +} + +li { + padding: 0.75em 0.5em; +} + +ul#preshow { + background: white; + border-radius: 0.5rem; + margin-top: 0.25rem; +} + +ul#preshow li { + padding: 1.25rem 1rem; + font-size: 115%; + border-bottom: 0.13rem rgb(236, 236, 236) solid; +} + +ul#preshow li:last-child { + border-bottom: none; +} + +button#play { + padding: 10px 20px; + font-size: 1.5rem; + border: 1px solid #efefef; + margin: 20px 0 20px 60px; + background-color: grey; +} + +audio { + width: 75%; + padding-top: 0.5em; +} + +ul.nav { + display: none; +} + +.program-item-description { + font-style: italic; + font-size: 85%; + padding-top: 0.25rem; +} + +header { + padding-left: 0.25rem; + padding-bottom: 1rem; +} + +.performance-description { + font-size: 125%; + font-weight: bold; + padding-bottom: 0.5rem; +} + +.copyright-statement { + font-style: italic; +} diff --git a/src/css/pure-base.css b/src/css/pure-base.css new file mode 100644 index 0000000..d7a516f --- /dev/null +++ b/src/css/pure-base.css @@ -0,0 +1,11 @@ +/*! +Pure v1.0.0 +Copyright 2013 Yahoo! +Licensed under the BSD License. +https://github.com/yahoo/pure/blob/master/LICENSE.md +*/ +/*! +normalize.css v^3.0 | MIT License | git.io/normalize +Copyright (c) Nicolas Gallagher and Jonathan Neal +*/ +/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */img,legend{border:0}legend,td,th{padding:0}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,optgroup,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{box-sizing:content-box;height:0}pre,textarea{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}table{border-collapse:collapse;border-spacing:0}.hidden,[hidden]{display:none!important}.pure-img{max-width:100%;height:auto;display:block} \ No newline at end of file diff --git a/src/css/pure-grids.css b/src/css/pure-grids.css new file mode 100644 index 0000000..33bec3c --- /dev/null +++ b/src/css/pure-grids.css @@ -0,0 +1,7 @@ +/*! +Pure v1.0.0 +Copyright 2013 Yahoo! +Licensed under the BSD License. +https://github.com/yahoo/pure/blob/master/LICENSE.md +*/ +.pure-g{letter-spacing:-.31em;text-rendering:optimizespeed;font-family:FreeSans,Arimo,"Droid Sans",Helvetica,Arial,sans-serif;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-flow:row wrap;-ms-flex-flow:row wrap;flex-flow:row wrap;-webkit-align-content:flex-start;-ms-flex-line-pack:start;align-content:flex-start}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){table .pure-g{display:block}}.opera-only :-o-prefocus,.pure-g{word-spacing:-.43em}.pure-u,.pure-u-1,.pure-u-1-1,.pure-u-1-12,.pure-u-1-2,.pure-u-1-24,.pure-u-1-3,.pure-u-1-4,.pure-u-1-5,.pure-u-1-6,.pure-u-1-8,.pure-u-10-24,.pure-u-11-12,.pure-u-11-24,.pure-u-12-24,.pure-u-13-24,.pure-u-14-24,.pure-u-15-24,.pure-u-16-24,.pure-u-17-24,.pure-u-18-24,.pure-u-19-24,.pure-u-2-24,.pure-u-2-3,.pure-u-2-5,.pure-u-20-24,.pure-u-21-24,.pure-u-22-24,.pure-u-23-24,.pure-u-24-24,.pure-u-3-24,.pure-u-3-4,.pure-u-3-5,.pure-u-3-8,.pure-u-4-24,.pure-u-4-5,.pure-u-5-12,.pure-u-5-24,.pure-u-5-5,.pure-u-5-6,.pure-u-5-8,.pure-u-6-24,.pure-u-7-12,.pure-u-7-24,.pure-u-7-8,.pure-u-8-24,.pure-u-9-24{display:inline-block;zoom:1;letter-spacing:normal;word-spacing:normal;vertical-align:top;text-rendering:auto}.pure-g [class*=pure-u]{font-family:sans-serif}.pure-u-1-24{width:4.1667%}.pure-u-1-12,.pure-u-2-24{width:8.3333%}.pure-u-1-8,.pure-u-3-24{width:12.5%}.pure-u-1-6,.pure-u-4-24{width:16.6667%}.pure-u-1-5{width:20%}.pure-u-5-24{width:20.8333%}.pure-u-1-4,.pure-u-6-24{width:25%}.pure-u-7-24{width:29.1667%}.pure-u-1-3,.pure-u-8-24{width:33.3333%}.pure-u-3-8,.pure-u-9-24{width:37.5%}.pure-u-2-5{width:40%}.pure-u-10-24,.pure-u-5-12{width:41.6667%}.pure-u-11-24{width:45.8333%}.pure-u-1-2,.pure-u-12-24{width:50%}.pure-u-13-24{width:54.1667%}.pure-u-14-24,.pure-u-7-12{width:58.3333%}.pure-u-3-5{width:60%}.pure-u-15-24,.pure-u-5-8{width:62.5%}.pure-u-16-24,.pure-u-2-3{width:66.6667%}.pure-u-17-24{width:70.8333%}.pure-u-18-24,.pure-u-3-4{width:75%}.pure-u-19-24{width:79.1667%}.pure-u-4-5{width:80%}.pure-u-20-24,.pure-u-5-6{width:83.3333%}.pure-u-21-24,.pure-u-7-8{width:87.5%}.pure-u-11-12,.pure-u-22-24{width:91.6667%}.pure-u-23-24{width:95.8333%}.pure-u-1,.pure-u-1-1,.pure-u-24-24,.pure-u-5-5{width:100%} \ No newline at end of file diff --git a/src/css/room.css b/src/css/room.css new file mode 100644 index 0000000..a9c3205 --- /dev/null +++ b/src/css/room.css @@ -0,0 +1,88 @@ +body { + background-color: white; + color: black; +} + +div#audimance-room { + background-color: white; + + /* Make room-space fullscreen */ + position: fixed; + left: 0px; + right: 0px; + top: 0px; + bottom: 0px; +} + +.button { + position: absolute; + inset: 0; + margin: auto; + width: fit-content; + height: fit-content; + font: inherit; + font-size: 40px; + font-weight: bold; + color: #222; + background: none; + border: none; +} + +@media (pointer: coarse) { + .button { + font-size: 100px; + } +} + +.sourceText { + font-size: 2em; + font-family: sans-serif; +} + +svg text { + fill: #222; + font-weight: bold; +} + +svg text.poi { + fill: white; +} + +svg circle { + r: 15px; +} + +svg circle.listener { + stroke: black; + fill: #eee; + r: 20px; + stroke-width: 2px; +} + +@media (prefers-color-scheme: dark) { + body { + background: black; + color: #ddd; + } + + div#audimance-room { + background-color: black; + } + + svg text { + fill: #ddd; + } + + .button { + color: #ddd; + } + + svg text.poi { + fill: black; + } + + svg circle.listener { + stroke: white; + fill: #222; + } +} diff --git a/src/css/selection-list.css b/src/css/selection-list.css new file mode 100644 index 0000000..f69be3d --- /dev/null +++ b/src/css/selection-list.css @@ -0,0 +1,98 @@ +ul.selection-list { + background: white; + border-radius: 0.5rem; +} + +ul.selection-list li { + display: flex; + justify-content: space-between; + align-items: center; + border-bottom: 0.13rem rgb(236, 236, 236) solid; + padding: 1rem 1rem 1rem 1.5rem; +} + +ul.selection-list li:last-child { + border-bottom: none; +} + +ul.selection-list a { + display: block; + text-decoration: none; + color: black; + width: 100%; +} + +ul.selection-list li.nav-item::after { + content: ''; + width: 0.5rem; + height: 0.5rem; + border-right: 0.125em solid rgb(184, 184, 184); + border-top: 0.125em solid rgb(184, 184, 184); + transform: rotate(45deg); +} + +ul.selection-list a:visited { + color: black; +} + +ul.selection-list li:has(a:active) { + background-color: rgb(203, 203, 208); +} + +ul.selection-list a:hover { + color: black; +} + +ul.selection-list a:focus { + color: black; +} + +ul.selection-list li { + display: flex; + justify-content: space-between; +} + +ul.selection-list li label { + align-self: center; +} + +@media (prefers-color-scheme: dark) { + ul.selection-list { + background: rgb(26, 26, 28) !important; + } + + ul.selection-list li { + border-bottom-color: rgb(34, 34, 36) !important; + } + + ul.selection-list li.nav-item::after { + border-right: 0.125em solid rgb(74, 74, 75); + border-top: 0.125em solid rgb(74, 74, 75); + } + + ul.selection-list a { + color: white !important; + } + + ul.selection-list a:visited { + color: white !important; + } + + ul.selection-list a:focus { + color: white !important; + } + + ul.selection-list li:has(a:active) { + background-color: rgb(51, 51, 52) !important; + } + + ul.selection-list a:hover { + color: black; + } +} + +@media (min-width: 768px) { + ul.selection-list { + width: 80% !important; + } +} diff --git a/src/room.js b/src/room.js index 9e29f64..e3a9d22 100644 --- a/src/room.js +++ b/src/room.js @@ -148,29 +148,27 @@ export class SpatialRoom extends EventTarget { } drawPlayButton() { - self = this + let self = this - // Draw play button - self.svg.selectAll("text.button").data([0]).enter().append("text") - .text("Click to Play") - .attr("fill", "lightgrey") - .attr("class", "button") - .attr("text-anchor", "middle") - .attr("x", self.scaleX(self.data.dimensions.width/2)) - .attr("y", self.scaleY(self.data.dimensions.depth/2)) - .attr("width", self.scaleX(self.data.dimensions.width)) - .attr("height", self.scaleY(self.data.dimensions.depth)) - .on("click", function(ev) { - console.log("play clicked") + if (self.playButton) { + return + } - self.enableAudio() + self.playButton = document.createElement("button") + self.playButton.textContent = self.el.dataset.playLabel || "Tap to Play" + self.playButton.className = "button" - // Draw the sound field - _.bind(self.redraw, self)() + self.playButton.addEventListener("click", function() { + console.log("play clicked") - // remove play button - this.remove() - }) + self.playButton.remove() + self.enableAudio() + + // Draw the sound field + self.redraw() + }) + + self.el.appendChild(self.playButton) } redraw() { @@ -211,7 +209,7 @@ export class SpatialRoom extends EventTarget { .attr("text-anchor", "middle") .attr("class", "poi") .text(function(d) { - return d.name + return d.label }) .merge(pois) .attr("x", function(d) { @@ -247,7 +245,7 @@ export class SpatialRoom extends EventTarget { .attr("r", 10) .attr("class", "source") .attr("fill", function(d, i) { return d3.schemeCategory10[i] }) - .text(function(d) { return d.name }) + .text(function(d) { return d.label }) .merge(sources) .attr("cx", function(d) { return self.scaleX(d.location.x + self.data.dimensions.width/2) }) .attr("cy", function(d) { return self.scaleY(self.data.dimensions.depth/2-d.location.z) }) @@ -262,7 +260,7 @@ export class SpatialRoom extends EventTarget { .attr("class", "sourceText") .attr("fill", "grey") .text(function(d) { - return d.name + return d.label }) .merge(labels) .attr("x", function(d) { diff --git a/templates.go b/templates.go new file mode 100644 index 0000000..4f70157 --- /dev/null +++ b/templates.go @@ -0,0 +1,40 @@ +package main + +import ( + "html/template" + "io/fs" + "path" +) + +// loadTemplates returns views for each language. Default views are keyed by "". +func loadTemplates(views fs.FS, languages []string) (map[string]*template.Template, error) { + base, err := template.ParseFS(views, "*.html") + if err != nil { + return nil, err + } + + sets := map[string]*template.Template{"": base} + + for _, lang := range languages { + files, err := fs.Glob(views, path.Join(lang, "*.html")) + if err != nil { + return nil, err + } + + if len(files) == 0 { + sets[lang] = base + continue + } + + set, err := base.Clone() + if err != nil { + return nil, err + } + + if sets[lang], err = set.ParseFS(views, files...); err != nil { + return nil, err + } + } + + return sets, nil +} diff --git a/templates_test.go b/templates_test.go new file mode 100644 index 0000000..df1020e --- /dev/null +++ b/templates_test.go @@ -0,0 +1,28 @@ +package main + +import ( + "bytes" + "os" + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestLoadTemplates(t *testing.T) { + sets, err := loadTemplates(os.DirFS("testdata/views"), []string{"en", "zh-TW"}) + require.NoError(t, err) + + for _, c := range []struct{ lang, name, want string }{ + {"", "index.html", "index: Program"}, + {"en", "index.html", "index: Program"}, + {"zh-TW", "index.html", "索引:節目單"}, + // Views that haven't been localized to the language fall back to the default. + {"zh-TW", "live.html", "live"}, + } { + var buf bytes.Buffer + require.NoError(t, sets[c.lang].ExecuteTemplate(&buf, c.name, nil), "%q %s", c.lang, c.name) + assert.Equal(t, c.want, strings.TrimSpace(buf.String()), "%q %s", c.lang, c.name) + } +} diff --git a/testdata/views/index.html b/testdata/views/index.html new file mode 100644 index 0000000..d1aec75 --- /dev/null +++ b/testdata/views/index.html @@ -0,0 +1,2 @@ +{{define "title"}}Program{{end}} +index: {{template "title"}} diff --git a/testdata/views/live.html b/testdata/views/live.html new file mode 100644 index 0000000..e23fe64 --- /dev/null +++ b/testdata/views/live.html @@ -0,0 +1 @@ +live diff --git a/testdata/views/zh-TW/index.html b/testdata/views/zh-TW/index.html new file mode 100644 index 0000000..6335cd8 --- /dev/null +++ b/testdata/views/zh-TW/index.html @@ -0,0 +1,2 @@ +{{define "title"}}節目單{{end}} +索引:{{template "title"}}