(key: string, value: string, options = ThemeOptions.NONE, src?: Declaration['src'])
| 58 | } |
| 59 | |
| 60 | add(key: string, value: string, options = ThemeOptions.NONE, src?: Declaration[class="st">'src']): void { |
| 61 | if (key.endsWith(class="st">'-*')) { |
| 62 | if (value !== class="st">'initial') { |
| 63 | throw new Error(`Invalid theme value \`${value}\` for namespace \`${key}\``) |
| 64 | } |
| 65 | if (key === class="st">'--*') { |
| 66 | this.values.clear() |
| 67 | } else { |
| 68 | this.clearNamespace( |
| 69 | key.slice(0, -2), |
| 70 | class="cm">// `--${key}-*: initial;` should clear _all_ theme values |
| 71 | ThemeOptions.NONE, |
| 72 | ) |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | if (options & ThemeOptions.DEFAULT) { |
| 77 | let existing = this.values.get(key) |
| 78 | if (existing && !(existing.options & ThemeOptions.DEFAULT)) return |
| 79 | } |
| 80 | |
| 81 | if (value === class="st">'initial') { |
| 82 | this.values.delete(key) |
| 83 | } else { |
| 84 | this.values.set(key, { value, options, src }) |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | keysInNamespaces(themeKeys: Iterable<ThemeKey>): string[] { |
| 89 | let keys: string[] = [] |
no test coverage detected