@xylabs/forget 2.9.2 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/docs.json DELETED
@@ -1,500 +0,0 @@
1
- {
2
- "id": 0,
3
- "name": "@xylabs/forget",
4
- "variant": "project",
5
- "kind": 1,
6
- "flags": {},
7
- "children": [
8
- {
9
- "id": 19,
10
- "name": "default",
11
- "variant": "reference",
12
- "kind": 8388608,
13
- "flags": {},
14
- "sources": [
15
- {
16
- "fileName": "index.ts",
17
- "line": 6,
18
- "character": 0,
19
- "url": "https://github.com/xylabs/sdk-js/blob/88ada5a/packages/forget/src/index.ts#L6"
20
- }
21
- ],
22
- "target": 1
23
- },
24
- {
25
- "id": 5,
26
- "name": "ForgetPromise",
27
- "variant": "declaration",
28
- "kind": 128,
29
- "flags": {},
30
- "children": [
31
- {
32
- "id": 17,
33
- "name": "constructor",
34
- "variant": "declaration",
35
- "kind": 512,
36
- "flags": {},
37
- "signatures": [
38
- {
39
- "id": 18,
40
- "name": "new ForgetPromise",
41
- "variant": "signature",
42
- "kind": 16384,
43
- "flags": {},
44
- "type": {
45
- "type": "reference",
46
- "target": 5,
47
- "name": "ForgetPromise",
48
- "package": "@xylabs/forget"
49
- }
50
- }
51
- ]
52
- },
53
- {
54
- "id": 6,
55
- "name": "activeForgets",
56
- "variant": "declaration",
57
- "kind": 1024,
58
- "flags": {
59
- "isStatic": true
60
- },
61
- "sources": [
62
- {
63
- "fileName": "forget.ts",
64
- "line": 9,
65
- "character": 9,
66
- "url": "https://github.com/xylabs/sdk-js/blob/88ada5a/packages/forget/src/forget.ts#L9"
67
- }
68
- ],
69
- "type": {
70
- "type": "intrinsic",
71
- "name": "number"
72
- },
73
- "defaultValue": "0"
74
- },
75
- {
76
- "id": 7,
77
- "name": "active",
78
- "variant": "declaration",
79
- "kind": 262144,
80
- "flags": {
81
- "isStatic": true
82
- },
83
- "sources": [
84
- {
85
- "fileName": "forget.ts",
86
- "line": 11,
87
- "character": 13,
88
- "url": "https://github.com/xylabs/sdk-js/blob/88ada5a/packages/forget/src/forget.ts#L11"
89
- }
90
- ],
91
- "getSignature": {
92
- "id": 8,
93
- "name": "active",
94
- "variant": "signature",
95
- "kind": 524288,
96
- "flags": {},
97
- "sources": [
98
- {
99
- "fileName": "forget.ts",
100
- "line": 11,
101
- "character": 2,
102
- "url": "https://github.com/xylabs/sdk-js/blob/88ada5a/packages/forget/src/forget.ts#L11"
103
- }
104
- ],
105
- "type": {
106
- "type": "intrinsic",
107
- "name": "boolean"
108
- }
109
- }
110
- },
111
- {
112
- "id": 9,
113
- "name": "awaitInactive",
114
- "variant": "declaration",
115
- "kind": 2048,
116
- "flags": {
117
- "isStatic": true
118
- },
119
- "sources": [
120
- {
121
- "fileName": "forget.ts",
122
- "line": 15,
123
- "character": 15,
124
- "url": "https://github.com/xylabs/sdk-js/blob/88ada5a/packages/forget/src/forget.ts#L15"
125
- }
126
- ],
127
- "signatures": [
128
- {
129
- "id": 10,
130
- "name": "awaitInactive",
131
- "variant": "signature",
132
- "kind": 4096,
133
- "flags": {},
134
- "sources": [
135
- {
136
- "fileName": "forget.ts",
137
- "line": 15,
138
- "character": 2,
139
- "url": "https://github.com/xylabs/sdk-js/blob/88ada5a/packages/forget/src/forget.ts#L15"
140
- }
141
- ],
142
- "parameters": [
143
- {
144
- "id": 11,
145
- "name": "interval",
146
- "variant": "param",
147
- "kind": 32768,
148
- "flags": {},
149
- "type": {
150
- "type": "intrinsic",
151
- "name": "number"
152
- },
153
- "defaultValue": "100"
154
- },
155
- {
156
- "id": 12,
157
- "name": "timeout",
158
- "variant": "param",
159
- "kind": 32768,
160
- "flags": {
161
- "isOptional": true
162
- },
163
- "type": {
164
- "type": "intrinsic",
165
- "name": "number"
166
- }
167
- }
168
- ],
169
- "type": {
170
- "type": "reference",
171
- "target": {
172
- "sourceFileName": "../../node_modules/typescript/lib/lib.es5.d.ts",
173
- "qualifiedName": "Promise"
174
- },
175
- "typeArguments": [
176
- {
177
- "type": "intrinsic",
178
- "name": "number"
179
- }
180
- ],
181
- "name": "Promise",
182
- "package": "typescript"
183
- }
184
- }
185
- ]
186
- },
187
- {
188
- "id": 13,
189
- "name": "forget",
190
- "variant": "declaration",
191
- "kind": 2048,
192
- "flags": {
193
- "isStatic": true
194
- },
195
- "sources": [
196
- {
197
- "fileName": "forget.ts",
198
- "line": 30,
199
- "character": 9,
200
- "url": "https://github.com/xylabs/sdk-js/blob/88ada5a/packages/forget/src/forget.ts#L30"
201
- }
202
- ],
203
- "signatures": [
204
- {
205
- "id": 14,
206
- "name": "forget",
207
- "variant": "signature",
208
- "kind": 4096,
209
- "flags": {},
210
- "sources": [
211
- {
212
- "fileName": "forget.ts",
213
- "line": 30,
214
- "character": 2,
215
- "url": "https://github.com/xylabs/sdk-js/blob/88ada5a/packages/forget/src/forget.ts#L30"
216
- }
217
- ],
218
- "parameters": [
219
- {
220
- "id": 15,
221
- "name": "promise",
222
- "variant": "param",
223
- "kind": 32768,
224
- "flags": {},
225
- "type": {
226
- "type": "reference",
227
- "target": {
228
- "sourceFileName": "../../node_modules/typescript/lib/lib.es5.d.ts",
229
- "qualifiedName": "Promise"
230
- },
231
- "typeArguments": [
232
- {
233
- "type": "intrinsic",
234
- "name": "unknown"
235
- }
236
- ],
237
- "name": "Promise",
238
- "package": "typescript"
239
- }
240
- },
241
- {
242
- "id": 16,
243
- "name": "timeout",
244
- "variant": "param",
245
- "kind": 32768,
246
- "flags": {
247
- "isOptional": true
248
- },
249
- "type": {
250
- "type": "reference",
251
- "target": {
252
- "sourceFileName": "src/forget.ts",
253
- "qualifiedName": "ForgetTimeoutConfig"
254
- },
255
- "name": "ForgetTimeoutConfig",
256
- "package": "@xylabs/forget"
257
- }
258
- }
259
- ],
260
- "type": {
261
- "type": "intrinsic",
262
- "name": "void"
263
- }
264
- }
265
- ]
266
- }
267
- ],
268
- "groups": [
269
- {
270
- "title": "Constructors",
271
- "children": [
272
- 17
273
- ]
274
- },
275
- {
276
- "title": "Properties",
277
- "children": [
278
- 6
279
- ]
280
- },
281
- {
282
- "title": "Accessors",
283
- "children": [
284
- 7
285
- ]
286
- },
287
- {
288
- "title": "Methods",
289
- "children": [
290
- 9,
291
- 13
292
- ]
293
- }
294
- ],
295
- "sources": [
296
- {
297
- "fileName": "forget.ts",
298
- "line": 8,
299
- "character": 13,
300
- "url": "https://github.com/xylabs/sdk-js/blob/88ada5a/packages/forget/src/forget.ts#L8"
301
- }
302
- ]
303
- },
304
- {
305
- "id": 1,
306
- "name": "forget",
307
- "variant": "declaration",
308
- "kind": 64,
309
- "flags": {},
310
- "sources": [
311
- {
312
- "fileName": "forget.ts",
313
- "line": 73,
314
- "character": 13,
315
- "url": "https://github.com/xylabs/sdk-js/blob/88ada5a/packages/forget/src/forget.ts#L73"
316
- }
317
- ],
318
- "signatures": [
319
- {
320
- "id": 2,
321
- "name": "forget",
322
- "variant": "signature",
323
- "kind": 4096,
324
- "flags": {},
325
- "sources": [
326
- {
327
- "fileName": "forget.ts",
328
- "line": 73,
329
- "character": 22,
330
- "url": "https://github.com/xylabs/sdk-js/blob/88ada5a/packages/forget/src/forget.ts#L73"
331
- }
332
- ],
333
- "parameters": [
334
- {
335
- "id": 3,
336
- "name": "promise",
337
- "variant": "param",
338
- "kind": 32768,
339
- "flags": {},
340
- "type": {
341
- "type": "reference",
342
- "target": {
343
- "sourceFileName": "../../node_modules/typescript/lib/lib.es5.d.ts",
344
- "qualifiedName": "Promise"
345
- },
346
- "typeArguments": [
347
- {
348
- "type": "intrinsic",
349
- "name": "unknown"
350
- }
351
- ],
352
- "name": "Promise",
353
- "package": "typescript"
354
- }
355
- },
356
- {
357
- "id": 4,
358
- "name": "timeout",
359
- "variant": "param",
360
- "kind": 32768,
361
- "flags": {
362
- "isOptional": true
363
- },
364
- "type": {
365
- "type": "reference",
366
- "target": {
367
- "sourceFileName": "src/forget.ts",
368
- "qualifiedName": "ForgetTimeoutConfig"
369
- },
370
- "name": "ForgetTimeoutConfig",
371
- "package": "@xylabs/forget"
372
- }
373
- }
374
- ],
375
- "type": {
376
- "type": "intrinsic",
377
- "name": "void"
378
- }
379
- }
380
- ]
381
- }
382
- ],
383
- "groups": [
384
- {
385
- "title": "References",
386
- "children": [
387
- 19
388
- ]
389
- },
390
- {
391
- "title": "Classes",
392
- "children": [
393
- 5
394
- ]
395
- },
396
- {
397
- "title": "Functions",
398
- "children": [
399
- 1
400
- ]
401
- }
402
- ],
403
- "packageName": "@xylabs/forget",
404
- "readme": [
405
- {
406
- "kind": "text",
407
- "text": "[![logo][]](https://xylabs.com)\n\n# @xylabs/sdk-js\n\n[![main-build][]][main-build-link]\n[![beta-build][]][beta-build-link]\n[![npm-badge][]][npm-link]\n[![bch-badge][]][bch-link]\n[![codacy-badge][]][codacy-link]\n[![codeclimate-badge][]][codeclimate-link]\n[![snyk-badge][]][snyk-link]\n\n## Table of Contents\n\n- [Description](#description)\n- [Install](#install)\n- [Scripts](#scripts)\n- [Maintainers](#maintainers)\n- [License](#license)\n- [Credits](#credits)\n\n## Description\n\nSDK for base code for Typescript and Javascript Libraries.\n\n## Install\n\nUsing npm:\n\n"
408
- },
409
- {
410
- "kind": "code",
411
- "text": "```sh\nnpm i --save @xylabs/sdk-js\n```"
412
- },
413
- {
414
- "kind": "text",
415
- "text": "\n\nUsing yarn:\n\n"
416
- },
417
- {
418
- "kind": "code",
419
- "text": "```sh\nyarn add @xylabs/sdk-js\n```"
420
- },
421
- {
422
- "kind": "text",
423
- "text": "\n\n## Scripts\n\nSee [ts-scripts](https://github.com/xylabs/ts-scripts/blob/main/README.md)\nfor list of shared scripts.\n\n## Maintainers\n\n- [Arie Trouw](https://github.com/arietrouw) (<https://arietrouw.com>)\n\n## License\n\nSee the [LICENSE](LICENSE) file for license details\n\n## Credits\n\n[Made with 🔥 and ❄️ by XY Labs](https://xylabs.com)\n\n[logo]: https://cdn.xy.company/img/brand/XYPersistentCompany_Logo_Icon_Colored.svg\n[main-build]: https://github.com/xylabs/sdk-js/actions/workflows/build-main.yml/badge.svg\n[main-build-link]: https://github.com/xylabs/sdk-js/actions/workflows/build-main.yml\n[beta-build]: https://github.com/xylabs/sdk-js/actions/workflows/build-beta.yml/badge.svg\n[beta-build-link]: https://github.com/xylabs/sdk-js/actions/workflows/build-beta.yml\n[npm-badge]: https://img.shields.io/npm/v/@xylabs/sdk-js.svg\n[npm-link]: https://www.npmjs.com/package/@xylabs/sdk-js\n[bch-badge]: https://bettercodehub.com/edge/badge/xylabs/sdk-js?branch=main\n[bch-link]: https://bettercodehub.com/results/xylabs/sdk-js\n[codacy-badge]: https://app.codacy.com/project/badge/Grade/c8e15e14f37741c18cfb47ac7245c698\n[codacy-link]: https://www.codacy.com/gh/xylabs/sdk-js/dashboard?utm_source=github.com&utm_medium=referral&utm_content=xylabs/sdk-js&utm_campaign=Badge_Grade\n[codeclimate-badge]: https://api.codeclimate.com/v1/badges/c5eb068f806f0b047ea7/maintainability\n[codeclimate-link]: https://codeclimate.com/github/xylabs/sdk-js/maintainability\n[snyk-badge]: https://snyk.io/test/github/xylabs/sdk-js/badge.svg?targetFile=package.json\n[snyk-link]: https://snyk.io/test/github/xylabs/sdk-js?targetFile=package.json"
424
- }
425
- ],
426
- "symbolIdMap": {
427
- "0": {
428
- "sourceFileName": "src/index.ts",
429
- "qualifiedName": ""
430
- },
431
- "1": {
432
- "sourceFileName": "src/forget.ts",
433
- "qualifiedName": "forget"
434
- },
435
- "2": {
436
- "sourceFileName": "src/forget.ts",
437
- "qualifiedName": "forget"
438
- },
439
- "3": {
440
- "sourceFileName": "src/forget.ts",
441
- "qualifiedName": "promise"
442
- },
443
- "4": {
444
- "sourceFileName": "src/forget.ts",
445
- "qualifiedName": "timeout"
446
- },
447
- "5": {
448
- "sourceFileName": "src/forget.ts",
449
- "qualifiedName": "ForgetPromise"
450
- },
451
- "6": {
452
- "sourceFileName": "src/forget.ts",
453
- "qualifiedName": "ForgetPromise.activeForgets"
454
- },
455
- "7": {
456
- "sourceFileName": "src/forget.ts",
457
- "qualifiedName": "ForgetPromise.active"
458
- },
459
- "8": {
460
- "sourceFileName": "src/forget.ts",
461
- "qualifiedName": "ForgetPromise.active"
462
- },
463
- "9": {
464
- "sourceFileName": "src/forget.ts",
465
- "qualifiedName": "ForgetPromise.awaitInactive"
466
- },
467
- "10": {
468
- "sourceFileName": "src/forget.ts",
469
- "qualifiedName": "ForgetPromise.awaitInactive"
470
- },
471
- "11": {
472
- "sourceFileName": "src/forget.ts",
473
- "qualifiedName": "interval"
474
- },
475
- "12": {
476
- "sourceFileName": "src/forget.ts",
477
- "qualifiedName": "timeout"
478
- },
479
- "13": {
480
- "sourceFileName": "src/forget.ts",
481
- "qualifiedName": "ForgetPromise.forget"
482
- },
483
- "14": {
484
- "sourceFileName": "src/forget.ts",
485
- "qualifiedName": "ForgetPromise.forget"
486
- },
487
- "15": {
488
- "sourceFileName": "src/forget.ts",
489
- "qualifiedName": "promise"
490
- },
491
- "16": {
492
- "sourceFileName": "src/forget.ts",
493
- "qualifiedName": "timeout"
494
- },
495
- "19": {
496
- "sourceFileName": "src/index.ts",
497
- "qualifiedName": "default"
498
- }
499
- }
500
- }
@@ -1,61 +0,0 @@
1
- import { delay } from '@xylabs/delay';
2
- export class ForgetPromise {
3
- static activeForgets = 0;
4
- static get active() {
5
- return this.activeForgets > 0;
6
- }
7
- static async awaitInactive(interval = 100, timeout) {
8
- let timeoutRemaining = timeout;
9
- while (this.active) {
10
- await delay(interval);
11
- if (timeoutRemaining !== undefined) {
12
- timeoutRemaining -= interval;
13
- if (timeoutRemaining <= 0) {
14
- return this.activeForgets;
15
- }
16
- }
17
- }
18
- return 0;
19
- }
20
- //used to explicitly launch an async function (or Promise) with awaiting it
21
- static forget(promise, timeout) {
22
- let completed = false;
23
- this.activeForgets++;
24
- const promiseWrapper = async () => {
25
- await promise
26
- .then(() => {
27
- this.activeForgets--;
28
- completed = true;
29
- })
30
- .catch(() => {
31
- this.activeForgets--;
32
- completed = true;
33
- });
34
- };
35
- const promises = [promiseWrapper()];
36
- //if there is a timeout, add it to the race
37
- if (timeout) {
38
- const timeoutFunc = async () => {
39
- await delay(timeout.delay);
40
- if (!completed) {
41
- console.log(`forget promise timeout out after ${timeout.delay}ms [Cancelling]`);
42
- timeout.cancel?.();
43
- }
44
- };
45
- promises.push(timeoutFunc());
46
- }
47
- const all = Promise.race(promises);
48
- all
49
- .then(() => {
50
- return;
51
- })
52
- .catch(() => {
53
- return;
54
- });
55
- }
56
- }
57
- //used to explicitly launch an async function (or Promise) with awaiting it
58
- export const forget = (promise, timeout) => {
59
- ForgetPromise.forget(promise, timeout);
60
- };
61
- //# sourceMappingURL=forget.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"forget.js","sourceRoot":"","sources":["../../src/forget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAOrC,MAAM,OAAO,aAAa;IACxB,MAAM,CAAC,aAAa,GAAG,CAAC,CAAA;IAExB,MAAM,KAAK,MAAM;QACf,OAAO,IAAI,CAAC,aAAa,GAAG,CAAC,CAAA;IAC/B,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,GAAG,GAAG,EAAE,OAAgB;QACzD,IAAI,gBAAgB,GAAG,OAAO,CAAA;QAC9B,OAAO,IAAI,CAAC,MAAM,EAAE;YAClB,MAAM,KAAK,CAAC,QAAQ,CAAC,CAAA;YACrB,IAAI,gBAAgB,KAAK,SAAS,EAAE;gBAClC,gBAAgB,IAAI,QAAQ,CAAA;gBAC5B,IAAI,gBAAgB,IAAI,CAAC,EAAE;oBACzB,OAAO,IAAI,CAAC,aAAa,CAAA;iBAC1B;aACF;SACF;QACD,OAAO,CAAC,CAAA;IACV,CAAC;IAED,2EAA2E;IAC3E,MAAM,CAAC,MAAM,CAAC,OAAyB,EAAE,OAA6B;QACpE,IAAI,SAAS,GAAG,KAAK,CAAA;QACrB,IAAI,CAAC,aAAa,EAAE,CAAA;QAEpB,MAAM,cAAc,GAAG,KAAK,IAAI,EAAE;YAChC,MAAM,OAAO;iBACV,IAAI,CAAC,GAAG,EAAE;gBACT,IAAI,CAAC,aAAa,EAAE,CAAA;gBACpB,SAAS,GAAG,IAAI,CAAA;YAClB,CAAC,CAAC;iBACD,KAAK,CAAC,GAAG,EAAE;gBACV,IAAI,CAAC,aAAa,EAAE,CAAA;gBACpB,SAAS,GAAG,IAAI,CAAA;YAClB,CAAC,CAAC,CAAA;QACN,CAAC,CAAA;QAED,MAAM,QAAQ,GAAG,CAAC,cAAc,EAAE,CAAC,CAAA;QAEnC,2CAA2C;QAC3C,IAAI,OAAO,EAAE;YACX,MAAM,WAAW,GAAG,KAAK,IAAI,EAAE;gBAC7B,MAAM,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;gBAC1B,IAAI,CAAC,SAAS,EAAE;oBACd,OAAO,CAAC,GAAG,CAAC,oCAAoC,OAAO,CAAC,KAAK,iBAAiB,CAAC,CAAA;oBAC/E,OAAO,CAAC,MAAM,EAAE,EAAE,CAAA;iBACnB;YACH,CAAC,CAAA;YACD,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;SAC7B;QAED,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAElC,GAAG;aACA,IAAI,CAAC,GAAG,EAAE;YACT,OAAM;QACR,CAAC,CAAC;aACD,KAAK,CAAC,GAAG,EAAE;YACV,OAAM;QACR,CAAC,CAAC,CAAA;IACN,CAAC;;AAGH,2EAA2E;AAC3E,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAyB,EAAE,OAA6B,EAAE,EAAE;IACjF,aAAa,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AACxC,CAAC,CAAA"}
package/dist/esm/index.js DELETED
@@ -1,5 +0,0 @@
1
- import { forget, ForgetPromise } from './forget';
2
- export { forget, ForgetPromise };
3
- // eslint-disable-next-line import/no-default-export
4
- export default forget;
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAEhD,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,CAAA;AAEhC,oDAAoD;AACpD,eAAe,MAAM,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"forget.d.ts","sourceRoot":"","sources":["../../src/forget.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,qBAAa,aAAa;IACxB,MAAM,CAAC,aAAa,SAAI;IAExB,MAAM,KAAK,MAAM,YAEhB;WAEY,aAAa,CAAC,QAAQ,SAAM,EAAE,OAAO,CAAC,EAAE,MAAM;IAe3D,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,mBAAmB;CAwCvE;AAGD,eAAO,MAAM,MAAM,YAAa,QAAQ,OAAO,CAAC,YAAY,mBAAmB,SAE9E,CAAA"}
@@ -1,4 +0,0 @@
1
- import { forget, ForgetPromise } from './forget';
2
- export { forget, ForgetPromise };
3
- export default forget;
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAEhD,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,CAAA;AAGhC,eAAe,MAAM,CAAA"}
@@ -1,50 +0,0 @@
1
- :root {
2
- --light-hl-0: #795E26;
3
- --dark-hl-0: #DCDCAA;
4
- --light-hl-1: #000000;
5
- --dark-hl-1: #D4D4D4;
6
- --light-hl-2: #A31515;
7
- --dark-hl-2: #CE9178;
8
- --light-hl-3: #0000FF;
9
- --dark-hl-3: #569CD6;
10
- --light-code-background: #FFFFFF;
11
- --dark-code-background: #1E1E1E;
12
- }
13
-
14
- @media (prefers-color-scheme: light) { :root {
15
- --hl-0: var(--light-hl-0);
16
- --hl-1: var(--light-hl-1);
17
- --hl-2: var(--light-hl-2);
18
- --hl-3: var(--light-hl-3);
19
- --code-background: var(--light-code-background);
20
- } }
21
-
22
- @media (prefers-color-scheme: dark) { :root {
23
- --hl-0: var(--dark-hl-0);
24
- --hl-1: var(--dark-hl-1);
25
- --hl-2: var(--dark-hl-2);
26
- --hl-3: var(--dark-hl-3);
27
- --code-background: var(--dark-code-background);
28
- } }
29
-
30
- :root[data-theme='light'] {
31
- --hl-0: var(--light-hl-0);
32
- --hl-1: var(--light-hl-1);
33
- --hl-2: var(--light-hl-2);
34
- --hl-3: var(--light-hl-3);
35
- --code-background: var(--light-code-background);
36
- }
37
-
38
- :root[data-theme='dark'] {
39
- --hl-0: var(--dark-hl-0);
40
- --hl-1: var(--dark-hl-1);
41
- --hl-2: var(--dark-hl-2);
42
- --hl-3: var(--dark-hl-3);
43
- --code-background: var(--dark-code-background);
44
- }
45
-
46
- .hl-0 { color: var(--hl-0); }
47
- .hl-1 { color: var(--hl-1); }
48
- .hl-2 { color: var(--hl-2); }
49
- .hl-3 { color: var(--hl-3); }
50
- pre, code { background: var(--code-background); }