@taqueria/plugin-smartpy-legacy 0.37.1
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 +201 -0
- package/README.md +73 -0
- package/index.d.ts +1 -0
- package/index.js +328 -0
- package/index.js.map +1 -0
- package/index.mjs +308 -0
- package/index.mjs.map +1 -0
- package/install.sh +128 -0
- package/package.json +78 -0
- package/smartpy-v0.16.0/smart-ts-cli.js +17 -0
- package/smartpy-v0.16.0/smart.js +348 -0
- package/smartpy-v0.16.0/smartpyc.js +274828 -0
- package/smartpy-v0.16.0/theme.js +251 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
// Copyright 2019-2022 Smart Chain Arena LLC.
|
|
2
|
+
|
|
3
|
+
/** Set light/dark mode based on user preferences */
|
|
4
|
+
$(document).ready(() => {
|
|
5
|
+
if (window) {
|
|
6
|
+
setThemeClass(window.localStorage.getItem('theme', 'light'));
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
// Define a new stylesheet for the theme's custom rules
|
|
11
|
+
const sheet = (function () {
|
|
12
|
+
// Create the <style> tag
|
|
13
|
+
const style = document.createElement('style');
|
|
14
|
+
|
|
15
|
+
// WebKit hack :(
|
|
16
|
+
style.appendChild(document.createTextNode(''));
|
|
17
|
+
|
|
18
|
+
// Add the <style> element to the page
|
|
19
|
+
document.head.appendChild(style);
|
|
20
|
+
|
|
21
|
+
return style.sheet;
|
|
22
|
+
})();
|
|
23
|
+
|
|
24
|
+
// Replace non-root rules in custom stylesheet
|
|
25
|
+
const replaceRules = (rules) => {
|
|
26
|
+
for (let i = 0; i < sheet.rules.length; i++) {
|
|
27
|
+
sheet.deleteRule(i);
|
|
28
|
+
}
|
|
29
|
+
sheet.insertRule(`@media all {${rules}}`);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const activateDarkMode = () => {
|
|
33
|
+
const rootElement = document.querySelector(':root');
|
|
34
|
+
const darkTheme = {
|
|
35
|
+
'--primary': '#006dcc',
|
|
36
|
+
'--primary-text-color': '#fafafa',
|
|
37
|
+
|
|
38
|
+
'--background-color': '#212529',
|
|
39
|
+
'--link-color': '#66AACC',
|
|
40
|
+
'--button-hover-color': 'slategray',
|
|
41
|
+
'--menu-bg-color': '#05385C',
|
|
42
|
+
'--border-color': '#D3D3D3',
|
|
43
|
+
|
|
44
|
+
'--output-bgok': '#05364a',
|
|
45
|
+
'--output-bgko': '#4a3605',
|
|
46
|
+
|
|
47
|
+
'--danger-color': '#dc3545',
|
|
48
|
+
'--dataColumn-color': 'blanchedalmond',
|
|
49
|
+
'--simulationBuilder-bg-color': '#444488',
|
|
50
|
+
'--tabcontentshow-bg-color': 'darkgreen',
|
|
51
|
+
|
|
52
|
+
'--key-address-color': 'chocolate',
|
|
53
|
+
'--timestamp-color': 'aqua',
|
|
54
|
+
'--code-type-color': 'magenta',
|
|
55
|
+
'--code-variable-color': 'khaki',
|
|
56
|
+
'--code-store-color': 'greenyellow',
|
|
57
|
+
'--code-constant-color': 'red',
|
|
58
|
+
'--code-cons-color': 'hotpink',
|
|
59
|
+
'--code-comment-color': 'chocolate',
|
|
60
|
+
|
|
61
|
+
'--button-bg-color': '#FFF',
|
|
62
|
+
'--button-font-color': '#000',
|
|
63
|
+
|
|
64
|
+
/* Wallet colors */
|
|
65
|
+
'--applied-op-color': '#94b84d',
|
|
66
|
+
'--failed-op-color': '#d16864',
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const darkRules = `
|
|
70
|
+
button.editor-menu-btn:not([disabled]):hover {
|
|
71
|
+
color: var(--background-color);
|
|
72
|
+
background-color: #e8e8e8;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.right-submenu button,
|
|
76
|
+
.pretty-submenu button {
|
|
77
|
+
background-color: var(--primary-text-color);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
#outputPanel.empty-output {
|
|
81
|
+
background: rgba(30, 30, 30, .8) url(logo-transp.png) center/40% no-repeat;
|
|
82
|
+
background-blend-mode: color;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
#logo-image {
|
|
86
|
+
background: url(dm-logo.png) left/75% no-repeat;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.modal-content {
|
|
90
|
+
background-color: var(--menu-bg-color);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** XXX: url of svgs is different here than from stylesheet */
|
|
94
|
+
#editor-link {
|
|
95
|
+
background-image: url(./svgs/dm-terminal.svg);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
#wallet-link {
|
|
99
|
+
background-image: url(./svgs/wallet-light.svg);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
#faucet-link {
|
|
103
|
+
background-image: url(./svgs/dm-faucet.svg);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
#explorer-link {
|
|
107
|
+
background-image: url(./svgs/dm-search.svg);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
#node_explorer-link {
|
|
111
|
+
background-image: url(./svgs/dm-search.svg);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
#michelson-link {
|
|
115
|
+
background-image: url(./svgs/dm-stream.svg);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
#origination-link {
|
|
119
|
+
background-image: url(./svgs/dm-stream.svg);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
#help-link {
|
|
123
|
+
background-image: url(./svgs/dm-question.svg);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
#ledger-img {
|
|
127
|
+
background-image: url(./svgs/ledger-light.svg);
|
|
128
|
+
background-repeat: no-repeat;
|
|
129
|
+
}
|
|
130
|
+
`;
|
|
131
|
+
|
|
132
|
+
for (let k in darkTheme) {
|
|
133
|
+
rootElement.style.setProperty(k, darkTheme[k]);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
replaceRules(darkRules);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const activateLightMode = () => {
|
|
140
|
+
const rootElement = document.querySelector(':root');
|
|
141
|
+
const lightTheme = {
|
|
142
|
+
'--primary': '#006dcc',
|
|
143
|
+
'--primary-text-color': '#212529',
|
|
144
|
+
|
|
145
|
+
'--background-color': '#fafafa',
|
|
146
|
+
'--link-color': '#01608C',
|
|
147
|
+
'--button-hover-color': '#e8e8e8',
|
|
148
|
+
'--menu-bg-color': '#f1f1f1',
|
|
149
|
+
'--border-color': '#D3D3D3',
|
|
150
|
+
|
|
151
|
+
'--output-bgok': '#f1f1fa',
|
|
152
|
+
'--output-bgko': '#faf1f1',
|
|
153
|
+
|
|
154
|
+
'--danger-color': '#dc3545',
|
|
155
|
+
'--dataColumn-color': '#290075',
|
|
156
|
+
'--simulationBuilder-bg-color': '#f0fde1',
|
|
157
|
+
'--tabcontentshow-bg-color': '#ccffcc',
|
|
158
|
+
|
|
159
|
+
'--key-address-color': '#006600',
|
|
160
|
+
'--timestamp-color': '#6600AA',
|
|
161
|
+
'--code-type-color': '#331188',
|
|
162
|
+
'--code-variable-color': '#aa0000',
|
|
163
|
+
'--code-store-color': '#0000aa',
|
|
164
|
+
'--code-constant-color': '#000088',
|
|
165
|
+
'--code-cons-color': '#0000aa',
|
|
166
|
+
'--code-comment-color': '#006600',
|
|
167
|
+
|
|
168
|
+
'--button-bg-color': '#006dcc',
|
|
169
|
+
'--button-font-color': '#FFF',
|
|
170
|
+
|
|
171
|
+
/* Wallet colors */
|
|
172
|
+
'--applied-op-color': '#e8ffc2',
|
|
173
|
+
'--failed-op-color': '#ffcfbf',
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const lightRules = `button.editor-menu-btn:not([disabled]):hover {
|
|
177
|
+
color: var(--primary-text-color);
|
|
178
|
+
background-color: var(--background-color);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.right-submenu button,
|
|
182
|
+
.pretty-submenu button {
|
|
183
|
+
background-color: inherit;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
#outputPanel.empty-output {
|
|
187
|
+
background: rgba(255, 255, 255, .9) url(smartPY.only.transp.png) center/40% no-repeat;
|
|
188
|
+
background-blend-mode: color;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
#logo-image {
|
|
192
|
+
background: url(smartPY_horizon.transp.png) left/75% no-repeat;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.modal-content {
|
|
196
|
+
background-color: #fff;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/** XXX: url of svgs is different here than from stylesheet */
|
|
200
|
+
#editor-link {
|
|
201
|
+
background-image: url(./svgs/terminal.svg);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
#wallet-link {
|
|
205
|
+
background-image: url(./svgs/wallet-dark.svg);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
#faucet-link {
|
|
209
|
+
background-image: url(./svgs/faucet.svg);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
#explorer-link {
|
|
213
|
+
background-image: url(./svgs/search.svg);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
#node_explorer-link {
|
|
217
|
+
background-image: url(./svgs/search.svg);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
#michelson-link {
|
|
221
|
+
background-image: url(./svgs/stream.svg);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
#origination-link {
|
|
225
|
+
background-image: url(./svgs/stream.svg);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
#help-link {
|
|
229
|
+
background-image: url(./svgs/question.svg);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
#ledger-img {
|
|
233
|
+
background-image: url(./svgs/ledger-dark.svg);
|
|
234
|
+
background-repeat: no-repeat;
|
|
235
|
+
}
|
|
236
|
+
`;
|
|
237
|
+
|
|
238
|
+
for (let k in lightTheme) {
|
|
239
|
+
rootElement.style.setProperty(k, lightTheme[k]);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
replaceRules(lightRules);
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
const setThemeClass = (theme) => {
|
|
246
|
+
if (theme === 'dark') {
|
|
247
|
+
activateDarkMode();
|
|
248
|
+
} else {
|
|
249
|
+
activateLightMode();
|
|
250
|
+
}
|
|
251
|
+
};
|