Skip to content

Commit 2f24b66

Browse files
committed
notes
1 parent 5c3c641 commit 2f24b66

File tree

1 file changed

+102
-4
lines changed

1 file changed

+102
-4
lines changed

packages/demo/src/content/docs/index.md

+102-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Diagram All The Things
44

55
## Strategies
66

7-
### inline svg
7+
### inline
88

99
- **pros**
1010
- interactivity
@@ -15,7 +15,7 @@ title: Diagram All The Things
1515
- dark theme
1616
- class based
1717
- `prefers-color-scheme`
18-
- allows to add dark theme to tools that don't support it out of box (`graphviz`, `vizdom`, `gnuplot`)
18+
- allows to add dark theme to tools that don't support it out of the box (`graphviz`, `vizdom`, `gnuplot`)
1919
- **cons**
2020
- CSS conflicts
2121
- CSS from website can affect diagram
@@ -27,7 +27,7 @@ title: Diagram All The Things
2727
- DOM footprint
2828
- easy to integrate, especially if there is no inline CSS in SVG
2929

30-
### img with data-uri
30+
### data-url
3131

3232
- **pros**
3333
- no CSS conflicts
@@ -40,7 +40,7 @@ title: Diagram All The Things
4040
- no DOM footprint, but overall weight of HTML is high as in previous strategy
4141
- easy to integrate - only need to add a bit of CSS to support dark theme
4242

43-
### img external
43+
### file
4444

4545
- **pros**
4646
- no CSS conflicts
@@ -53,3 +53,101 @@ title: Diagram All The Things
5353
- no interactivity
5454
- some tools don't support dark theme out of the box (`graphviz`, `vizdom`, `gnuplot`)
5555
- harder to integrate - need to resolve where to write file, how to do cache busting...
56+
57+
---
58+
59+
# TODO
60+
61+
## Strategy
62+
63+
### `inline`
64+
65+
**Default strategy**.
66+
67+
```html
68+
<figure class="beoe"><svg>...</svg></figure>
69+
```
70+
71+
### `data-url`
72+
73+
```html
74+
<figure class="beoe">
75+
<img src="data:image/svg+xml,..." width="..." height="..." alt="..." />
76+
</figure>
77+
```
78+
79+
### `file`
80+
81+
```html
82+
<figure class="beoe">
83+
<img src="/path/to.svg" width="..." height="..." alt="..." />
84+
</figure>
85+
```
86+
87+
## Dark scheme
88+
89+
### none
90+
91+
**Default**.
92+
93+
```html
94+
<figure class="beoe">only one image</figure>
95+
```
96+
97+
### `class`
98+
99+
```html
100+
<figure class="beoe">
101+
<div>
102+
<img class="beoe-light" src="..." />
103+
<img class="beoe-dark" src="..." />
104+
</div>
105+
</figure>
106+
```
107+
108+
You would need to add CSS, something like this
109+
110+
```CSS
111+
html[data-theme="light"] .beoe-dark {
112+
display: none;
113+
}
114+
115+
html[data-theme="dark"] .beoe-light {
116+
display: none;
117+
}
118+
```
119+
120+
### `media`
121+
122+
```html
123+
<figure class="beoe">
124+
<picture>
125+
<img src="..." />
126+
<source media="(prefers-color-scheme: dark)" src="..." />
127+
</picture>
128+
</figure>
129+
```
130+
131+
## Strategy vs dark scheme
132+
133+
| | `class` | `media` |
134+
| ---------- | ------- | ------- |
135+
| `inline` | maybe | no |
136+
| `data-url` | yes | yes |
137+
| `file` | yes | yes |
138+
139+
## Strategy pros and cons
140+
141+
| | `inline` | `data-url` | `file` |
142+
| ---------------------- | ------------ | ---------- | ------ |
143+
| Interactivity | possible | no | no |
144+
| CSS conflicts | probably yes | no | no |
145+
| Can be styled with CSS | yes | no | no |
146+
| DOM footprint | high | low | low |
147+
| HTML footprint | high | high | low |
148+
149+
## Interactivity
150+
151+
- Links (`<a href="...">`)
152+
- Search text in the diagram (<Kbd>Cmd</kbd> + <Kbd>F</kbd>)
153+
- With JS, for example, if we inline JSON data

0 commit comments

Comments
 (0)