library
Prebuilt pebble components: drop-in custom elements, no compiler needed
Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.
Dernier runAucun
0Étoiles
0Forks
2Issues
| 1 | /* Sequence: the tree of <pebble-sequence>, a vertical flow of step cards on |
| 2 | a connector line, a "+" before every step and at every run's end, and a |
| 3 | branching step's outcomes side by side when there is room, stacked when |
| 4 | there is not. |
| 5 | |
| 6 | One sheet, two uses: the element adopts it as is, and dist/sequence.css is |
| 7 | the same rules raw, for the page to <link>. So every selector starts at the |
| 8 | tag: that is its scope. The editor's controls are the page's markup; the |
| 9 | sheet lays them out one per row and gives every control and button 44px. |
| 10 | |
| 11 | State is attributes: [data-editing] and [data-readonly] on the host, |
| 12 | [data-open] on an adder whose menu shows, [data-confirming] and |
| 13 | [data-unknown] on a card, [data-step] and [data-kind] on each step's item. |
| 14 | |
| 15 | Theming: every value is a --pebble-sequence-* custom property with a |
| 16 | fallback, light and dark defaults chosen by prefers-color-scheme; page |
| 17 | tokens (--accent) inherit in. */ |
| 18 | |
| 19 | pebble-sequence { |
| 20 | --_ink: var(--pebble-sequence-ink, #1a1a1a); |
| 21 | --_muted: var(--pebble-sequence-muted, #5c5f66); |
| 22 | --_surface: var(--pebble-sequence-surface, #ffffff); |
| 23 | --_border: var(--pebble-sequence-border, #d0d0d0); |
| 24 | --_line: var(--pebble-sequence-line, #c3c7cc); |
| 25 | --_accent: var(--pebble-sequence-accent, var(--accent, #1971c2)); |
| 26 | --_danger: var(--pebble-sequence-danger, #c92a2a); |
| 27 | --_radius: var(--pebble-sequence-radius, 0.5rem); |
| 28 | --_size: var(--pebble-sequence-size, 44px); |
| 29 | --_gap: var(--pebble-sequence-gap, 0.75rem); |
| 30 | |
| 31 | display: block; |
| 32 | color: var(--_ink); |
| 33 | container-type: inline-size; |
| 34 | } |
| 35 | |
| 36 | @media (prefers-color-scheme: dark) { |
| 37 | pebble-sequence { |
| 38 | --_ink: var(--pebble-sequence-ink, #f1f3f5); |
| 39 | --_muted: var(--pebble-sequence-muted, #adb5bd); |
| 40 | --_surface: var(--pebble-sequence-surface, #1f1f1f); |
| 41 | --_border: var(--pebble-sequence-border, #495057); |
| 42 | --_line: var(--pebble-sequence-line, #5c636a); |
| 43 | --_danger: var(--pebble-sequence-danger, #ff8787); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | pebble-sequence button, |
| 48 | pebble-sequence .fields :is(input, select, textarea) { |
| 49 | min-height: var(--_size); |
| 50 | box-sizing: border-box; |
| 51 | font: inherit; |
| 52 | } |
| 53 | |
| 54 | pebble-sequence .run { |
| 55 | list-style: none; |
| 56 | margin: 0; |
| 57 | padding: 0; |
| 58 | } |
| 59 | |
| 60 | pebble-sequence .item { |
| 61 | display: flex; |
| 62 | flex-direction: column; |
| 63 | align-items: flex-start; |
| 64 | } |
| 65 | |
| 66 | /* the connector: every adder draws the line from the card above */ |
| 67 | pebble-sequence .adder { |
| 68 | display: flex; |
| 69 | flex-wrap: wrap; |
| 70 | align-items: center; |
| 71 | gap: 0.5rem; |
| 72 | margin-inline-start: 1.25rem; |
| 73 | padding-block: 0.25rem; |
| 74 | border-inline-start: 2px solid var(--_line); |
| 75 | } |
| 76 | |
| 77 | pebble-sequence .add { |
| 78 | inline-size: var(--_size); |
| 79 | margin-inline-start: calc(var(--_size) / -2 - 1px); |
| 80 | border: none; |
| 81 | background: none; |
| 82 | padding: 0; |
| 83 | cursor: pointer; |
| 84 | display: grid; |
| 85 | place-items: center; |
| 86 | color: var(--_muted); |
| 87 | } |
| 88 | |
| 89 | pebble-sequence .add > span { |
| 90 | display: grid; |
| 91 | place-items: center; |
| 92 | inline-size: 1.75rem; |
| 93 | block-size: 1.75rem; |
| 94 | border-radius: 50%; |
| 95 | border: 1px solid var(--_border); |
| 96 | background: var(--_surface); |
| 97 | font-size: 1.125rem; |
| 98 | line-height: 1; |
| 99 | } |
| 100 | |
| 101 | pebble-sequence .add:hover > span, |
| 102 | pebble-sequence .adder[data-open] .add > span { |
| 103 | border-color: var(--_accent); |
| 104 | color: var(--_accent); |
| 105 | } |
| 106 | |
| 107 | pebble-sequence .menu { |
| 108 | display: flex; |
| 109 | flex-wrap: wrap; |
| 110 | gap: 0.5rem; |
| 111 | } |
| 112 | |
| 113 | pebble-sequence .kind, |
| 114 | pebble-sequence .actions button, |
| 115 | pebble-sequence .editor-actions button { |
| 116 | padding-inline: 0.875rem; |
| 117 | border: 1px solid var(--_border); |
| 118 | border-radius: var(--_radius); |
| 119 | background: var(--_surface); |
| 120 | color: inherit; |
| 121 | cursor: pointer; |
| 122 | } |
| 123 | |
| 124 | pebble-sequence .kind:hover, |
| 125 | pebble-sequence .actions button:hover:not(:disabled), |
| 126 | pebble-sequence .editor-actions button:hover { |
| 127 | border-color: var(--_accent); |
| 128 | } |
| 129 | |
| 130 | pebble-sequence button:disabled { |
| 131 | cursor: default; |
| 132 | opacity: 0.5; |
| 133 | } |
| 134 | |
| 135 | pebble-sequence button:focus-visible { |
| 136 | outline: 2px solid var(--_accent); |
| 137 | outline-offset: 2px; |
| 138 | } |
| 139 | |
| 140 | pebble-sequence .mark { |
| 141 | display: inline-block; |
| 142 | padding: 0.125rem 0.625rem; |
| 143 | border-radius: 999px; |
| 144 | border: 1px solid var(--_border); |
| 145 | color: var(--_muted); |
| 146 | font-size: 0.875em; |
| 147 | } |
| 148 | |
| 149 | pebble-sequence .card, |
| 150 | pebble-sequence .editor { |
| 151 | box-sizing: border-box; |
| 152 | inline-size: min(100%, var(--pebble-sequence-card-width, 32rem)); |
| 153 | border: 1px solid var(--_border); |
| 154 | border-radius: var(--_radius); |
| 155 | background: var(--_surface); |
| 156 | padding: 0.5rem 0.75rem; |
| 157 | } |
| 158 | |
| 159 | pebble-sequence .card { |
| 160 | display: flex; |
| 161 | align-items: center; |
| 162 | gap: var(--_gap); |
| 163 | } |
| 164 | |
| 165 | pebble-sequence .text { |
| 166 | flex: 1; |
| 167 | min-inline-size: 0; |
| 168 | display: flex; |
| 169 | flex-direction: column; |
| 170 | } |
| 171 | |
| 172 | pebble-sequence .label { |
| 173 | font-weight: 600; |
| 174 | } |
| 175 | |
| 176 | pebble-sequence .summary { |
| 177 | color: var(--_muted); |
| 178 | overflow: hidden; |
| 179 | text-overflow: ellipsis; |
| 180 | white-space: nowrap; |
| 181 | } |
| 182 | |
| 183 | pebble-sequence .summary:empty { |
| 184 | display: none; |
| 185 | } |
| 186 | |
| 187 | pebble-sequence .actions { |
| 188 | flex: none; |
| 189 | display: flex; |
| 190 | gap: 0.5rem; |
| 191 | } |
| 192 | |
| 193 | pebble-sequence .card[data-confirming] .remove { |
| 194 | border-color: var(--_danger); |
| 195 | color: var(--_danger); |
| 196 | } |
| 197 | |
| 198 | pebble-sequence .card[data-unknown] { |
| 199 | border-style: dashed; |
| 200 | } |
| 201 | |
| 202 | pebble-sequence .editor { |
| 203 | border-color: var(--_accent); |
| 204 | display: grid; |
| 205 | gap: var(--_gap); |
| 206 | } |
| 207 | |
| 208 | pebble-sequence .fields { |
| 209 | display: grid; |
| 210 | gap: var(--_gap); |
| 211 | } |
| 212 | |
| 213 | pebble-sequence .fields label { |
| 214 | display: grid; |
| 215 | gap: 0.25rem; |
| 216 | } |
| 217 | |
| 218 | pebble-sequence .fields :is(input:not([type="checkbox"], [type="radio"]), select, textarea) { |
| 219 | inline-size: 100%; |
| 220 | } |
| 221 | |
| 222 | pebble-sequence .editor-actions { |
| 223 | display: flex; |
| 224 | gap: 0.5rem; |
| 225 | } |
| 226 | |
| 227 | pebble-sequence .done { |
| 228 | border-color: var(--_accent); |
| 229 | } |
| 230 | |
| 231 | /* outcomes: stacked under the card, side by side once each can have 16rem */ |
| 232 | pebble-sequence .branches { |
| 233 | display: grid; |
| 234 | gap: var(--_gap); |
| 235 | inline-size: 100%; |
| 236 | box-sizing: border-box; |
| 237 | margin-block-start: 0.25rem; |
| 238 | padding-inline-start: 1.25rem; |
| 239 | } |
| 240 | |
| 241 | @container (min-width: 36rem) { |
| 242 | pebble-sequence .branches { |
| 243 | grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | pebble-sequence .branch { |
| 248 | min-inline-size: 0; |
| 249 | padding-inline-start: var(--_gap); |
| 250 | border-inline-start: 2px solid var(--_line); |
| 251 | } |
| 252 | |
| 253 | pebble-sequence .outcome { |
| 254 | display: inline-block; |
| 255 | margin-block-end: 0.25rem; |
| 256 | font-weight: 600; |
| 257 | color: var(--_accent); |
| 258 | font-size: 0.875em; |
| 259 | } |
| 260 | |
| 261 | pebble-sequence[data-readonly] .adder { |
| 262 | min-block-size: var(--_gap); |
| 263 | } |