@drjoshcsimmons/scl 0.1.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/LICENSE +21 -0
- package/README.md +73 -0
- package/dist/components/ui/accordion/accordion.d.ts +8 -0
- package/dist/components/ui/accordion/accordion.d.ts.map +1 -0
- package/dist/components/ui/accordion/index.d.ts +2 -0
- package/dist/components/ui/accordion/index.d.ts.map +1 -0
- package/dist/components/ui/alert/alert.d.ts +9 -0
- package/dist/components/ui/alert/alert.d.ts.map +1 -0
- package/dist/components/ui/alert/index.d.ts +2 -0
- package/dist/components/ui/alert/index.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog/alert-dialog.d.ts +21 -0
- package/dist/components/ui/alert-dialog/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog/index.d.ts +2 -0
- package/dist/components/ui/alert-dialog/index.d.ts.map +1 -0
- package/dist/components/ui/avatar/avatar.d.ts +7 -0
- package/dist/components/ui/avatar/avatar.d.ts.map +1 -0
- package/dist/components/ui/avatar/index.d.ts +2 -0
- package/dist/components/ui/avatar/index.d.ts.map +1 -0
- package/dist/components/ui/badge/badge.d.ts +10 -0
- package/dist/components/ui/badge/badge.d.ts.map +1 -0
- package/dist/components/ui/badge/index.d.ts +2 -0
- package/dist/components/ui/badge/index.d.ts.map +1 -0
- package/dist/components/ui/button/button.d.ts +12 -0
- package/dist/components/ui/button/button.d.ts.map +1 -0
- package/dist/components/ui/button/index.d.ts +2 -0
- package/dist/components/ui/button/index.d.ts.map +1 -0
- package/dist/components/ui/card/card.d.ts +9 -0
- package/dist/components/ui/card/card.d.ts.map +1 -0
- package/dist/components/ui/card/index.d.ts +2 -0
- package/dist/components/ui/card/index.d.ts.map +1 -0
- package/dist/components/ui/checkbox/checkbox.d.ts +5 -0
- package/dist/components/ui/checkbox/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox/index.d.ts +2 -0
- package/dist/components/ui/checkbox/index.d.ts.map +1 -0
- package/dist/components/ui/collapsible/collapsible.d.ts +6 -0
- package/dist/components/ui/collapsible/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible/index.d.ts +2 -0
- package/dist/components/ui/collapsible/index.d.ts.map +1 -0
- package/dist/components/ui/dialog/dialog.d.ts +20 -0
- package/dist/components/ui/dialog/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog/index.d.ts +2 -0
- package/dist/components/ui/dialog/index.d.ts.map +1 -0
- package/dist/components/ui/dithered-image/dithered-image.d.ts +17 -0
- package/dist/components/ui/dithered-image/dithered-image.d.ts.map +1 -0
- package/dist/components/ui/dithered-image/index.d.ts +3 -0
- package/dist/components/ui/dithered-image/index.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +28 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu/index.d.ts +2 -0
- package/dist/components/ui/dropdown-menu/index.d.ts.map +1 -0
- package/dist/components/ui/input/index.d.ts +2 -0
- package/dist/components/ui/input/index.d.ts.map +1 -0
- package/dist/components/ui/input/input.d.ts +5 -0
- package/dist/components/ui/input/input.d.ts.map +1 -0
- package/dist/components/ui/label/index.d.ts +2 -0
- package/dist/components/ui/label/index.d.ts.map +1 -0
- package/dist/components/ui/label/label.d.ts +6 -0
- package/dist/components/ui/label/label.d.ts.map +1 -0
- package/dist/components/ui/popover/index.d.ts +2 -0
- package/dist/components/ui/popover/index.d.ts.map +1 -0
- package/dist/components/ui/popover/popover.d.ts +8 -0
- package/dist/components/ui/popover/popover.d.ts.map +1 -0
- package/dist/components/ui/progress/index.d.ts +2 -0
- package/dist/components/ui/progress/index.d.ts.map +1 -0
- package/dist/components/ui/progress/progress.d.ts +19 -0
- package/dist/components/ui/progress/progress.d.ts.map +1 -0
- package/dist/components/ui/radio-group/index.d.ts +2 -0
- package/dist/components/ui/radio-group/index.d.ts.map +1 -0
- package/dist/components/ui/radio-group/radio-group.d.ts +6 -0
- package/dist/components/ui/radio-group/radio-group.d.ts.map +1 -0
- package/dist/components/ui/scroll-area/index.d.ts +2 -0
- package/dist/components/ui/scroll-area/index.d.ts.map +1 -0
- package/dist/components/ui/scroll-area/scroll-area.d.ts +6 -0
- package/dist/components/ui/scroll-area/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/select/index.d.ts +2 -0
- package/dist/components/ui/select/index.d.ts.map +1 -0
- package/dist/components/ui/select/select.d.ts +14 -0
- package/dist/components/ui/select/select.d.ts.map +1 -0
- package/dist/components/ui/separator/index.d.ts +2 -0
- package/dist/components/ui/separator/index.d.ts.map +1 -0
- package/dist/components/ui/separator/separator.d.ts +5 -0
- package/dist/components/ui/separator/separator.d.ts.map +1 -0
- package/dist/components/ui/sheet/index.d.ts +2 -0
- package/dist/components/ui/sheet/index.d.ts.map +1 -0
- package/dist/components/ui/sheet/sheet.d.ts +26 -0
- package/dist/components/ui/sheet/sheet.d.ts.map +1 -0
- package/dist/components/ui/skeleton/index.d.ts +2 -0
- package/dist/components/ui/skeleton/index.d.ts.map +1 -0
- package/dist/components/ui/skeleton/skeleton.d.ts +3 -0
- package/dist/components/ui/skeleton/skeleton.d.ts.map +1 -0
- package/dist/components/ui/slider/index.d.ts +2 -0
- package/dist/components/ui/slider/index.d.ts.map +1 -0
- package/dist/components/ui/slider/slider.d.ts +5 -0
- package/dist/components/ui/slider/slider.d.ts.map +1 -0
- package/dist/components/ui/statusline/index.d.ts +2 -0
- package/dist/components/ui/statusline/index.d.ts.map +1 -0
- package/dist/components/ui/statusline/statusline.d.ts +40 -0
- package/dist/components/ui/statusline/statusline.d.ts.map +1 -0
- package/dist/components/ui/switch/index.d.ts +2 -0
- package/dist/components/ui/switch/index.d.ts.map +1 -0
- package/dist/components/ui/switch/switch.d.ts +5 -0
- package/dist/components/ui/switch/switch.d.ts.map +1 -0
- package/dist/components/ui/table/index.d.ts +2 -0
- package/dist/components/ui/table/index.d.ts.map +1 -0
- package/dist/components/ui/table/table.d.ts +11 -0
- package/dist/components/ui/table/table.d.ts.map +1 -0
- package/dist/components/ui/tabs/index.d.ts +2 -0
- package/dist/components/ui/tabs/index.d.ts.map +1 -0
- package/dist/components/ui/tabs/tabs.d.ts +8 -0
- package/dist/components/ui/tabs/tabs.d.ts.map +1 -0
- package/dist/components/ui/terminal-textarea/index.d.ts +2 -0
- package/dist/components/ui/terminal-textarea/index.d.ts.map +1 -0
- package/dist/components/ui/terminal-textarea/terminal-textarea.d.ts +27 -0
- package/dist/components/ui/terminal-textarea/terminal-textarea.d.ts.map +1 -0
- package/dist/components/ui/textarea/index.d.ts +2 -0
- package/dist/components/ui/textarea/index.d.ts.map +1 -0
- package/dist/components/ui/textarea/textarea.d.ts +5 -0
- package/dist/components/ui/textarea/textarea.d.ts.map +1 -0
- package/dist/components/ui/toggle/index.d.ts +2 -0
- package/dist/components/ui/toggle/index.d.ts.map +1 -0
- package/dist/components/ui/toggle/toggle.d.ts +13 -0
- package/dist/components/ui/toggle/toggle.d.ts.map +1 -0
- package/dist/components/ui/tooltip/index.d.ts +2 -0
- package/dist/components/ui/tooltip/index.d.ts.map +1 -0
- package/dist/components/ui/tooltip/tooltip.d.ts +11 -0
- package/dist/components/ui/tooltip/tooltip.d.ts.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +165 -0
- package/dist/index10.js +61 -0
- package/dist/index100.js +32 -0
- package/dist/index101.js +17 -0
- package/dist/index102.js +137 -0
- package/dist/index103.js +52 -0
- package/dist/index104.js +11 -0
- package/dist/index105.js +6 -0
- package/dist/index106.js +183 -0
- package/dist/index107.js +652 -0
- package/dist/index108.js +109 -0
- package/dist/index109.js +93 -0
- package/dist/index11.js +27 -0
- package/dist/index110.js +69 -0
- package/dist/index111.js +161 -0
- package/dist/index112.js +399 -0
- package/dist/index113.js +1682 -0
- package/dist/index114.js +280 -0
- package/dist/index115.js +134 -0
- package/dist/index116.js +34 -0
- package/dist/index117.js +1613 -0
- package/dist/index118.js +300 -0
- package/dist/index119.js +637 -0
- package/dist/index12.js +7 -0
- package/dist/index120.js +146 -0
- package/dist/index121.js +23 -0
- package/dist/index122.js +11 -0
- package/dist/index123.js +40 -0
- package/dist/index124.js +20 -0
- package/dist/index125.js +8 -0
- package/dist/index126.js +14 -0
- package/dist/index127.js +208 -0
- package/dist/index128.js +24 -0
- package/dist/index129.js +402 -0
- package/dist/index13.js +100 -0
- package/dist/index130.js +1308 -0
- package/dist/index131.js +620 -0
- package/dist/index132.js +4 -0
- package/dist/index133.js +55 -0
- package/dist/index134.js +67 -0
- package/dist/index135.js +27 -0
- package/dist/index136.js +31 -0
- package/dist/index137.js +7 -0
- package/dist/index138.js +4 -0
- package/dist/index139.js +4 -0
- package/dist/index14.js +226 -0
- package/dist/index140.js +7 -0
- package/dist/index141.js +5 -0
- package/dist/index142.js +26 -0
- package/dist/index143.js +115 -0
- package/dist/index144.js +18 -0
- package/dist/index145.js +527 -0
- package/dist/index146.js +130 -0
- package/dist/index147.js +136 -0
- package/dist/index148.js +67 -0
- package/dist/index149.js +71 -0
- package/dist/index15.js +146 -0
- package/dist/index150.js +11 -0
- package/dist/index151.js +16 -0
- package/dist/index152.js +68 -0
- package/dist/index153.js +6 -0
- package/dist/index154.js +25 -0
- package/dist/index155.js +25 -0
- package/dist/index156.js +15 -0
- package/dist/index157.js +30 -0
- package/dist/index158.js +7 -0
- package/dist/index16.js +21 -0
- package/dist/index17.js +19 -0
- package/dist/index18.js +24 -0
- package/dist/index19.js +58 -0
- package/dist/index2.js +8 -0
- package/dist/index20.js +31 -0
- package/dist/index21.js +38 -0
- package/dist/index22.js +123 -0
- package/dist/index23.js +24 -0
- package/dist/index24.js +72 -0
- package/dist/index25.js +17 -0
- package/dist/index26.js +34 -0
- package/dist/index27.js +81 -0
- package/dist/index28.js +27 -0
- package/dist/index29.js +90 -0
- package/dist/index3.js +22 -0
- package/dist/index30.js +46 -0
- package/dist/index31.js +234 -0
- package/dist/index32.js +20 -0
- package/dist/index33.js +37 -0
- package/dist/index34.js +25 -0
- package/dist/index35.js +105 -0
- package/dist/index36.js +68 -0
- package/dist/index37.js +51 -0
- package/dist/index38.js +102 -0
- package/dist/index39.js +13 -0
- package/dist/index4.js +46 -0
- package/dist/index40.js +17 -0
- package/dist/index41.js +2265 -0
- package/dist/index42.js +35 -0
- package/dist/index43.js +20 -0
- package/dist/index44.js +239 -0
- package/dist/index45.js +13 -0
- package/dist/index46.js +75 -0
- package/dist/index47.js +251 -0
- package/dist/index48.js +11 -0
- package/dist/index49.js +338 -0
- package/dist/index5.js +51 -0
- package/dist/index50.js +62 -0
- package/dist/index51.js +243 -0
- package/dist/index52.js +862 -0
- package/dist/index53.js +11 -0
- package/dist/index54.js +120 -0
- package/dist/index55.js +227 -0
- package/dist/index56.js +13 -0
- package/dist/index57.js +13 -0
- package/dist/index58.js +238 -0
- package/dist/index59.js +262 -0
- package/dist/index6.js +51 -0
- package/dist/index60.js +14 -0
- package/dist/index61.js +24 -0
- package/dist/index62.js +532 -0
- package/dist/index63.js +6157 -0
- package/dist/index64.js +2635 -0
- package/dist/index65.js +300 -0
- package/dist/index66.js +674 -0
- package/dist/index67.js +832 -0
- package/dist/index68.js +27 -0
- package/dist/index69.js +330 -0
- package/dist/index7.js +42 -0
- package/dist/index70.js +4901 -0
- package/dist/index71.js +831 -0
- package/dist/index72.js +1260 -0
- package/dist/index73.js +536 -0
- package/dist/index74.js +127 -0
- package/dist/index75.js +163 -0
- package/dist/index76.js +33 -0
- package/dist/index77.js +437 -0
- package/dist/index78.js +132 -0
- package/dist/index79.js +83 -0
- package/dist/index8.js +31 -0
- package/dist/index80.js +70 -0
- package/dist/index81.js +48 -0
- package/dist/index82.js +29 -0
- package/dist/index83.js +9 -0
- package/dist/index84.js +54 -0
- package/dist/index85.js +36 -0
- package/dist/index86.js +13 -0
- package/dist/index87.js +10 -0
- package/dist/index88.js +32 -0
- package/dist/index89.js +57 -0
- package/dist/index9.js +54 -0
- package/dist/index90.js +13 -0
- package/dist/index91.js +6 -0
- package/dist/index92.js +15 -0
- package/dist/index93.js +8 -0
- package/dist/index94.js +27 -0
- package/dist/index95.js +71 -0
- package/dist/index96.js +127 -0
- package/dist/index97.js +221 -0
- package/dist/index98.js +16 -0
- package/dist/index99.js +56 -0
- package/dist/lib/utils.d.ts +14 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/tokens/animations.d.ts +174 -0
- package/dist/tokens/animations.d.ts.map +1 -0
- package/dist/tokens/colors.d.ts +92 -0
- package/dist/tokens/colors.d.ts.map +1 -0
- package/dist/tokens/index.d.ts +403 -0
- package/dist/tokens/index.d.ts.map +1 -0
- package/dist/tokens/shadows.d.ts +15 -0
- package/dist/tokens/shadows.d.ts.map +1 -0
- package/dist/tokens/spacing.d.ts +55 -0
- package/dist/tokens/spacing.d.ts.map +1 -0
- package/dist/tokens/typography.d.ts +80 -0
- package/dist/tokens/typography.d.ts.map +1 -0
- package/package.json +128 -0
package/dist/index119.js
ADDED
|
@@ -0,0 +1,637 @@
|
|
|
1
|
+
import { NodeProp as F } from "./index113.js";
|
|
2
|
+
let z = 0;
|
|
3
|
+
class g {
|
|
4
|
+
/**
|
|
5
|
+
@internal
|
|
6
|
+
*/
|
|
7
|
+
constructor(t, a, n, i) {
|
|
8
|
+
this.name = t, this.set = a, this.base = n, this.modified = i, this.id = z++;
|
|
9
|
+
}
|
|
10
|
+
toString() {
|
|
11
|
+
let { name: t } = this;
|
|
12
|
+
for (let a of this.modified)
|
|
13
|
+
a.name && (t = `${a.name}(${t})`);
|
|
14
|
+
return t;
|
|
15
|
+
}
|
|
16
|
+
static define(t, a) {
|
|
17
|
+
let n = typeof t == "string" ? t : "?";
|
|
18
|
+
if (t instanceof g && (a = t), a != null && a.base)
|
|
19
|
+
throw new Error("Can not derive from a modified tag");
|
|
20
|
+
let i = new g(n, [], null, []);
|
|
21
|
+
if (i.set.push(i), a)
|
|
22
|
+
for (let o of a.set)
|
|
23
|
+
i.set.push(o);
|
|
24
|
+
return i;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
Define a tag _modifier_, which is a function that, given a tag,
|
|
28
|
+
will return a tag that is a subtag of the original. Applying the
|
|
29
|
+
same modifier to a twice tag will return the same value (`m1(t1)
|
|
30
|
+
== m1(t1)`) and applying multiple modifiers will, regardless or
|
|
31
|
+
order, produce the same tag (`m1(m2(t1)) == m2(m1(t1))`).
|
|
32
|
+
|
|
33
|
+
When multiple modifiers are applied to a given base tag, each
|
|
34
|
+
smaller set of modifiers is registered as a parent, so that for
|
|
35
|
+
example `m1(m2(m3(t1)))` is a subtype of `m1(m2(t1))`,
|
|
36
|
+
`m1(m3(t1)`, and so on.
|
|
37
|
+
*/
|
|
38
|
+
static defineModifier(t) {
|
|
39
|
+
let a = new q(t);
|
|
40
|
+
return (n) => n.modified.indexOf(a) > -1 ? n : q.get(n.base || n, n.modified.concat(a).sort((i, o) => i.id - o.id));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
let G = 0;
|
|
44
|
+
class q {
|
|
45
|
+
constructor(t) {
|
|
46
|
+
this.name = t, this.instances = [], this.id = G++;
|
|
47
|
+
}
|
|
48
|
+
static get(t, a) {
|
|
49
|
+
if (!a.length)
|
|
50
|
+
return t;
|
|
51
|
+
let n = a[0].instances.find((r) => r.base == t && L(a, r.modified));
|
|
52
|
+
if (n)
|
|
53
|
+
return n;
|
|
54
|
+
let i = [], o = new g(t.name, i, t, a);
|
|
55
|
+
for (let r of a)
|
|
56
|
+
r.instances.push(o);
|
|
57
|
+
let c = P(a);
|
|
58
|
+
for (let r of t.set)
|
|
59
|
+
if (!r.modified.length)
|
|
60
|
+
for (let m of c)
|
|
61
|
+
i.push(q.get(r, m));
|
|
62
|
+
return o;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function L(s, t) {
|
|
66
|
+
return s.length == t.length && s.every((a, n) => a == t[n]);
|
|
67
|
+
}
|
|
68
|
+
function P(s) {
|
|
69
|
+
let t = [[]];
|
|
70
|
+
for (let a = 0; a < s.length; a++)
|
|
71
|
+
for (let n = 0, i = t.length; n < i; n++)
|
|
72
|
+
t.push(t[n].concat(s[a]));
|
|
73
|
+
return t.sort((a, n) => n.length - a.length);
|
|
74
|
+
}
|
|
75
|
+
function Z(s) {
|
|
76
|
+
let t = /* @__PURE__ */ Object.create(null);
|
|
77
|
+
for (let a in s) {
|
|
78
|
+
let n = s[a];
|
|
79
|
+
Array.isArray(n) || (n = [n]);
|
|
80
|
+
for (let i of a.split(" "))
|
|
81
|
+
if (i) {
|
|
82
|
+
let o = [], c = 2, r = i;
|
|
83
|
+
for (let d = 0; ; ) {
|
|
84
|
+
if (r == "..." && d > 0 && d + 3 == i.length) {
|
|
85
|
+
c = 1;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
let f = /^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);
|
|
89
|
+
if (!f)
|
|
90
|
+
throw new RangeError("Invalid path: " + i);
|
|
91
|
+
if (o.push(f[0] == "*" ? "" : f[0][0] == '"' ? JSON.parse(f[0]) : f[0]), d += f[0].length, d == i.length)
|
|
92
|
+
break;
|
|
93
|
+
let b = i[d++];
|
|
94
|
+
if (d == i.length && b == "!") {
|
|
95
|
+
c = 0;
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
if (b != "/")
|
|
99
|
+
throw new RangeError("Invalid path: " + i);
|
|
100
|
+
r = i.slice(d);
|
|
101
|
+
}
|
|
102
|
+
let m = o.length - 1, h = o[m];
|
|
103
|
+
if (!h)
|
|
104
|
+
throw new RangeError("Invalid path: " + i);
|
|
105
|
+
let v = new R(n, c, m > 0 ? o.slice(0, m) : null);
|
|
106
|
+
t[h] = v.sort(t[h]);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return J.add(t);
|
|
110
|
+
}
|
|
111
|
+
const J = new F({
|
|
112
|
+
combine(s, t) {
|
|
113
|
+
let a, n, i;
|
|
114
|
+
for (; s || t; ) {
|
|
115
|
+
if (!s || t && s.depth >= t.depth ? (i = t, t = t.next) : (i = s, s = s.next), a && a.mode == i.mode && !i.context && !a.context)
|
|
116
|
+
continue;
|
|
117
|
+
let o = new R(i.tags, i.mode, i.context);
|
|
118
|
+
a ? a.next = o : n = o, a = o;
|
|
119
|
+
}
|
|
120
|
+
return n;
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
class R {
|
|
124
|
+
constructor(t, a, n, i) {
|
|
125
|
+
this.tags = t, this.mode = a, this.context = n, this.next = i;
|
|
126
|
+
}
|
|
127
|
+
get opaque() {
|
|
128
|
+
return this.mode == 0;
|
|
129
|
+
}
|
|
130
|
+
get inherit() {
|
|
131
|
+
return this.mode == 1;
|
|
132
|
+
}
|
|
133
|
+
sort(t) {
|
|
134
|
+
return !t || t.depth < this.depth ? (this.next = t, this) : (t.next = this.sort(t.next), t);
|
|
135
|
+
}
|
|
136
|
+
get depth() {
|
|
137
|
+
return this.context ? this.context.length : 0;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
R.empty = new R([], 2, null);
|
|
141
|
+
function Q(s, t) {
|
|
142
|
+
let a = /* @__PURE__ */ Object.create(null);
|
|
143
|
+
for (let o of s)
|
|
144
|
+
if (!Array.isArray(o.tag))
|
|
145
|
+
a[o.tag.id] = o.class;
|
|
146
|
+
else
|
|
147
|
+
for (let c of o.tag)
|
|
148
|
+
a[c.id] = o.class;
|
|
149
|
+
let { scope: n, all: i = null } = t || {};
|
|
150
|
+
return {
|
|
151
|
+
style: (o) => {
|
|
152
|
+
let c = i;
|
|
153
|
+
for (let r of o)
|
|
154
|
+
for (let m of r.set) {
|
|
155
|
+
let h = a[m.id];
|
|
156
|
+
if (h) {
|
|
157
|
+
c = c ? c + " " + h : h;
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return c;
|
|
162
|
+
},
|
|
163
|
+
scope: n
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
function U(s, t) {
|
|
167
|
+
let a = null;
|
|
168
|
+
for (let n of s) {
|
|
169
|
+
let i = n.style(t);
|
|
170
|
+
i && (a = a ? a + " " + i : i);
|
|
171
|
+
}
|
|
172
|
+
return a;
|
|
173
|
+
}
|
|
174
|
+
function _(s, t, a, n = 0, i = s.length) {
|
|
175
|
+
let o = new W(n, Array.isArray(t) ? t : [t], a);
|
|
176
|
+
o.highlightRange(s.cursor(), n, i, "", o.highlighters), o.flush(i);
|
|
177
|
+
}
|
|
178
|
+
class W {
|
|
179
|
+
constructor(t, a, n) {
|
|
180
|
+
this.at = t, this.highlighters = a, this.span = n, this.class = "";
|
|
181
|
+
}
|
|
182
|
+
startSpan(t, a) {
|
|
183
|
+
a != this.class && (this.flush(t), t > this.at && (this.at = t), this.class = a);
|
|
184
|
+
}
|
|
185
|
+
flush(t) {
|
|
186
|
+
t > this.at && this.class && this.span(this.at, t, this.class);
|
|
187
|
+
}
|
|
188
|
+
highlightRange(t, a, n, i, o) {
|
|
189
|
+
let { type: c, from: r, to: m } = t;
|
|
190
|
+
if (r >= n || m <= a)
|
|
191
|
+
return;
|
|
192
|
+
c.isTop && (o = this.highlighters.filter((b) => !b.scope || b.scope(c)));
|
|
193
|
+
let h = i, v = X(t) || R.empty, d = U(o, v.tags);
|
|
194
|
+
if (d && (h && (h += " "), h += d, v.mode == 1 && (i += (i ? " " : "") + d)), this.startSpan(Math.max(a, r), h), v.opaque)
|
|
195
|
+
return;
|
|
196
|
+
let f = t.tree && t.tree.prop(F.mounted);
|
|
197
|
+
if (f && f.overlay) {
|
|
198
|
+
let b = t.node.enter(f.overlay[0].from + r, 1), V = this.highlighters.filter((w) => !w.scope || w.scope(f.tree.type)), B = t.firstChild();
|
|
199
|
+
for (let w = 0, M = r; ; w++) {
|
|
200
|
+
let S = w < f.overlay.length ? f.overlay[w] : null, E = S ? S.from + r : m, H = Math.max(a, M), A = Math.min(n, E);
|
|
201
|
+
if (H < A && B)
|
|
202
|
+
for (; t.from < A && (this.highlightRange(t, H, A, i, o), this.startSpan(Math.min(A, t.to), h), !(t.to >= E || !t.nextSibling())); )
|
|
203
|
+
;
|
|
204
|
+
if (!S || E > n)
|
|
205
|
+
break;
|
|
206
|
+
M = S.to + r, M > a && (this.highlightRange(b.cursor(), Math.max(a, S.from + r), Math.min(n, M), "", V), this.startSpan(Math.min(n, M), h));
|
|
207
|
+
}
|
|
208
|
+
B && t.parent();
|
|
209
|
+
} else if (t.firstChild()) {
|
|
210
|
+
f && (i = "");
|
|
211
|
+
do
|
|
212
|
+
if (!(t.to <= a)) {
|
|
213
|
+
if (t.from >= n)
|
|
214
|
+
break;
|
|
215
|
+
this.highlightRange(t, a, n, i, o), this.startSpan(Math.min(n, t.to), h);
|
|
216
|
+
}
|
|
217
|
+
while (t.nextSibling());
|
|
218
|
+
t.parent();
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
function X(s) {
|
|
223
|
+
let t = s.type.prop(J);
|
|
224
|
+
for (; t && t.context && !s.matchContext(t.context); )
|
|
225
|
+
t = t.next;
|
|
226
|
+
return t || null;
|
|
227
|
+
}
|
|
228
|
+
const e = g.define, I = e(), y = e(), D = e(y), $ = e(y), N = e(), T = e(N), K = e(N), k = e(), x = e(k), p = e(), u = e(), j = e(), O = e(j), C = e(), l = {
|
|
229
|
+
/**
|
|
230
|
+
A comment.
|
|
231
|
+
*/
|
|
232
|
+
comment: I,
|
|
233
|
+
/**
|
|
234
|
+
A line [comment](#highlight.tags.comment).
|
|
235
|
+
*/
|
|
236
|
+
lineComment: e(I),
|
|
237
|
+
/**
|
|
238
|
+
A block [comment](#highlight.tags.comment).
|
|
239
|
+
*/
|
|
240
|
+
blockComment: e(I),
|
|
241
|
+
/**
|
|
242
|
+
A documentation [comment](#highlight.tags.comment).
|
|
243
|
+
*/
|
|
244
|
+
docComment: e(I),
|
|
245
|
+
/**
|
|
246
|
+
Any kind of identifier.
|
|
247
|
+
*/
|
|
248
|
+
name: y,
|
|
249
|
+
/**
|
|
250
|
+
The [name](#highlight.tags.name) of a variable.
|
|
251
|
+
*/
|
|
252
|
+
variableName: e(y),
|
|
253
|
+
/**
|
|
254
|
+
A type [name](#highlight.tags.name).
|
|
255
|
+
*/
|
|
256
|
+
typeName: D,
|
|
257
|
+
/**
|
|
258
|
+
A tag name (subtag of [`typeName`](#highlight.tags.typeName)).
|
|
259
|
+
*/
|
|
260
|
+
tagName: e(D),
|
|
261
|
+
/**
|
|
262
|
+
A property or field [name](#highlight.tags.name).
|
|
263
|
+
*/
|
|
264
|
+
propertyName: $,
|
|
265
|
+
/**
|
|
266
|
+
An attribute name (subtag of [`propertyName`](#highlight.tags.propertyName)).
|
|
267
|
+
*/
|
|
268
|
+
attributeName: e($),
|
|
269
|
+
/**
|
|
270
|
+
The [name](#highlight.tags.name) of a class.
|
|
271
|
+
*/
|
|
272
|
+
className: e(y),
|
|
273
|
+
/**
|
|
274
|
+
A label [name](#highlight.tags.name).
|
|
275
|
+
*/
|
|
276
|
+
labelName: e(y),
|
|
277
|
+
/**
|
|
278
|
+
A namespace [name](#highlight.tags.name).
|
|
279
|
+
*/
|
|
280
|
+
namespace: e(y),
|
|
281
|
+
/**
|
|
282
|
+
The [name](#highlight.tags.name) of a macro.
|
|
283
|
+
*/
|
|
284
|
+
macroName: e(y),
|
|
285
|
+
/**
|
|
286
|
+
A literal value.
|
|
287
|
+
*/
|
|
288
|
+
literal: N,
|
|
289
|
+
/**
|
|
290
|
+
A string [literal](#highlight.tags.literal).
|
|
291
|
+
*/
|
|
292
|
+
string: T,
|
|
293
|
+
/**
|
|
294
|
+
A documentation [string](#highlight.tags.string).
|
|
295
|
+
*/
|
|
296
|
+
docString: e(T),
|
|
297
|
+
/**
|
|
298
|
+
A character literal (subtag of [string](#highlight.tags.string)).
|
|
299
|
+
*/
|
|
300
|
+
character: e(T),
|
|
301
|
+
/**
|
|
302
|
+
An attribute value (subtag of [string](#highlight.tags.string)).
|
|
303
|
+
*/
|
|
304
|
+
attributeValue: e(T),
|
|
305
|
+
/**
|
|
306
|
+
A number [literal](#highlight.tags.literal).
|
|
307
|
+
*/
|
|
308
|
+
number: K,
|
|
309
|
+
/**
|
|
310
|
+
An integer [number](#highlight.tags.number) literal.
|
|
311
|
+
*/
|
|
312
|
+
integer: e(K),
|
|
313
|
+
/**
|
|
314
|
+
A floating-point [number](#highlight.tags.number) literal.
|
|
315
|
+
*/
|
|
316
|
+
float: e(K),
|
|
317
|
+
/**
|
|
318
|
+
A boolean [literal](#highlight.tags.literal).
|
|
319
|
+
*/
|
|
320
|
+
bool: e(N),
|
|
321
|
+
/**
|
|
322
|
+
Regular expression [literal](#highlight.tags.literal).
|
|
323
|
+
*/
|
|
324
|
+
regexp: e(N),
|
|
325
|
+
/**
|
|
326
|
+
An escape [literal](#highlight.tags.literal), for example a
|
|
327
|
+
backslash escape in a string.
|
|
328
|
+
*/
|
|
329
|
+
escape: e(N),
|
|
330
|
+
/**
|
|
331
|
+
A color [literal](#highlight.tags.literal).
|
|
332
|
+
*/
|
|
333
|
+
color: e(N),
|
|
334
|
+
/**
|
|
335
|
+
A URL [literal](#highlight.tags.literal).
|
|
336
|
+
*/
|
|
337
|
+
url: e(N),
|
|
338
|
+
/**
|
|
339
|
+
A language keyword.
|
|
340
|
+
*/
|
|
341
|
+
keyword: p,
|
|
342
|
+
/**
|
|
343
|
+
The [keyword](#highlight.tags.keyword) for the self or this
|
|
344
|
+
object.
|
|
345
|
+
*/
|
|
346
|
+
self: e(p),
|
|
347
|
+
/**
|
|
348
|
+
The [keyword](#highlight.tags.keyword) for null.
|
|
349
|
+
*/
|
|
350
|
+
null: e(p),
|
|
351
|
+
/**
|
|
352
|
+
A [keyword](#highlight.tags.keyword) denoting some atomic value.
|
|
353
|
+
*/
|
|
354
|
+
atom: e(p),
|
|
355
|
+
/**
|
|
356
|
+
A [keyword](#highlight.tags.keyword) that represents a unit.
|
|
357
|
+
*/
|
|
358
|
+
unit: e(p),
|
|
359
|
+
/**
|
|
360
|
+
A modifier [keyword](#highlight.tags.keyword).
|
|
361
|
+
*/
|
|
362
|
+
modifier: e(p),
|
|
363
|
+
/**
|
|
364
|
+
A [keyword](#highlight.tags.keyword) that acts as an operator.
|
|
365
|
+
*/
|
|
366
|
+
operatorKeyword: e(p),
|
|
367
|
+
/**
|
|
368
|
+
A control-flow related [keyword](#highlight.tags.keyword).
|
|
369
|
+
*/
|
|
370
|
+
controlKeyword: e(p),
|
|
371
|
+
/**
|
|
372
|
+
A [keyword](#highlight.tags.keyword) that defines something.
|
|
373
|
+
*/
|
|
374
|
+
definitionKeyword: e(p),
|
|
375
|
+
/**
|
|
376
|
+
A [keyword](#highlight.tags.keyword) related to defining or
|
|
377
|
+
interfacing with modules.
|
|
378
|
+
*/
|
|
379
|
+
moduleKeyword: e(p),
|
|
380
|
+
/**
|
|
381
|
+
An operator.
|
|
382
|
+
*/
|
|
383
|
+
operator: u,
|
|
384
|
+
/**
|
|
385
|
+
An [operator](#highlight.tags.operator) that dereferences something.
|
|
386
|
+
*/
|
|
387
|
+
derefOperator: e(u),
|
|
388
|
+
/**
|
|
389
|
+
Arithmetic-related [operator](#highlight.tags.operator).
|
|
390
|
+
*/
|
|
391
|
+
arithmeticOperator: e(u),
|
|
392
|
+
/**
|
|
393
|
+
Logical [operator](#highlight.tags.operator).
|
|
394
|
+
*/
|
|
395
|
+
logicOperator: e(u),
|
|
396
|
+
/**
|
|
397
|
+
Bit [operator](#highlight.tags.operator).
|
|
398
|
+
*/
|
|
399
|
+
bitwiseOperator: e(u),
|
|
400
|
+
/**
|
|
401
|
+
Comparison [operator](#highlight.tags.operator).
|
|
402
|
+
*/
|
|
403
|
+
compareOperator: e(u),
|
|
404
|
+
/**
|
|
405
|
+
[Operator](#highlight.tags.operator) that updates its operand.
|
|
406
|
+
*/
|
|
407
|
+
updateOperator: e(u),
|
|
408
|
+
/**
|
|
409
|
+
[Operator](#highlight.tags.operator) that defines something.
|
|
410
|
+
*/
|
|
411
|
+
definitionOperator: e(u),
|
|
412
|
+
/**
|
|
413
|
+
Type-related [operator](#highlight.tags.operator).
|
|
414
|
+
*/
|
|
415
|
+
typeOperator: e(u),
|
|
416
|
+
/**
|
|
417
|
+
Control-flow [operator](#highlight.tags.operator).
|
|
418
|
+
*/
|
|
419
|
+
controlOperator: e(u),
|
|
420
|
+
/**
|
|
421
|
+
Program or markup punctuation.
|
|
422
|
+
*/
|
|
423
|
+
punctuation: j,
|
|
424
|
+
/**
|
|
425
|
+
[Punctuation](#highlight.tags.punctuation) that separates
|
|
426
|
+
things.
|
|
427
|
+
*/
|
|
428
|
+
separator: e(j),
|
|
429
|
+
/**
|
|
430
|
+
Bracket-style [punctuation](#highlight.tags.punctuation).
|
|
431
|
+
*/
|
|
432
|
+
bracket: O,
|
|
433
|
+
/**
|
|
434
|
+
Angle [brackets](#highlight.tags.bracket) (usually `<` and `>`
|
|
435
|
+
tokens).
|
|
436
|
+
*/
|
|
437
|
+
angleBracket: e(O),
|
|
438
|
+
/**
|
|
439
|
+
Square [brackets](#highlight.tags.bracket) (usually `[` and `]`
|
|
440
|
+
tokens).
|
|
441
|
+
*/
|
|
442
|
+
squareBracket: e(O),
|
|
443
|
+
/**
|
|
444
|
+
Parentheses (usually `(` and `)` tokens). Subtag of
|
|
445
|
+
[bracket](#highlight.tags.bracket).
|
|
446
|
+
*/
|
|
447
|
+
paren: e(O),
|
|
448
|
+
/**
|
|
449
|
+
Braces (usually `{` and `}` tokens). Subtag of
|
|
450
|
+
[bracket](#highlight.tags.bracket).
|
|
451
|
+
*/
|
|
452
|
+
brace: e(O),
|
|
453
|
+
/**
|
|
454
|
+
Content, for example plain text in XML or markup documents.
|
|
455
|
+
*/
|
|
456
|
+
content: k,
|
|
457
|
+
/**
|
|
458
|
+
[Content](#highlight.tags.content) that represents a heading.
|
|
459
|
+
*/
|
|
460
|
+
heading: x,
|
|
461
|
+
/**
|
|
462
|
+
A level 1 [heading](#highlight.tags.heading).
|
|
463
|
+
*/
|
|
464
|
+
heading1: e(x),
|
|
465
|
+
/**
|
|
466
|
+
A level 2 [heading](#highlight.tags.heading).
|
|
467
|
+
*/
|
|
468
|
+
heading2: e(x),
|
|
469
|
+
/**
|
|
470
|
+
A level 3 [heading](#highlight.tags.heading).
|
|
471
|
+
*/
|
|
472
|
+
heading3: e(x),
|
|
473
|
+
/**
|
|
474
|
+
A level 4 [heading](#highlight.tags.heading).
|
|
475
|
+
*/
|
|
476
|
+
heading4: e(x),
|
|
477
|
+
/**
|
|
478
|
+
A level 5 [heading](#highlight.tags.heading).
|
|
479
|
+
*/
|
|
480
|
+
heading5: e(x),
|
|
481
|
+
/**
|
|
482
|
+
A level 6 [heading](#highlight.tags.heading).
|
|
483
|
+
*/
|
|
484
|
+
heading6: e(x),
|
|
485
|
+
/**
|
|
486
|
+
A prose [content](#highlight.tags.content) separator (such as a horizontal rule).
|
|
487
|
+
*/
|
|
488
|
+
contentSeparator: e(k),
|
|
489
|
+
/**
|
|
490
|
+
[Content](#highlight.tags.content) that represents a list.
|
|
491
|
+
*/
|
|
492
|
+
list: e(k),
|
|
493
|
+
/**
|
|
494
|
+
[Content](#highlight.tags.content) that represents a quote.
|
|
495
|
+
*/
|
|
496
|
+
quote: e(k),
|
|
497
|
+
/**
|
|
498
|
+
[Content](#highlight.tags.content) that is emphasized.
|
|
499
|
+
*/
|
|
500
|
+
emphasis: e(k),
|
|
501
|
+
/**
|
|
502
|
+
[Content](#highlight.tags.content) that is styled strong.
|
|
503
|
+
*/
|
|
504
|
+
strong: e(k),
|
|
505
|
+
/**
|
|
506
|
+
[Content](#highlight.tags.content) that is part of a link.
|
|
507
|
+
*/
|
|
508
|
+
link: e(k),
|
|
509
|
+
/**
|
|
510
|
+
[Content](#highlight.tags.content) that is styled as code or
|
|
511
|
+
monospace.
|
|
512
|
+
*/
|
|
513
|
+
monospace: e(k),
|
|
514
|
+
/**
|
|
515
|
+
[Content](#highlight.tags.content) that has a strike-through
|
|
516
|
+
style.
|
|
517
|
+
*/
|
|
518
|
+
strikethrough: e(k),
|
|
519
|
+
/**
|
|
520
|
+
Inserted text in a change-tracking format.
|
|
521
|
+
*/
|
|
522
|
+
inserted: e(),
|
|
523
|
+
/**
|
|
524
|
+
Deleted text.
|
|
525
|
+
*/
|
|
526
|
+
deleted: e(),
|
|
527
|
+
/**
|
|
528
|
+
Changed text.
|
|
529
|
+
*/
|
|
530
|
+
changed: e(),
|
|
531
|
+
/**
|
|
532
|
+
An invalid or unsyntactic element.
|
|
533
|
+
*/
|
|
534
|
+
invalid: e(),
|
|
535
|
+
/**
|
|
536
|
+
Metadata or meta-instruction.
|
|
537
|
+
*/
|
|
538
|
+
meta: C,
|
|
539
|
+
/**
|
|
540
|
+
[Metadata](#highlight.tags.meta) that applies to the entire
|
|
541
|
+
document.
|
|
542
|
+
*/
|
|
543
|
+
documentMeta: e(C),
|
|
544
|
+
/**
|
|
545
|
+
[Metadata](#highlight.tags.meta) that annotates or adds
|
|
546
|
+
attributes to a given syntactic element.
|
|
547
|
+
*/
|
|
548
|
+
annotation: e(C),
|
|
549
|
+
/**
|
|
550
|
+
Processing instruction or preprocessor directive. Subtag of
|
|
551
|
+
[meta](#highlight.tags.meta).
|
|
552
|
+
*/
|
|
553
|
+
processingInstruction: e(C),
|
|
554
|
+
/**
|
|
555
|
+
[Modifier](#highlight.Tag^defineModifier) that indicates that a
|
|
556
|
+
given element is being defined. Expected to be used with the
|
|
557
|
+
various [name](#highlight.tags.name) tags.
|
|
558
|
+
*/
|
|
559
|
+
definition: g.defineModifier("definition"),
|
|
560
|
+
/**
|
|
561
|
+
[Modifier](#highlight.Tag^defineModifier) that indicates that
|
|
562
|
+
something is constant. Mostly expected to be used with
|
|
563
|
+
[variable names](#highlight.tags.variableName).
|
|
564
|
+
*/
|
|
565
|
+
constant: g.defineModifier("constant"),
|
|
566
|
+
/**
|
|
567
|
+
[Modifier](#highlight.Tag^defineModifier) used to indicate that
|
|
568
|
+
a [variable](#highlight.tags.variableName) or [property
|
|
569
|
+
name](#highlight.tags.propertyName) is being called or defined
|
|
570
|
+
as a function.
|
|
571
|
+
*/
|
|
572
|
+
function: g.defineModifier("function"),
|
|
573
|
+
/**
|
|
574
|
+
[Modifier](#highlight.Tag^defineModifier) that can be applied to
|
|
575
|
+
[names](#highlight.tags.name) to indicate that they belong to
|
|
576
|
+
the language's standard environment.
|
|
577
|
+
*/
|
|
578
|
+
standard: g.defineModifier("standard"),
|
|
579
|
+
/**
|
|
580
|
+
[Modifier](#highlight.Tag^defineModifier) that indicates a given
|
|
581
|
+
[names](#highlight.tags.name) is local to some scope.
|
|
582
|
+
*/
|
|
583
|
+
local: g.defineModifier("local"),
|
|
584
|
+
/**
|
|
585
|
+
A generic variant [modifier](#highlight.Tag^defineModifier) that
|
|
586
|
+
can be used to tag language-specific alternative variants of
|
|
587
|
+
some common tag. It is recommended for themes to define special
|
|
588
|
+
forms of at least the [string](#highlight.tags.string) and
|
|
589
|
+
[variable name](#highlight.tags.variableName) tags, since those
|
|
590
|
+
come up a lot.
|
|
591
|
+
*/
|
|
592
|
+
special: g.defineModifier("special")
|
|
593
|
+
};
|
|
594
|
+
for (let s in l) {
|
|
595
|
+
let t = l[s];
|
|
596
|
+
t instanceof g && (t.name = s);
|
|
597
|
+
}
|
|
598
|
+
Q([
|
|
599
|
+
{ tag: l.link, class: "tok-link" },
|
|
600
|
+
{ tag: l.heading, class: "tok-heading" },
|
|
601
|
+
{ tag: l.emphasis, class: "tok-emphasis" },
|
|
602
|
+
{ tag: l.strong, class: "tok-strong" },
|
|
603
|
+
{ tag: l.keyword, class: "tok-keyword" },
|
|
604
|
+
{ tag: l.atom, class: "tok-atom" },
|
|
605
|
+
{ tag: l.bool, class: "tok-bool" },
|
|
606
|
+
{ tag: l.url, class: "tok-url" },
|
|
607
|
+
{ tag: l.labelName, class: "tok-labelName" },
|
|
608
|
+
{ tag: l.inserted, class: "tok-inserted" },
|
|
609
|
+
{ tag: l.deleted, class: "tok-deleted" },
|
|
610
|
+
{ tag: l.literal, class: "tok-literal" },
|
|
611
|
+
{ tag: l.string, class: "tok-string" },
|
|
612
|
+
{ tag: l.number, class: "tok-number" },
|
|
613
|
+
{ tag: [l.regexp, l.escape, l.special(l.string)], class: "tok-string2" },
|
|
614
|
+
{ tag: l.variableName, class: "tok-variableName" },
|
|
615
|
+
{ tag: l.local(l.variableName), class: "tok-variableName tok-local" },
|
|
616
|
+
{ tag: l.definition(l.variableName), class: "tok-variableName tok-definition" },
|
|
617
|
+
{ tag: l.special(l.variableName), class: "tok-variableName2" },
|
|
618
|
+
{ tag: l.definition(l.propertyName), class: "tok-propertyName tok-definition" },
|
|
619
|
+
{ tag: l.typeName, class: "tok-typeName" },
|
|
620
|
+
{ tag: l.namespace, class: "tok-namespace" },
|
|
621
|
+
{ tag: l.className, class: "tok-className" },
|
|
622
|
+
{ tag: l.macroName, class: "tok-macroName" },
|
|
623
|
+
{ tag: l.propertyName, class: "tok-propertyName" },
|
|
624
|
+
{ tag: l.operator, class: "tok-operator" },
|
|
625
|
+
{ tag: l.comment, class: "tok-comment" },
|
|
626
|
+
{ tag: l.meta, class: "tok-meta" },
|
|
627
|
+
{ tag: l.invalid, class: "tok-invalid" },
|
|
628
|
+
{ tag: l.punctuation, class: "tok-punctuation" }
|
|
629
|
+
]);
|
|
630
|
+
export {
|
|
631
|
+
g as Tag,
|
|
632
|
+
X as getStyleTags,
|
|
633
|
+
_ as highlightTree,
|
|
634
|
+
Z as styleTags,
|
|
635
|
+
Q as tagHighlighter,
|
|
636
|
+
l as tags
|
|
637
|
+
};
|