This commit is contained in:
Alexander Wang 2024-06-05 11:14:52 -06:00
parent e25954abff
commit abe9230bce
No known key found for this signature in database
GPG key ID: BE3937D0D52D8927
7 changed files with 32238 additions and 3 deletions

View file

@ -11,3 +11,4 @@
- Custom label positions weren't being read when the width was smaller than the label [#1928](https://github.com/terrastruct/d2/pull/1928)
- Using `shape: circle` for arrowheads no longer removes all arrowheads along path in sketch mode [#1942](https://github.com/terrastruct/d2/pull/1942)
- Globs to null connections work [#1965](https://github.com/terrastruct/d2/pull/1965)
- Edge globs setting styles inherit correctly in child boards [#1967](https://github.com/terrastruct/d2/pull/1967)

View file

@ -862,9 +862,6 @@ func (mk *Key) HasTripleGlob() bool {
return true
}
}
if mk.EdgeIndex != nil && mk.EdgeIndex.Glob {
return true
}
if mk.EdgeKey.HasTripleGlob() {
return true
}

View file

@ -392,6 +392,9 @@ func (g *globContext) prefixed(dst *Map) *globContext {
if len(prefix.Path) > 0 {
g2.refctx.Key.Key = prefix
}
if !g2.refctx.Key.HasTripleGlob() && g2.refctx.Key.EdgeKey != nil {
prefix.Path = append(prefix.Path, g2.refctx.Key.EdgeKey.Path...)
}
return g2
}

View file

@ -322,6 +322,67 @@ x -> y
assertQuery(t, m, 4, 0, nil, "")
},
},
{
name: "field-glob-style-inherit",
run: func(t testing.TB) {
m, err := compile(t, `*.style.opacity: 0
x: {
style.opacity: 1
}
scenarios: {
1: {
x
}
}
`)
assert.Success(t, err)
assertQuery(t, m, 0, 0, 1, "x.style.opacity")
assertQuery(t, m, 0, 0, 1, "scenarios.1.x.style.opacity")
},
},
{
name: "edge-glob-style-inherit/1",
run: func(t testing.TB) {
m, err := compile(t, `(* -> *)[*].style.opacity: 0
x -> y: {
style.opacity: 1
}
scenarios: {
1: {
x
}
}
`)
assert.Success(t, err)
assertQuery(t, m, 0, 0, 1, "(x -> y)[0].style.opacity")
assertQuery(t, m, 0, 0, 1, "scenarios.1.(x -> y)[0].style.opacity")
},
},
{
name: "edge-glob-style-inherit/2",
run: func(t testing.TB) {
m, err := compile(t, `*.style.opacity: 0
(* -> *)[*].style.opacity: 0
x -> y
steps: {
1: {
x.style.opacity: 1
}
2: {
(x -> y)[0].style.opacity: 1
}
3: {
y.style.opacity: 1
}
}
`)
assert.Success(t, err)
assertQuery(t, m, 0, 0, 1, "steps.3.(x -> y)[0].style.opacity")
},
},
{
name: "double-glob/edge/1",
run: func(t testing.TB) {

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff