(includeResumeData?: boolean)
| 127 | * @returns |
| 128 | */ |
| 129 | export function virtual(includeResumeData?: boolean): Sheet<string[]> { |
| 130 | const target: string[] = [] |
| 131 | |
| 132 | return { |
| 133 | target, |
| 134 | |
| 135 | snapshot() { |
| 136 | // collect current rules |
| 137 | const rules = [...target] |
| 138 | |
| 139 | return () => { |
| 140 | // remove all existing rules and add all snapshot rules back |
| 141 | target.splice(0, target.length, ...rules) |
| 142 | } |
| 143 | }, |
| 144 | |
| 145 | clear() { |
| 146 | target.length = 0 |
| 147 | }, |
| 148 | |
| 149 | destroy() { |
| 150 | this.clear() |
| 151 | }, |
| 152 | |
| 153 | insert(css, index, rule) { |
| 154 | target.splice( |
| 155 | index, |
| 156 | 0, |
| 157 | includeResumeData |
| 158 | ? `/*!${rule.p.toString(36)},${(rule.o * 2).toString(36)}${ |
| 159 | rule.n ? ',' + rule.n : '' |
| 160 | }*/${css}` |
| 161 | : css, |
| 162 | ) |
| 163 | }, |
| 164 | |
| 165 | resume: noop, |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | /** |
| 170 | * Returns a sheet useable in the current environment. |
no outgoing calls
no test coverage detected