@onetype/framework 2.0.53 → 2.0.54
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/addons/float/popup/css/popup.css +2 -2
- package/addons/render/directives/front/functions/process.js +3 -1
- package/addons/render/directives/front/items/self/160-slot.js +9 -1
- package/addons/render/editor/addon.js +13 -0
- package/addons/render/editor/functions/block/add.js +57 -0
- package/addons/render/editor/functions/block/delete.js +32 -0
- package/addons/render/editor/functions/block/find.js +30 -0
- package/addons/render/editor/functions/render/block.js +114 -0
- package/addons/render/editor/functions/render/blocks.js +31 -0
- package/addons/render/editor/items/elements/editor.js +69 -0
- package/addons/render/editor/items/self/paragraph.js +21 -0
- package/addons/render/editor/styles/editor.css +252 -0
- package/addons/render/elements/front/functions/types/colors/badge.js +19 -0
- package/addons/render/elements/front/functions/types/colors/status.js +24 -0
- package/addons/render/elements/front/functions/types/escape.js +8 -0
- package/addons/render/elements/front/functions/types/format/currency.js +16 -0
- package/addons/render/elements/front/functions/types/format/date.js +16 -0
- package/addons/render/elements/front/functions/types/format/number.js +24 -0
- package/addons/render/elements/front/functions/types/format/timeago.js +43 -0
- package/addons/render/elements/front/functions/types/render/avatar.js +10 -0
- package/addons/render/elements/front/functions/types/render/badge.js +17 -0
- package/addons/render/elements/front/functions/types/render/boolean.js +8 -0
- package/addons/render/elements/front/functions/types/render/chip.js +6 -0
- package/addons/render/elements/front/functions/types/render/currency.js +7 -0
- package/addons/render/elements/front/functions/types/render/date.js +6 -0
- package/addons/render/elements/front/functions/types/render/description.js +12 -0
- package/addons/render/elements/front/functions/types/render/group.js +11 -0
- package/addons/render/elements/front/functions/types/render/icon.js +8 -0
- package/addons/render/elements/front/functions/types/render/image.js +9 -0
- package/addons/render/elements/front/functions/types/render/link.js +8 -0
- package/addons/render/elements/front/functions/types/render/media.js +16 -0
- package/addons/render/elements/front/functions/types/render/metric.js +13 -0
- package/addons/render/elements/front/functions/types/render/number.js +6 -0
- package/addons/render/elements/front/functions/types/render/progress.js +13 -0
- package/addons/render/elements/front/functions/types/render/status.js +12 -0
- package/addons/render/elements/front/functions/types/render/tag.js +6 -0
- package/addons/render/elements/front/functions/types/render/tags.js +11 -0
- package/addons/render/elements/front/functions/types/render/text.js +8 -0
- package/addons/render/elements/front/functions/types/render/timeago.js +6 -0
- package/addons/render/elements/front/functions/types/render.js +16 -0
- package/addons/render/elements/front/items/directives/element.js +8 -3
- package/addons/render/elements/front/items/self/cards/info/info.css +499 -0
- package/addons/render/elements/front/items/self/cards/info/info.js +224 -0
- package/addons/render/elements/front/items/self/cards/item/item.css +614 -0
- package/addons/render/elements/front/items/self/cards/item/item.js +200 -0
- package/addons/render/elements/front/items/self/cards/pricing/pricing.css +318 -46
- package/addons/render/elements/front/items/self/cards/pricing/pricing.js +81 -30
- package/addons/render/elements/front/items/self/cards/profile/profile.css +446 -0
- package/addons/render/elements/front/items/self/cards/profile/profile.js +186 -0
- package/addons/render/elements/front/items/self/cards/share/share.css +445 -0
- package/addons/render/elements/front/items/self/cards/share/share.js +316 -0
- package/addons/render/elements/front/items/self/cards/stat/stat.css +356 -0
- package/addons/render/elements/front/items/self/cards/stat/stat.js +146 -0
- package/addons/render/elements/front/items/self/charts/bar/bar.css +263 -0
- package/addons/render/elements/front/items/self/charts/bar/bar.js +156 -0
- package/addons/render/elements/front/items/self/charts/donut/donut.css +222 -0
- package/addons/render/elements/front/items/self/charts/donut/donut.js +164 -0
- package/addons/render/elements/front/items/self/charts/line/line.css +229 -0
- package/addons/render/elements/front/items/self/charts/line/line.js +249 -0
- package/addons/render/elements/front/items/self/charts/sparkline/sparkline.css +102 -0
- package/addons/render/elements/front/items/self/charts/sparkline/sparkline.js +164 -0
- package/addons/render/elements/front/items/self/core/builder/builder.css +71 -116
- package/addons/render/elements/front/items/self/core/builder/builder.js +212 -127
- package/addons/render/elements/front/items/self/core/repeater/repeater.css +338 -71
- package/addons/render/elements/front/items/self/core/repeater/repeater.js +191 -44
- package/addons/render/elements/front/items/self/data/filters/filters.css +541 -0
- package/addons/render/elements/front/items/self/data/filters/filters.js +504 -0
- package/addons/render/elements/front/items/self/data/table/table.css +588 -0
- package/addons/render/elements/front/items/self/data/table/table.js +589 -0
- package/addons/render/elements/front/items/self/form/button/button.css +430 -103
- package/addons/render/elements/front/items/self/form/button/button.js +109 -101
- package/addons/render/elements/front/items/self/form/checkbox/checkbox.css +356 -39
- package/addons/render/elements/front/items/self/form/checkbox/checkbox.js +109 -75
- package/addons/render/elements/front/items/self/form/color/color.css +255 -61
- package/addons/render/elements/front/items/self/form/color/color.js +135 -41
- package/addons/render/elements/front/items/self/form/date/date.css +289 -38
- package/addons/render/elements/front/items/self/form/date/date.js +108 -24
- package/addons/render/elements/front/items/self/form/editor/editor.css +447 -0
- package/addons/render/elements/front/items/self/form/editor/editor.js +794 -0
- package/addons/render/elements/front/items/self/form/field/field.css +160 -29
- package/addons/render/elements/front/items/self/form/field/field.js +36 -16
- package/addons/render/elements/front/items/self/form/input/input.css +272 -32
- package/addons/render/elements/front/items/self/form/input/input.js +324 -124
- package/addons/render/elements/front/items/self/form/radio/radio.css +310 -45
- package/addons/render/elements/front/items/self/form/radio/radio.js +99 -80
- package/addons/render/elements/front/items/self/form/rating/rating.css +234 -57
- package/addons/render/elements/front/items/self/form/rating/rating.js +216 -86
- package/addons/render/elements/front/items/self/form/section/section.css +247 -32
- package/addons/render/elements/front/items/self/form/section/section.js +53 -16
- package/addons/render/elements/front/items/self/form/select/select.css +362 -64
- package/addons/render/elements/front/items/self/form/select/select.js +156 -30
- package/addons/render/elements/front/items/self/form/slider/slider.css +331 -123
- package/addons/render/elements/front/items/self/form/slider/slider.js +124 -26
- package/addons/render/elements/front/items/self/form/tags/tags.css +328 -53
- package/addons/render/elements/front/items/self/form/tags/tags.js +155 -28
- package/addons/render/elements/front/items/self/form/textarea/textarea.css +128 -27
- package/addons/render/elements/front/items/self/form/textarea/textarea.js +172 -113
- package/addons/render/elements/front/items/self/form/toggle/toggle.css +239 -39
- package/addons/render/elements/front/items/self/form/toggle/toggle.js +32 -17
- package/addons/render/elements/front/items/self/form/transfer/transfer.css +377 -0
- package/addons/render/elements/front/items/self/form/transfer/transfer.js +453 -0
- package/addons/render/elements/front/items/self/form/upload/upload.css +408 -0
- package/addons/render/elements/front/items/self/form/upload/upload.js +469 -0
- package/addons/render/elements/front/items/self/global/accordion/accordion.css +377 -0
- package/addons/render/elements/front/items/self/global/accordion/accordion.js +135 -0
- package/addons/render/elements/front/items/self/global/code/code.css +207 -44
- package/addons/render/elements/front/items/self/global/code/code.js +327 -19
- package/addons/render/elements/front/items/self/global/gallery/gallery.css +521 -0
- package/addons/render/elements/front/items/self/global/gallery/gallery.js +291 -0
- package/addons/render/elements/front/items/self/global/heading/heading.css +151 -49
- package/addons/render/elements/front/items/self/global/heading/heading.js +30 -15
- package/addons/render/elements/front/items/self/global/markdown/markdown.css +284 -135
- package/addons/render/elements/front/items/self/global/markdown/markdown.js +35 -5
- package/addons/render/elements/front/items/self/global/menu/menu.css +311 -56
- package/addons/render/elements/front/items/self/global/menu/menu.js +95 -47
- package/addons/render/elements/front/items/self/global/notice/notice.css +263 -23
- package/addons/render/elements/front/items/self/global/notice/notice.js +51 -11
- package/addons/render/elements/front/items/self/global/parameters/parameters.css +276 -33
- package/addons/render/elements/front/items/self/global/parameters/parameters.js +86 -16
- package/addons/render/elements/front/items/self/global/tags/tags.css +215 -29
- package/addons/render/elements/front/items/self/global/tags/tags.js +91 -17
- package/addons/render/elements/front/items/self/navigation/dock/dock.css +221 -0
- package/addons/render/elements/front/items/self/navigation/dock/dock.js +134 -0
- package/addons/render/elements/front/items/self/navigation/footer/footer.css +356 -0
- package/addons/render/elements/front/items/self/navigation/footer/footer.js +219 -0
- package/addons/render/elements/front/items/self/navigation/navbar/navbar.css +736 -76
- package/addons/render/elements/front/items/self/navigation/navbar/navbar.js +437 -29
- package/addons/render/elements/front/items/self/navigation/sidebar/sidebar.css +327 -196
- package/addons/render/elements/front/items/self/navigation/sidebar/sidebar.js +115 -62
- package/addons/render/elements/front/items/self/navigation/steps/steps.css +345 -0
- package/addons/render/elements/front/items/self/navigation/steps/steps.js +113 -0
- package/addons/render/elements/front/items/self/navigation/tabs/tabs.css +507 -33
- package/addons/render/elements/front/items/self/navigation/tabs/tabs.js +62 -19
- package/addons/render/elements/front/items/self/status/code/code.css +83 -12
- package/addons/render/elements/front/items/self/status/code/code.js +15 -4
- package/addons/render/elements/front/items/self/status/empty/empty.css +95 -15
- package/addons/render/elements/front/items/self/status/empty/empty.js +17 -12
- package/addons/render/elements/front/items/self/status/error/error.css +99 -14
- package/addons/render/elements/front/items/self/status/error/error.js +21 -11
- package/addons/render/elements/front/items/self/status/loading/loading.css +85 -14
- package/addons/render/elements/front/items/self/status/loading/loading.js +5 -6
- package/addons/render/elements/front/styles/types.css +363 -0
- package/instructions.txt +28 -0
- package/lib/load.js +1 -0
- package/lib/styles/reset.css +89 -76
- package/package.json +1 -1
- package/addons/render/elements/front/items/self/form/editor-markdown/editor-markdown.css +0 -410
- package/addons/render/elements/front/items/self/form/editor-markdown/editor-markdown.js +0 -191
- package/addons/render/elements/front/items/self/global/faq/faq.css +0 -98
- package/addons/render/elements/front/items/self/global/faq/faq.js +0 -56
|
@@ -13,85 +13,248 @@
|
|
|
13
13
|
display: flex;
|
|
14
14
|
flex-direction: column;
|
|
15
15
|
width: 100%;
|
|
16
|
-
|
|
16
|
+
background: #0d1117;
|
|
17
17
|
border-radius: var(--ot-radius-m);
|
|
18
18
|
overflow: hidden;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
/*
|
|
21
|
+
/* Head */
|
|
22
22
|
|
|
23
|
-
.e-4a15b201 > .holder > .
|
|
23
|
+
.e-4a15b201 > .holder > .head
|
|
24
24
|
{
|
|
25
25
|
display: flex;
|
|
26
26
|
align-items: center;
|
|
27
|
-
|
|
27
|
+
gap: var(--ot-spacing-s);
|
|
28
28
|
padding: var(--ot-spacing-s) var(--ot-spacing-m);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
font-family: monospace;
|
|
32
|
-
color: var(--ot-text-2);
|
|
33
|
-
border-bottom: 1px solid transparent;
|
|
29
|
+
background: rgba(255, 255, 255, 0.03);
|
|
30
|
+
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
|
|
34
31
|
}
|
|
35
32
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
.e-4a15b201 > .holder > .label > .copy
|
|
33
|
+
.e-4a15b201 > .holder > .head > .dots
|
|
39
34
|
{
|
|
40
35
|
display: flex;
|
|
36
|
+
gap: 6px;
|
|
37
|
+
flex-shrink: 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.e-4a15b201 > .holder > .head > .dots > span
|
|
41
|
+
{
|
|
42
|
+
width: 11px;
|
|
43
|
+
height: 11px;
|
|
44
|
+
border-radius: 50%;
|
|
45
|
+
background: rgba(255, 255, 255, 0.14);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.e-4a15b201 > .holder > .head > .dots > span:nth-child(1) { background: #ff5f56; }
|
|
49
|
+
.e-4a15b201 > .holder > .head > .dots > span:nth-child(2) { background: #ffbd2e; }
|
|
50
|
+
.e-4a15b201 > .holder > .head > .dots > span:nth-child(3) { background: #27c93f; }
|
|
51
|
+
|
|
52
|
+
.e-4a15b201 > .holder > .head > .filename,
|
|
53
|
+
.e-4a15b201 > .holder > .head > .language
|
|
54
|
+
{
|
|
55
|
+
flex: 1;
|
|
56
|
+
text-align: center;
|
|
57
|
+
font-family: ui-monospace, 'SF Mono', Menlo, monospace;
|
|
58
|
+
font-size: 12px;
|
|
59
|
+
font-weight: 500;
|
|
60
|
+
color: rgba(255, 255, 255, 0.55);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.e-4a15b201 > .holder > .head > .language
|
|
64
|
+
{
|
|
65
|
+
text-transform: uppercase;
|
|
66
|
+
font-size: 10.5px;
|
|
67
|
+
letter-spacing: 0.06em;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.e-4a15b201 > .holder > .head > .copy
|
|
71
|
+
{
|
|
72
|
+
display: inline-flex;
|
|
41
73
|
align-items: center;
|
|
42
|
-
|
|
43
|
-
padding:
|
|
44
|
-
background:
|
|
45
|
-
border:
|
|
46
|
-
|
|
74
|
+
gap: 5px;
|
|
75
|
+
padding: 5px 10px;
|
|
76
|
+
background: rgba(255, 255, 255, 0.06);
|
|
77
|
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
78
|
+
border-radius: 100px;
|
|
79
|
+
color: rgba(255, 255, 255, 0.7);
|
|
80
|
+
font-family: var(--ot-font-primary);
|
|
81
|
+
font-size: 11px;
|
|
82
|
+
font-weight: 600;
|
|
47
83
|
cursor: pointer;
|
|
48
|
-
transition: color 0.
|
|
84
|
+
transition: background 0.2s cubic-bezier(0.22, 1, 0.36, 1), color 0.2s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.2s cubic-bezier(0.22, 1, 0.36, 1);
|
|
85
|
+
flex-shrink: 0;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.e-4a15b201 > .holder > .head > .copy:hover
|
|
89
|
+
{
|
|
90
|
+
background: rgba(255, 255, 255, 0.1);
|
|
91
|
+
color: white;
|
|
49
92
|
}
|
|
50
93
|
|
|
51
|
-
.e-4a15b201 > .holder > .
|
|
94
|
+
.e-4a15b201 > .holder > .head > .copy > i
|
|
52
95
|
{
|
|
53
|
-
|
|
96
|
+
font-size: 13px;
|
|
54
97
|
}
|
|
55
98
|
|
|
56
|
-
.e-4a15b201 > .holder > .
|
|
99
|
+
.e-4a15b201 > .holder > .head > .copy.copied
|
|
57
100
|
{
|
|
58
|
-
|
|
101
|
+
background: rgba(52, 211, 153, 0.15);
|
|
102
|
+
border-color: rgba(52, 211, 153, 0.4);
|
|
103
|
+
color: #34d399;
|
|
59
104
|
}
|
|
60
105
|
|
|
61
106
|
/* Content */
|
|
62
107
|
|
|
63
108
|
.e-4a15b201 > .holder > .content
|
|
64
109
|
{
|
|
65
|
-
padding: var(--ot-spacing-m);
|
|
66
110
|
margin: 0;
|
|
67
|
-
|
|
68
|
-
font-family: monospace;
|
|
69
|
-
color: var(--ot-text-2);
|
|
70
|
-
line-height: 1.6;
|
|
111
|
+
padding: var(--ot-spacing-m);
|
|
71
112
|
overflow-x: auto;
|
|
72
|
-
|
|
113
|
+
font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
|
|
114
|
+
font-size: 13px;
|
|
115
|
+
line-height: 1.65;
|
|
116
|
+
color: #e6e6e6;
|
|
73
117
|
tab-size: 4;
|
|
74
118
|
}
|
|
75
119
|
|
|
76
|
-
|
|
120
|
+
.e-4a15b201 > .holder > .content > code
|
|
121
|
+
{
|
|
122
|
+
font-family: inherit;
|
|
123
|
+
font-size: inherit;
|
|
124
|
+
background: none;
|
|
125
|
+
padding: 0;
|
|
126
|
+
border: none;
|
|
127
|
+
color: inherit;
|
|
128
|
+
display: block;
|
|
129
|
+
white-space: pre;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* Scrollbar */
|
|
133
|
+
|
|
134
|
+
.e-4a15b201 > .holder > .content::-webkit-scrollbar
|
|
135
|
+
{
|
|
136
|
+
height: 8px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.e-4a15b201 > .holder > .content::-webkit-scrollbar-track
|
|
140
|
+
{
|
|
141
|
+
background: transparent;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.e-4a15b201 > .holder > .content::-webkit-scrollbar-thumb
|
|
145
|
+
{
|
|
146
|
+
background: rgba(255, 255, 255, 0.1);
|
|
147
|
+
border-radius: 100px;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.e-4a15b201 > .holder > .content::-webkit-scrollbar-thumb:hover
|
|
151
|
+
{
|
|
152
|
+
background: rgba(255, 255, 255, 0.18);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* Line numbers */
|
|
156
|
+
|
|
157
|
+
.e-4a15b201 .numbered
|
|
158
|
+
{
|
|
159
|
+
display: flex;
|
|
160
|
+
flex-direction: column;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.e-4a15b201 .line
|
|
164
|
+
{
|
|
165
|
+
display: flex;
|
|
166
|
+
padding: 0 var(--ot-spacing-m) 0 0;
|
|
167
|
+
margin: 0 calc(var(--ot-spacing-m) * -1);
|
|
168
|
+
transition: background 0.15s ease;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.e-4a15b201 .line > .number
|
|
172
|
+
{
|
|
173
|
+
width: 40px;
|
|
174
|
+
padding-right: 14px;
|
|
175
|
+
text-align: right;
|
|
176
|
+
color: rgba(255, 255, 255, 0.25);
|
|
177
|
+
user-select: none;
|
|
178
|
+
flex-shrink: 0;
|
|
179
|
+
border-right: 1px solid rgba(255, 255, 255, 0.06);
|
|
180
|
+
margin-right: 14px;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.e-4a15b201 .line > .content
|
|
184
|
+
{
|
|
185
|
+
flex: 1;
|
|
186
|
+
min-width: 0;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.e-4a15b201 .line.highlighted
|
|
190
|
+
{
|
|
191
|
+
background: rgba(226, 112, 85, 0.08);
|
|
192
|
+
box-shadow: inset 2px 0 0 var(--ot-brand);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.e-4a15b201 .line.highlighted > .number
|
|
196
|
+
{
|
|
197
|
+
color: rgba(226, 112, 85, 0.7);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/* Plain (no numbers) */
|
|
201
|
+
|
|
202
|
+
.e-4a15b201 .plain
|
|
203
|
+
{
|
|
204
|
+
display: block;
|
|
205
|
+
white-space: pre;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/* ===== SYNTAX TOKENS ===== */
|
|
77
209
|
|
|
78
|
-
.e-4a15b201
|
|
79
|
-
.e-4a15b201
|
|
80
|
-
.e-4a15b201
|
|
81
|
-
.e-4a15b201
|
|
82
|
-
.e-4a15b201
|
|
83
|
-
.e-4a15b201
|
|
84
|
-
.e-4a15b201
|
|
85
|
-
.e-4a15b201
|
|
210
|
+
.e-4a15b201 .t-keyword { color: #ff7b72; font-weight: 500; }
|
|
211
|
+
.e-4a15b201 .t-string { color: #a5d6ff; }
|
|
212
|
+
.e-4a15b201 .t-number { color: #ffa657; }
|
|
213
|
+
.e-4a15b201 .t-comment { color: #8b949e; font-style: italic; }
|
|
214
|
+
.e-4a15b201 .t-fn { color: #d2a8ff; }
|
|
215
|
+
.e-4a15b201 .t-tag { color: #7ee787; }
|
|
216
|
+
.e-4a15b201 .t-attr { color: #79c0ff; }
|
|
217
|
+
.e-4a15b201 .t-selector { color: #7ee787; }
|
|
218
|
+
.e-4a15b201 .t-prop { color: #79c0ff; }
|
|
86
219
|
|
|
87
|
-
/*
|
|
220
|
+
/* ===== BACKGROUNDS (subtle frame) ===== */
|
|
88
221
|
|
|
89
|
-
.e-4a15b201 > .holder.
|
|
90
|
-
.e-4a15b201 > .holder.
|
|
91
|
-
.e-4a15b201 > .holder.
|
|
92
|
-
.e-4a15b201 > .holder.
|
|
93
|
-
.e-4a15b201 > .holder.size-l > .content { padding: var(--ot-spacing-l); font-size: var(--ot-size-m); }
|
|
222
|
+
.e-4a15b201 > .holder.bg-1 { outline: 1px solid var(--ot-bg-1-border); outline-offset: -1px; }
|
|
223
|
+
.e-4a15b201 > .holder.bg-2 { outline: 1px solid var(--ot-bg-2-border); outline-offset: -1px; }
|
|
224
|
+
.e-4a15b201 > .holder.bg-3 { outline: 1px solid var(--ot-bg-3-border); outline-offset: -1px; }
|
|
225
|
+
.e-4a15b201 > .holder.bg-4 { outline: 1px solid var(--ot-bg-4-border); outline-offset: -1px; }
|
|
94
226
|
|
|
95
|
-
/*
|
|
227
|
+
/* ===== BORDER ===== */
|
|
96
228
|
|
|
97
229
|
.e-4a15b201 > .holder.border { border: 1px solid var(--ot-bg-2-border); }
|
|
230
|
+
|
|
231
|
+
.e-4a15b201 > .holder.bg-1.border { border-color: var(--ot-bg-1-border); }
|
|
232
|
+
.e-4a15b201 > .holder.bg-2.border { border-color: var(--ot-bg-2-border); }
|
|
233
|
+
.e-4a15b201 > .holder.bg-3.border { border-color: var(--ot-bg-3-border); }
|
|
234
|
+
.e-4a15b201 > .holder.bg-4.border { border-color: var(--ot-bg-4-border); }
|
|
235
|
+
|
|
236
|
+
/* ===== SIZES ===== */
|
|
237
|
+
|
|
238
|
+
.e-4a15b201 > .holder.size-s > .content
|
|
239
|
+
{
|
|
240
|
+
padding: var(--ot-spacing-s) var(--ot-spacing-m);
|
|
241
|
+
font-size: 12px;
|
|
242
|
+
line-height: 1.55;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.e-4a15b201 > .holder.size-s > .head
|
|
246
|
+
{
|
|
247
|
+
padding: var(--ot-spacing-x) var(--ot-spacing-s);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.e-4a15b201 > .holder.size-l > .content
|
|
251
|
+
{
|
|
252
|
+
padding: var(--ot-spacing-l);
|
|
253
|
+
font-size: 14px;
|
|
254
|
+
line-height: 1.75;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.e-4a15b201 > .holder.size-l > .head
|
|
258
|
+
{
|
|
259
|
+
padding: var(--ot-spacing-m) var(--ot-spacing-l);
|
|
260
|
+
}
|
|
@@ -1,48 +1,356 @@
|
|
|
1
1
|
onetype.AddonReady('elements', (elements) =>
|
|
2
2
|
{
|
|
3
|
+
const LANG_JS = {
|
|
4
|
+
keywords: /\b(const|let|var|function|return|if|else|for|while|do|switch|case|break|continue|new|class|extends|super|this|typeof|instanceof|in|of|try|catch|finally|throw|async|await|import|from|export|default|null|undefined|true|false|void|delete|yield|static)\b/g,
|
|
5
|
+
comment: /(\/\/[^\n]*|\/\*[\s\S]*?\*\/)/g,
|
|
6
|
+
string: /(`(?:[^`\\]|\\.)*`|'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*")/g,
|
|
7
|
+
number: /\b(\d+(\.\d+)?)\b/g,
|
|
8
|
+
fn: /\b([a-zA-Z_$][\w$]*)\s*(?=\()/g
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const LANG_CSS = {
|
|
12
|
+
comment: /(\/\*[\s\S]*?\*\/)/g,
|
|
13
|
+
string: /("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/g,
|
|
14
|
+
selector: /([.#]?[a-zA-Z_-][\w-]*(?:\s*[>+~]\s*[.#]?[a-zA-Z_-][\w-]*)*)(?=\s*\{)/g,
|
|
15
|
+
prop: /([a-zA-Z-]+)(?=\s*:)/g,
|
|
16
|
+
number: /\b(\d+(\.\d+)?(px|em|rem|vh|vw|%|s|ms)?)\b/g
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const LANG_HTML = {
|
|
20
|
+
comment: /(<!--[\s\S]*?-->)/g,
|
|
21
|
+
tag: /(<\/?)([a-zA-Z][\w-]*)/g,
|
|
22
|
+
attr: /\s([a-zA-Z-:]+)(?==)/g,
|
|
23
|
+
string: /(=)("[^&]*"|'[^']*')/g
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const LANG_JSON = {
|
|
27
|
+
string: /("(?:[^"\\]|\\.)*")/g,
|
|
28
|
+
number: /(-?\d+(\.\d+)?([eE][+-]?\d+)?)/g,
|
|
29
|
+
keyword: /\b(true|false|null)\b/g
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const LANG_PYTHON = {
|
|
33
|
+
keywords: /\b(def|class|return|if|elif|else|for|while|import|from|as|pass|break|continue|try|except|finally|raise|with|lambda|yield|global|nonlocal|in|is|not|and|or|None|True|False|self)\b/g,
|
|
34
|
+
comment: /(#[^\n]*)/g,
|
|
35
|
+
string: /("""[\s\S]*?"""|'''[\s\S]*?'''|"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/g,
|
|
36
|
+
number: /\b(\d+(\.\d+)?)\b/g,
|
|
37
|
+
fn: /\b([a-zA-Z_][\w]*)\s*(?=\()/g
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const LANG_BASH = {
|
|
41
|
+
comment: /(#[^\n]*)/g,
|
|
42
|
+
string: /("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/g,
|
|
43
|
+
variable: /(\$\w+|\$\{[^}]+\})/g,
|
|
44
|
+
flag: /(\s)(-{1,2}[\w-]+)/g,
|
|
45
|
+
command: /^(\s*)([a-zA-Z_][\w-]*)/gm
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const escapeHtml = (text) =>
|
|
49
|
+
{
|
|
50
|
+
return text
|
|
51
|
+
.replace(/&/g, '&')
|
|
52
|
+
.replace(/</g, '<')
|
|
53
|
+
.replace(/>/g, '>')
|
|
54
|
+
.replace(/"/g, '"');
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const tokenize = (code, language) =>
|
|
58
|
+
{
|
|
59
|
+
const escaped = escapeHtml(code);
|
|
60
|
+
|
|
61
|
+
if(language === 'js' || language === 'javascript')
|
|
62
|
+
{
|
|
63
|
+
return tokenizeJs(escaped);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if(language === 'css')
|
|
67
|
+
{
|
|
68
|
+
return tokenizeCss(escaped);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if(language === 'html')
|
|
72
|
+
{
|
|
73
|
+
return tokenizeHtml(escaped);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if(language === 'json')
|
|
77
|
+
{
|
|
78
|
+
return tokenizeJson(escaped);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if(language === 'python' || language === 'py')
|
|
82
|
+
{
|
|
83
|
+
return tokenizePython(escaped);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if(language === 'bash' || language === 'sh' || language === 'shell')
|
|
87
|
+
{
|
|
88
|
+
return tokenizeBash(escaped);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return escaped;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const tokenizeJs = (code) =>
|
|
95
|
+
{
|
|
96
|
+
const placeholders = [];
|
|
97
|
+
|
|
98
|
+
const stash = (match) =>
|
|
99
|
+
{
|
|
100
|
+
const index = placeholders.length;
|
|
101
|
+
placeholders.push(match);
|
|
102
|
+
return '\u0000ph' + index + 'hp\u0000';
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
code = code.replace(LANG_JS.comment, (match) => stash('<span class="t-comment">' + match + '</span>'));
|
|
106
|
+
code = code.replace(LANG_JS.string, (match) => stash('<span class="t-string">' + match + '</span>'));
|
|
107
|
+
code = code.replace(LANG_JS.keywords, '<span class="t-keyword">$1</span>');
|
|
108
|
+
code = code.replace(LANG_JS.number, '<span class="t-number">$1</span>');
|
|
109
|
+
code = code.replace(LANG_JS.fn, '<span class="t-fn">$1</span>');
|
|
110
|
+
|
|
111
|
+
code = code.replace(/\u0000ph(\d+)hp\u0000/g, (m, i) => placeholders[parseInt(i)]);
|
|
112
|
+
|
|
113
|
+
return code;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const tokenizeCss = (code) =>
|
|
117
|
+
{
|
|
118
|
+
const placeholders = [];
|
|
119
|
+
|
|
120
|
+
const stash = (match) =>
|
|
121
|
+
{
|
|
122
|
+
const index = placeholders.length;
|
|
123
|
+
placeholders.push(match);
|
|
124
|
+
return '\u0000ph' + index + 'hp\u0000';
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
code = code.replace(LANG_CSS.comment, (match) => stash('<span class="t-comment">' + match + '</span>'));
|
|
128
|
+
code = code.replace(LANG_CSS.string, (match) => stash('<span class="t-string">' + match + '</span>'));
|
|
129
|
+
code = code.replace(LANG_CSS.selector, '<span class="t-selector">$1</span>');
|
|
130
|
+
code = code.replace(LANG_CSS.prop, '<span class="t-prop">$1</span>');
|
|
131
|
+
code = code.replace(LANG_CSS.number, '<span class="t-number">$1</span>');
|
|
132
|
+
|
|
133
|
+
code = code.replace(/\u0000ph(\d+)hp\u0000/g, (m, i) => placeholders[parseInt(i)]);
|
|
134
|
+
|
|
135
|
+
return code;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const tokenizeHtml = (code) =>
|
|
139
|
+
{
|
|
140
|
+
const placeholders = [];
|
|
141
|
+
|
|
142
|
+
const stash = (match) =>
|
|
143
|
+
{
|
|
144
|
+
const index = placeholders.length;
|
|
145
|
+
placeholders.push(match);
|
|
146
|
+
return '\u0000ph' + index + 'hp\u0000';
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
code = code.replace(LANG_HTML.comment, (match) => stash('<span class="t-comment">' + match + '</span>'));
|
|
150
|
+
code = code.replace(LANG_HTML.string, '$1<span class="t-string">$2</span>');
|
|
151
|
+
code = code.replace(LANG_HTML.attr, ' <span class="t-attr">$1</span>');
|
|
152
|
+
code = code.replace(LANG_HTML.tag, '$1<span class="t-tag">$2</span>');
|
|
153
|
+
|
|
154
|
+
code = code.replace(/\u0000ph(\d+)hp\u0000/g, (m, i) => placeholders[parseInt(i)]);
|
|
155
|
+
|
|
156
|
+
return code;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const tokenizeJson = (code) =>
|
|
160
|
+
{
|
|
161
|
+
const placeholders = [];
|
|
162
|
+
|
|
163
|
+
const stash = (match) =>
|
|
164
|
+
{
|
|
165
|
+
const index = placeholders.length;
|
|
166
|
+
placeholders.push(match);
|
|
167
|
+
return '\u0000ph' + index + 'hp\u0000';
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
code = code.replace(LANG_JSON.string, (match) => stash('<span class="t-string">' + match + '</span>'));
|
|
171
|
+
code = code.replace(LANG_JSON.keyword, '<span class="t-keyword">$1</span>');
|
|
172
|
+
code = code.replace(LANG_JSON.number, '<span class="t-number">$1</span>');
|
|
173
|
+
|
|
174
|
+
code = code.replace(/\u0000ph(\d+)hp\u0000/g, (m, i) => placeholders[parseInt(i)]);
|
|
175
|
+
|
|
176
|
+
return code;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const tokenizePython = (code) =>
|
|
180
|
+
{
|
|
181
|
+
const placeholders = [];
|
|
182
|
+
|
|
183
|
+
const stash = (match) =>
|
|
184
|
+
{
|
|
185
|
+
const index = placeholders.length;
|
|
186
|
+
placeholders.push(match);
|
|
187
|
+
return '\u0000ph' + index + 'hp\u0000';
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
code = code.replace(LANG_PYTHON.comment, (match) => stash('<span class="t-comment">' + match + '</span>'));
|
|
191
|
+
code = code.replace(LANG_PYTHON.string, (match) => stash('<span class="t-string">' + match + '</span>'));
|
|
192
|
+
code = code.replace(LANG_PYTHON.keywords, '<span class="t-keyword">$1</span>');
|
|
193
|
+
code = code.replace(LANG_PYTHON.number, '<span class="t-number">$1</span>');
|
|
194
|
+
code = code.replace(LANG_PYTHON.fn, '<span class="t-fn">$1</span>');
|
|
195
|
+
|
|
196
|
+
code = code.replace(/\u0000ph(\d+)hp\u0000/g, (m, i) => placeholders[parseInt(i)]);
|
|
197
|
+
|
|
198
|
+
return code;
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
const tokenizeBash = (code) =>
|
|
202
|
+
{
|
|
203
|
+
const placeholders = [];
|
|
204
|
+
|
|
205
|
+
const stash = (match) =>
|
|
206
|
+
{
|
|
207
|
+
const index = placeholders.length;
|
|
208
|
+
placeholders.push(match);
|
|
209
|
+
return '\u0000ph' + index + 'hp\u0000';
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
code = code.replace(LANG_BASH.comment, (match) => stash('<span class="t-comment">' + match + '</span>'));
|
|
213
|
+
code = code.replace(LANG_BASH.string, (match) => stash('<span class="t-string">' + match + '</span>'));
|
|
214
|
+
code = code.replace(LANG_BASH.variable, '<span class="t-number">$1</span>');
|
|
215
|
+
code = code.replace(LANG_BASH.flag, '$1<span class="t-attr">$2</span>');
|
|
216
|
+
code = code.replace(LANG_BASH.command, '$1<span class="t-keyword">$2</span>');
|
|
217
|
+
|
|
218
|
+
code = code.replace(/\u0000ph(\d+)hp\u0000/g, (m, i) => placeholders[parseInt(i)]);
|
|
219
|
+
|
|
220
|
+
return code;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
const parseHighlight = (value) =>
|
|
224
|
+
{
|
|
225
|
+
if(!value)
|
|
226
|
+
{
|
|
227
|
+
return [];
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const result = [];
|
|
231
|
+
|
|
232
|
+
value.split(',').forEach(part =>
|
|
233
|
+
{
|
|
234
|
+
const range = part.trim().split('-');
|
|
235
|
+
|
|
236
|
+
if(range.length === 2)
|
|
237
|
+
{
|
|
238
|
+
const start = parseInt(range[0]);
|
|
239
|
+
const end = parseInt(range[1]);
|
|
240
|
+
|
|
241
|
+
for(let i = start; i <= end; i++)
|
|
242
|
+
{
|
|
243
|
+
result.push(i);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
else
|
|
247
|
+
{
|
|
248
|
+
result.push(parseInt(range[0]));
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
return result;
|
|
253
|
+
};
|
|
254
|
+
|
|
3
255
|
elements.ItemAdd({
|
|
4
256
|
id: 'global-code',
|
|
5
257
|
icon: 'code',
|
|
6
258
|
name: 'Code',
|
|
7
|
-
description: 'Code block with
|
|
259
|
+
description: 'Code block with syntax highlighting for html, css, js. Copy button, line numbers and line highlight.',
|
|
8
260
|
category: 'Global',
|
|
9
261
|
author: 'OneType',
|
|
10
262
|
config: {
|
|
11
|
-
label: {
|
|
12
|
-
type: 'string',
|
|
13
|
-
value: ''
|
|
14
|
-
},
|
|
15
263
|
source: {
|
|
264
|
+
type: 'string'
|
|
265
|
+
},
|
|
266
|
+
color: {
|
|
267
|
+
type: 'string'
|
|
268
|
+
},
|
|
269
|
+
language: {
|
|
16
270
|
type: 'string',
|
|
17
|
-
value: ''
|
|
271
|
+
value: 'js',
|
|
272
|
+
options: ['js', 'javascript', 'css', 'html', 'json', 'python', 'py', 'bash', 'sh', 'shell']
|
|
273
|
+
},
|
|
274
|
+
filename: {
|
|
275
|
+
type: 'string'
|
|
276
|
+
},
|
|
277
|
+
lines: {
|
|
278
|
+
type: 'boolean',
|
|
279
|
+
value: false
|
|
280
|
+
},
|
|
281
|
+
highlight: {
|
|
282
|
+
type: 'string'
|
|
283
|
+
},
|
|
284
|
+
copy: {
|
|
285
|
+
type: 'boolean',
|
|
286
|
+
value: true
|
|
18
287
|
},
|
|
19
288
|
variant: {
|
|
20
289
|
type: 'array',
|
|
21
|
-
value: ['bg-2'],
|
|
290
|
+
value: ['bg-2', 'border'],
|
|
22
291
|
options: ['bg-1', 'bg-2', 'bg-3', 'bg-4', 'border', 'size-s', 'size-m', 'size-l']
|
|
23
292
|
}
|
|
24
293
|
},
|
|
25
294
|
render: function()
|
|
26
295
|
{
|
|
27
296
|
this.copied = false;
|
|
28
|
-
this.escaped = this.source ? this.source.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>') : '';
|
|
29
297
|
|
|
30
|
-
|
|
298
|
+
const raw = (this.source || '').replace(/^\n+|\n+$/g, '');
|
|
299
|
+
const highlighted = tokenize(raw, this.language);
|
|
300
|
+
const highlightLines = parseHighlight(this.highlight);
|
|
301
|
+
|
|
302
|
+
if(this.lines)
|
|
31
303
|
{
|
|
32
|
-
const
|
|
33
|
-
|
|
304
|
+
const linesArray = highlighted.split('\n');
|
|
305
|
+
|
|
306
|
+
this.linesHtml = linesArray.map((line, index) =>
|
|
307
|
+
{
|
|
308
|
+
const number = index + 1;
|
|
309
|
+
const isHighlighted = highlightLines.includes(number);
|
|
310
|
+
const classes = 'line' + (isHighlighted ? ' highlighted' : '');
|
|
311
|
+
|
|
312
|
+
return '<div class="' + classes + '"><span class="number">' + number + '</span><span class="content">' + (line || ' ') + '</span></div>';
|
|
313
|
+
}).join('');
|
|
314
|
+
|
|
315
|
+
this.output = '<div class="numbered">' + this.linesHtml + '</div>';
|
|
316
|
+
}
|
|
317
|
+
else
|
|
318
|
+
{
|
|
319
|
+
this.output = '<span class="plain">' + highlighted + '</span>';
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
this.copyCode = () =>
|
|
323
|
+
{
|
|
324
|
+
if(navigator.clipboard && raw)
|
|
325
|
+
{
|
|
326
|
+
navigator.clipboard.writeText(raw);
|
|
327
|
+
}
|
|
328
|
+
|
|
34
329
|
this.copied = true;
|
|
35
|
-
|
|
330
|
+
|
|
331
|
+
setTimeout(() =>
|
|
332
|
+
{
|
|
333
|
+
this.copied = false;
|
|
334
|
+
}, 1800);
|
|
36
335
|
};
|
|
37
336
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
337
|
+
this.hasHead = !!this.filename || !!this.language || this.copy;
|
|
338
|
+
|
|
339
|
+
this.frameStyle = this.color ? 'background: ' + this.color : '';
|
|
340
|
+
|
|
341
|
+
return /* html */ `
|
|
342
|
+
<div :class="'holder ' + variant.join(' ')" :style="frameStyle">
|
|
343
|
+
<div ot-if="hasHead" class="head">
|
|
344
|
+
<div class="dots"><span></span><span></span><span></span></div>
|
|
345
|
+
<div ot-if="filename" class="filename">{{ filename }}</div>
|
|
346
|
+
<div ot-if="!filename && language" class="language">{{ language }}</div>
|
|
347
|
+
<button ot-if="copy" :class="'copy' + (copied ? ' copied' : '')" type="button" ot-click="copyCode">
|
|
348
|
+
<i ot-if="!copied">content_copy</i>
|
|
349
|
+
<i ot-if="copied">check</i>
|
|
350
|
+
<span>{{ copied ? 'Copied' : 'Copy' }}</span>
|
|
351
|
+
</button>
|
|
43
352
|
</div>
|
|
44
|
-
<pre
|
|
45
|
-
<pre ot-if="!escaped" class="content"><slot name="content"></slot></pre>
|
|
353
|
+
<pre class="content"><code ot-html="output"></code></pre>
|
|
46
354
|
</div>
|
|
47
355
|
`;
|
|
48
356
|
}
|