@next-core/brick-kit 2.94.0 → 2.95.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/CHANGELOG.md +16 -0
- package/dist/index.bundle.js +281 -199
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +277 -195
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/StoryboardFunctionRegistryFactory.d.ts.map +1 -1
- package/dist/types/internal/devtools.d.ts +6 -0
- package/dist/types/internal/devtools.d.ts.map +1 -1
- package/dist/types/internal/evaluate.d.ts.map +1 -1
- package/dist/types/internal/getGeneralGlobals.d.ts +10 -0
- package/dist/types/internal/getGeneralGlobals.d.ts.map +1 -0
- package/dist/types/internal/proxyFactories.d.ts +3 -0
- package/dist/types/internal/proxyFactories.d.ts.map +1 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [2.95.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.94.0...@next-core/brick-kit@2.95.0) (2021-12-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* refine globals display in devtools ([6f42a1a](https://github.com/easyops-cn/next-core/commit/6f42a1ad37979a2dd6cdaabea8a55518131b35a9))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* refine storyboard functions and expressions ([6626c61](https://github.com/easyops-cn/next-core/commit/6626c61bd910864daaa81be946f765630cfb8103))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
# [2.94.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.93.1...@next-core/brick-kit@2.94.0) (2021-12-24)
|
|
7
23
|
|
|
8
24
|
|
package/dist/index.bundle.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('history'), require('@babel/runtime/helpers/objectSpread2'), require('@babel/runtime/helpers/objectWithoutProperties'), require('@babel/runtime/helpers/asyncToGenerator'), require('@babel/runtime/helpers/defineProperty'), require('react'), require('lodash'), require('@next-core/brick-utils'), require('@next-core/brick-http'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'history', '@babel/runtime/helpers/objectSpread2', '@babel/runtime/helpers/objectWithoutProperties', '@babel/runtime/helpers/asyncToGenerator', '@babel/runtime/helpers/defineProperty', 'react', 'lodash', '@next-core/brick-utils', '@next-core/brick-http', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BrickKit = {}, global.history$1, global._objectSpread, global._objectWithoutProperties, global._asyncToGenerator$4, global._defineProperty$1, global.React, global.lodash, global.brickUtils, global.brickHttp, global.
|
|
5
|
-
})(this, (function (exports, history$1, _objectSpread, _objectWithoutProperties, _asyncToGenerator$4, _defineProperty$1, React, lodash, brickUtils, brickHttp,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('history'), require('@babel/runtime/helpers/objectSpread2'), require('@babel/runtime/helpers/objectWithoutProperties'), require('@babel/runtime/helpers/asyncToGenerator'), require('@babel/runtime/helpers/defineProperty'), require('react'), require('lodash'), require('@next-core/brick-utils'), require('@next-core/brick-http'), require('moment'), require('@next-core/pipes'), require('i18next'), require('@next-core/easyops-analytics'), require('js-yaml'), require('antd'), require('@ant-design/icons'), require('react-i18next'), require('@babel/runtime/helpers/esm/extends'), require('@next-core/illustrations'), require('@babel/runtime/helpers/decorate')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'history', '@babel/runtime/helpers/objectSpread2', '@babel/runtime/helpers/objectWithoutProperties', '@babel/runtime/helpers/asyncToGenerator', '@babel/runtime/helpers/defineProperty', 'react', 'lodash', '@next-core/brick-utils', '@next-core/brick-http', 'moment', '@next-core/pipes', 'i18next', '@next-core/easyops-analytics', 'js-yaml', 'antd', '@ant-design/icons', 'react-i18next', '@babel/runtime/helpers/esm/extends', '@next-core/illustrations', '@babel/runtime/helpers/decorate'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BrickKit = {}, global.history$1, global._objectSpread, global._objectWithoutProperties, global._asyncToGenerator$4, global._defineProperty$1, global.React, global.lodash, global.brickUtils, global.brickHttp, global.moment, global.pipes, global.i18next, global.easyopsAnalytics, global.yaml, global.antd, global.icons, global.reactI18next, global._extends, global.illustrations, global._decorate));
|
|
5
|
+
})(this, (function (exports, history$1, _objectSpread, _objectWithoutProperties, _asyncToGenerator$4, _defineProperty$1, React, lodash, brickUtils, brickHttp, moment, pipes, i18next, easyopsAnalytics, yaml, antd, icons, reactI18next, _extends, illustrations, _decorate) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty$1);
|
|
13
13
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
14
14
|
var lodash__default = /*#__PURE__*/_interopDefaultLegacy(lodash);
|
|
15
|
-
var i18next__default = /*#__PURE__*/_interopDefaultLegacy(i18next);
|
|
16
15
|
var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
|
|
16
|
+
var i18next__default = /*#__PURE__*/_interopDefaultLegacy(i18next);
|
|
17
17
|
var yaml__default = /*#__PURE__*/_interopDefaultLegacy(yaml);
|
|
18
18
|
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
19
19
|
var _decorate__default = /*#__PURE__*/_interopDefaultLegacy(_decorate);
|
|
@@ -1158,7 +1158,6 @@
|
|
|
1158
1158
|
}
|
|
1159
1159
|
});
|
|
1160
1160
|
}
|
|
1161
|
-
|
|
1162
1161
|
function getDevHook() {
|
|
1163
1162
|
return window.__BRICK_NEXT_DEVTOOLS_HOOK__;
|
|
1164
1163
|
}
|
|
@@ -1169,6 +1168,90 @@
|
|
|
1169
1168
|
return (_getDevHook$restoreDe = (_getDevHook2 = getDevHook()) === null || _getDevHook2 === void 0 ? void 0 : _getDevHook2.restoreDehydrated(value)) !== null && _getDevHook$restoreDe !== void 0 ? _getDevHook$restoreDe : value;
|
|
1170
1169
|
}
|
|
1171
1170
|
|
|
1171
|
+
function getItemFactory(storageType) {
|
|
1172
|
+
return function (name) {
|
|
1173
|
+
var storage = storageType === "local" ? localStorage : sessionStorage;
|
|
1174
|
+
return JSON.parse(storage.getItem(name));
|
|
1175
|
+
};
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
var locale$7 = {
|
|
1179
|
+
[K.REQUEST_FAILED]: "Request Failed",
|
|
1180
|
+
[K.MODAL_OK]: "Ok",
|
|
1181
|
+
[K.MODAL_CANCEL]: "Cancel",
|
|
1182
|
+
[K.SOMETHING_WENT_WRONG]: "Something went wrong!",
|
|
1183
|
+
[K.LOGIN_TIMEOUT_MESSAGE]: "You haven't logged in or your login session has expired. Login right now?",
|
|
1184
|
+
[K.NETWORK_ERROR]: "Network error, please check your network."
|
|
1185
|
+
};
|
|
1186
|
+
var en = locale$7;
|
|
1187
|
+
|
|
1188
|
+
var locale$6 = {
|
|
1189
|
+
[K.REQUEST_FAILED]: "请求失败",
|
|
1190
|
+
[K.MODAL_OK]: "确认",
|
|
1191
|
+
[K.MODAL_CANCEL]: "取消",
|
|
1192
|
+
[K.SOMETHING_WENT_WRONG]: "出现了一些问题!",
|
|
1193
|
+
[K.LOGIN_TIMEOUT_MESSAGE]: "您还未登录或登录信息已过期,现在重新登录?",
|
|
1194
|
+
[K.NETWORK_ERROR]: "网络错误,请检查您的网络连接。"
|
|
1195
|
+
};
|
|
1196
|
+
var zh = locale$6;
|
|
1197
|
+
|
|
1198
|
+
/** @internal */
|
|
1199
|
+
|
|
1200
|
+
var initI18n = () => {
|
|
1201
|
+
i18next__default["default"].addResourceBundle("en", NS_BRICK_KIT, en);
|
|
1202
|
+
i18next__default["default"].addResourceBundle("zh", NS_BRICK_KIT, zh);
|
|
1203
|
+
};
|
|
1204
|
+
/** @internal */
|
|
1205
|
+
|
|
1206
|
+
function getI18nNamespace(type, id) {
|
|
1207
|
+
return "$".concat(type, "-").concat(id);
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
function registerWidgetI18n(widgetId, i18n) {
|
|
1211
|
+
var ns = getI18nNamespace("widget", widgetId);
|
|
1212
|
+
Object.entries(i18n).forEach(_ref => {
|
|
1213
|
+
var [lang, resources] = _ref;
|
|
1214
|
+
i18next__default["default"].addResourceBundle(lang, ns, resources);
|
|
1215
|
+
});
|
|
1216
|
+
}
|
|
1217
|
+
function widgetI18nFactory(widgetId) {
|
|
1218
|
+
return i18next.getFixedT(null, getI18nNamespace("widget", widgetId));
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
function i18nText(data) {
|
|
1222
|
+
var _i18next$language;
|
|
1223
|
+
|
|
1224
|
+
if (!data) {
|
|
1225
|
+
return;
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
var language = (_i18next$language = i18next__default["default"].language) !== null && _i18next$language !== void 0 ? _i18next$language : "zh-CN"; // First, make a perfect match.
|
|
1229
|
+
|
|
1230
|
+
if (brickUtils.hasOwnProperty(data, language)) {
|
|
1231
|
+
return data[language];
|
|
1232
|
+
} // https://en.wikipedia.org/wiki/IETF_language_tag
|
|
1233
|
+
|
|
1234
|
+
|
|
1235
|
+
var primaryLanguage = language.split("-")[0];
|
|
1236
|
+
|
|
1237
|
+
if (primaryLanguage !== language) {
|
|
1238
|
+
// Then, match the primary language (which omits other subtags).
|
|
1239
|
+
// E.g., match `zh` if the current language is `zh-CN`.
|
|
1240
|
+
return brickUtils.hasOwnProperty(data, primaryLanguage) ? data[primaryLanguage] : undefined;
|
|
1241
|
+
} // At last, match the first key which starts with the primary language,
|
|
1242
|
+
// if the current language contains primary subtag only.
|
|
1243
|
+
// E.g., match `zh-CN` if the current language is `zh`.
|
|
1244
|
+
|
|
1245
|
+
|
|
1246
|
+
var prefix = "".concat(primaryLanguage, "-");
|
|
1247
|
+
|
|
1248
|
+
for (var key of Object.keys(data)) {
|
|
1249
|
+
if (key.startsWith(prefix)) {
|
|
1250
|
+
return data[key];
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1172
1255
|
function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1173
1256
|
try {
|
|
1174
1257
|
var info = gen[key](arg);
|
|
@@ -1381,88 +1464,68 @@
|
|
|
1381
1464
|
permissionMap.clear();
|
|
1382
1465
|
}
|
|
1383
1466
|
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
};
|
|
1389
|
-
}
|
|
1467
|
+
// `GeneralGlobals` are globals which are page-state-agnostic,
|
|
1468
|
+
// thus they can be used both in storyboard expressions and functions.
|
|
1469
|
+
function getGeneralGlobals(attemptToVisitGlobals, options) {
|
|
1470
|
+
var globalVariables = {};
|
|
1390
1471
|
|
|
1391
|
-
|
|
1392
|
-
|
|
1472
|
+
for (var variableName of attemptToVisitGlobals) {
|
|
1473
|
+
var variable = getIndividualGlobal(variableName, options);
|
|
1393
1474
|
|
|
1394
|
-
|
|
1395
|
-
|
|
1475
|
+
if (variable !== undefined) {
|
|
1476
|
+
globalVariables[variableName] = variable;
|
|
1477
|
+
}
|
|
1396
1478
|
}
|
|
1397
1479
|
|
|
1398
|
-
|
|
1480
|
+
return globalVariables;
|
|
1481
|
+
}
|
|
1399
1482
|
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1483
|
+
function getIndividualGlobal(variableName, _ref) {
|
|
1484
|
+
var {
|
|
1485
|
+
collectCoverage,
|
|
1486
|
+
widgetId,
|
|
1487
|
+
app,
|
|
1488
|
+
storyboardFunctions
|
|
1489
|
+
} = _ref;
|
|
1403
1490
|
|
|
1491
|
+
switch (variableName) {
|
|
1492
|
+
case "BASE_URL":
|
|
1493
|
+
return collectCoverage ? "/next" : getBasePath().replace(/\/$/, "");
|
|
1404
1494
|
|
|
1405
|
-
|
|
1495
|
+
case "FN":
|
|
1496
|
+
return storyboardFunctions;
|
|
1406
1497
|
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
// E.g., match `zh` if the current language is `zh-CN`.
|
|
1410
|
-
return brickUtils.hasOwnProperty(data, primaryLanguage) ? data[primaryLanguage] : undefined;
|
|
1411
|
-
} // At last, match the first key which starts with the primary language,
|
|
1412
|
-
// if the current language contains primary subtag only.
|
|
1413
|
-
// E.g., match `zh-CN` if the current language is `zh`.
|
|
1498
|
+
case "IMG":
|
|
1499
|
+
return collectCoverage ? fakeImageFactory() : widgetId ? widgetImagesFactory(widgetId) : imagesFactory(app.id, app.isBuildPush);
|
|
1414
1500
|
|
|
1501
|
+
case "I18N":
|
|
1502
|
+
return collectCoverage ? lodash.identity : widgetId ? widgetI18nFactory(widgetId) : i18next.getFixedT(null, getI18nNamespace("app", app.id));
|
|
1415
1503
|
|
|
1416
|
-
|
|
1504
|
+
case "I18N_TEXT":
|
|
1505
|
+
return collectCoverage ? fakeI18nText : i18nText;
|
|
1417
1506
|
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1507
|
+
case "PERMISSIONS":
|
|
1508
|
+
return {
|
|
1509
|
+
check: collectCoverage ? fakeCheckPermissions : checkPermissions
|
|
1510
|
+
};
|
|
1422
1511
|
}
|
|
1423
1512
|
}
|
|
1424
1513
|
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
[K.MODAL_CANCEL]: "Cancel",
|
|
1429
|
-
[K.SOMETHING_WENT_WRONG]: "Something went wrong!",
|
|
1430
|
-
[K.LOGIN_TIMEOUT_MESSAGE]: "You haven't logged in or your login session has expired. Login right now?",
|
|
1431
|
-
[K.NETWORK_ERROR]: "Network error, please check your network."
|
|
1432
|
-
};
|
|
1433
|
-
var en = locale$7;
|
|
1434
|
-
|
|
1435
|
-
var locale$6 = {
|
|
1436
|
-
[K.REQUEST_FAILED]: "请求失败",
|
|
1437
|
-
[K.MODAL_OK]: "确认",
|
|
1438
|
-
[K.MODAL_CANCEL]: "取消",
|
|
1439
|
-
[K.SOMETHING_WENT_WRONG]: "出现了一些问题!",
|
|
1440
|
-
[K.LOGIN_TIMEOUT_MESSAGE]: "您还未登录或登录信息已过期,现在重新登录?",
|
|
1441
|
-
[K.NETWORK_ERROR]: "网络错误,请检查您的网络连接。"
|
|
1442
|
-
};
|
|
1443
|
-
var zh = locale$6;
|
|
1444
|
-
|
|
1445
|
-
/** @internal */
|
|
1514
|
+
function fakeI18nText(data) {
|
|
1515
|
+
return data === null || data === void 0 ? void 0 : data.en;
|
|
1516
|
+
}
|
|
1446
1517
|
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1518
|
+
function fakeImageFactory() {
|
|
1519
|
+
return {
|
|
1520
|
+
get(name) {
|
|
1521
|
+
return "mock/images/".concat(name);
|
|
1522
|
+
}
|
|
1452
1523
|
|
|
1453
|
-
|
|
1454
|
-
return "$".concat(type, "-").concat(id);
|
|
1524
|
+
};
|
|
1455
1525
|
}
|
|
1456
1526
|
|
|
1457
|
-
function
|
|
1458
|
-
|
|
1459
|
-
Object.entries(i18n).forEach(_ref => {
|
|
1460
|
-
var [lang, resources] = _ref;
|
|
1461
|
-
i18next__default["default"].addResourceBundle(lang, ns, resources);
|
|
1462
|
-
});
|
|
1463
|
-
}
|
|
1464
|
-
function widgetI18nFactory(widgetId) {
|
|
1465
|
-
return i18next.getFixedT(null, getI18nNamespace("widget", widgetId));
|
|
1527
|
+
function fakeCheckPermissions() {
|
|
1528
|
+
return true;
|
|
1466
1529
|
}
|
|
1467
1530
|
|
|
1468
1531
|
/** @internal */
|
|
@@ -1481,29 +1544,11 @@
|
|
|
1481
1544
|
}
|
|
1482
1545
|
|
|
1483
1546
|
});
|
|
1484
|
-
|
|
1485
|
-
var builtinSupply = _objectSpread__default["default"]({
|
|
1486
|
-
// Functions can call other functions.
|
|
1487
|
-
FN: storyboardFunctions
|
|
1488
|
-
}, collectCoverage ? {
|
|
1489
|
-
// Fake builtin methods for tests.
|
|
1490
|
-
I18N: lodash.identity,
|
|
1491
|
-
I18N_TEXT: fakeI18nText,
|
|
1492
|
-
IMG: fakeImageFactory()
|
|
1493
|
-
} : widgetId ? {
|
|
1494
|
-
I18N: widgetI18nFactory(widgetId),
|
|
1495
|
-
I18N_TEXT: i18nText,
|
|
1496
|
-
IMG: widgetImagesFactory(widgetId)
|
|
1497
|
-
} : {
|
|
1498
|
-
I18N_TEXT: i18nText
|
|
1499
|
-
});
|
|
1547
|
+
var currentApp;
|
|
1500
1548
|
|
|
1501
1549
|
function registerStoryboardFunctions(functions, app) {
|
|
1502
1550
|
if (app) {
|
|
1503
|
-
|
|
1504
|
-
I18N: i18next.getFixedT(null, getI18nNamespace("app", app.id)),
|
|
1505
|
-
IMG: imagesFactory(app.id, app.isBuildPush)
|
|
1506
|
-
});
|
|
1551
|
+
currentApp = app;
|
|
1507
1552
|
}
|
|
1508
1553
|
|
|
1509
1554
|
registeredFunctions.clear();
|
|
@@ -1545,7 +1590,12 @@
|
|
|
1545
1590
|
rules: {
|
|
1546
1591
|
noVar: true
|
|
1547
1592
|
},
|
|
1548
|
-
globalVariables: supply(precooked.attemptToVisitGlobals,
|
|
1593
|
+
globalVariables: supply(precooked.attemptToVisitGlobals, getGeneralGlobals(precooked.attemptToVisitGlobals, {
|
|
1594
|
+
collectCoverage,
|
|
1595
|
+
widgetId,
|
|
1596
|
+
app: currentApp,
|
|
1597
|
+
storyboardFunctions
|
|
1598
|
+
})),
|
|
1549
1599
|
hooks: collector && {
|
|
1550
1600
|
beforeEvaluate: collector.beforeEvaluate,
|
|
1551
1601
|
beforeCall: collector.beforeCall,
|
|
@@ -1570,19 +1620,6 @@
|
|
|
1570
1620
|
};
|
|
1571
1621
|
}
|
|
1572
1622
|
|
|
1573
|
-
function fakeI18nText(data) {
|
|
1574
|
-
return data === null || data === void 0 ? void 0 : data.en;
|
|
1575
|
-
}
|
|
1576
|
-
|
|
1577
|
-
function fakeImageFactory() {
|
|
1578
|
-
return {
|
|
1579
|
-
get(name) {
|
|
1580
|
-
return "mock/images/".concat(name);
|
|
1581
|
-
}
|
|
1582
|
-
|
|
1583
|
-
};
|
|
1584
|
-
}
|
|
1585
|
-
|
|
1586
1623
|
var {
|
|
1587
1624
|
storyboardFunctions,
|
|
1588
1625
|
registerStoryboardFunctions
|
|
@@ -1611,6 +1648,39 @@
|
|
|
1611
1648
|
registerStoryboardFunctions(functions);
|
|
1612
1649
|
}
|
|
1613
1650
|
|
|
1651
|
+
var THROW = () => {
|
|
1652
|
+
throw new Error("Can't modify read-only proxy object");
|
|
1653
|
+
};
|
|
1654
|
+
|
|
1655
|
+
var readOnlyHandler = {
|
|
1656
|
+
set: THROW,
|
|
1657
|
+
defineProperty: THROW,
|
|
1658
|
+
deleteProperty: THROW,
|
|
1659
|
+
setPrototypeOf: THROW
|
|
1660
|
+
};
|
|
1661
|
+
function getReadOnlyProxy(object) {
|
|
1662
|
+
return new Proxy(object, readOnlyHandler);
|
|
1663
|
+
} // First, we want to make accessing property of globals lazy,
|
|
1664
|
+
// So we use *Proxy* to make a dynamic accessor for each of these globals.
|
|
1665
|
+
// But we also want to keep them working in devtools.
|
|
1666
|
+
|
|
1667
|
+
function getDynamicReadOnlyProxy(_ref) {
|
|
1668
|
+
var {
|
|
1669
|
+
get,
|
|
1670
|
+
ownKeys
|
|
1671
|
+
} = _ref;
|
|
1672
|
+
|
|
1673
|
+
if (getDevHook()) {
|
|
1674
|
+
// In devtools, we extract them at beginning.
|
|
1675
|
+
var target = Object.fromEntries(ownKeys(null).map(key => [key, get(null, key, null)]));
|
|
1676
|
+
return getReadOnlyProxy(target);
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
return new Proxy(Object.freeze({}), {
|
|
1680
|
+
get
|
|
1681
|
+
});
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1614
1684
|
var symbolForRaw = Symbol.for("pre.evaluated.raw");
|
|
1615
1685
|
var symbolForContext = Symbol.for("pre.evaluated.context");
|
|
1616
1686
|
function isPreEvaluated(raw) {
|
|
@@ -1728,130 +1798,142 @@
|
|
|
1728
1798
|
|
|
1729
1799
|
var app = (_runtimeContext$overr = runtimeContext.overrideApp) !== null && _runtimeContext$overr !== void 0 ? _runtimeContext$overr : currentApp;
|
|
1730
1800
|
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1801
|
+
function getIndividualGlobal(variableName) {
|
|
1802
|
+
switch (variableName) {
|
|
1803
|
+
case "ALIAS":
|
|
1804
|
+
return {
|
|
1805
|
+
getUrl: getUrlByAliasFactory(app)
|
|
1806
|
+
};
|
|
1734
1807
|
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
}
|
|
1808
|
+
case "ANCHOR":
|
|
1809
|
+
return hash ? hash.substr(1) : null;
|
|
1738
1810
|
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
}
|
|
1811
|
+
case "APP":
|
|
1812
|
+
return lodash.cloneDeep(app);
|
|
1742
1813
|
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1814
|
+
case "CTX":
|
|
1815
|
+
return getDynamicReadOnlyProxy({
|
|
1816
|
+
get(target, key) {
|
|
1817
|
+
var _item$brick$element;
|
|
1746
1818
|
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1819
|
+
var item = storyboardContext.get(key);
|
|
1820
|
+
return !item ? item : item.type === "brick-property" ? (_item$brick$element = item.brick.element) === null || _item$brick$element === void 0 ? void 0 : _item$brick$element[item.prop] : item.value;
|
|
1821
|
+
},
|
|
1750
1822
|
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1823
|
+
ownKeys() {
|
|
1824
|
+
return Array.from(storyboardContext.keys());
|
|
1825
|
+
}
|
|
1754
1826
|
|
|
1755
|
-
|
|
1756
|
-
globalVariables.FLAGS = lodash.cloneDeep(flags);
|
|
1757
|
-
}
|
|
1827
|
+
});
|
|
1758
1828
|
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
}
|
|
1829
|
+
case "FLAGS":
|
|
1830
|
+
return getReadOnlyProxy(flags);
|
|
1762
1831
|
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
}
|
|
1832
|
+
case "HASH":
|
|
1833
|
+
return hash;
|
|
1766
1834
|
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
}
|
|
1835
|
+
case "INSTALLED_APPS":
|
|
1836
|
+
return {
|
|
1837
|
+
has: (appId, matchVersion) => getRuntime().hasInstalledApp(appId, matchVersion)
|
|
1838
|
+
};
|
|
1772
1839
|
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
}
|
|
1840
|
+
case "LOCAL_STORAGE":
|
|
1841
|
+
return {
|
|
1842
|
+
getItem: getItemFactory("local")
|
|
1843
|
+
};
|
|
1778
1844
|
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
}
|
|
1845
|
+
case "MISC":
|
|
1846
|
+
return getRuntime().getMiscSettings();
|
|
1782
1847
|
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
}
|
|
1848
|
+
case "PARAMS":
|
|
1849
|
+
return new URLSearchParams(query);
|
|
1786
1850
|
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
}
|
|
1851
|
+
case "PATH":
|
|
1852
|
+
return getReadOnlyProxy(match.params);
|
|
1790
1853
|
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1854
|
+
case "PROCESSORS":
|
|
1855
|
+
return getDynamicReadOnlyProxy({
|
|
1856
|
+
get(target, key) {
|
|
1857
|
+
var pkg = customProcessorRegistry.get(key);
|
|
1858
|
+
return pkg ? getDynamicReadOnlyProxy({
|
|
1859
|
+
get(t, k) {
|
|
1860
|
+
return pkg.get(k);
|
|
1861
|
+
},
|
|
1794
1862
|
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1863
|
+
ownKeys() {
|
|
1864
|
+
return Array.from(pkg.keys());
|
|
1865
|
+
}
|
|
1798
1866
|
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
var _item$brick$element;
|
|
1867
|
+
}) : pkg;
|
|
1868
|
+
},
|
|
1802
1869
|
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
}
|
|
1870
|
+
ownKeys() {
|
|
1871
|
+
return Array.from(customProcessorRegistry.keys());
|
|
1872
|
+
}
|
|
1807
1873
|
|
|
1808
|
-
|
|
1809
|
-
globalVariables.PROCESSORS = Object.fromEntries(Array.from(customProcessorRegistry.entries()).map(_ref2 => {
|
|
1810
|
-
var [namespace, registry] = _ref2;
|
|
1811
|
-
return [namespace, Object.fromEntries(registry.entries())];
|
|
1812
|
-
}));
|
|
1813
|
-
}
|
|
1874
|
+
});
|
|
1814
1875
|
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1876
|
+
case "QUERY":
|
|
1877
|
+
return getDynamicReadOnlyProxy({
|
|
1878
|
+
get(target, key) {
|
|
1879
|
+
return query.get(key);
|
|
1880
|
+
},
|
|
1820
1881
|
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
};
|
|
1825
|
-
}
|
|
1882
|
+
ownKeys() {
|
|
1883
|
+
return Array.from(query.keys());
|
|
1884
|
+
}
|
|
1826
1885
|
|
|
1827
|
-
|
|
1828
|
-
globalVariables.SESSION_STORAGE = {
|
|
1829
|
-
getItem: getItemFactory("session")
|
|
1830
|
-
};
|
|
1831
|
-
}
|
|
1886
|
+
});
|
|
1832
1887
|
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1888
|
+
case "QUERY_ARRAY":
|
|
1889
|
+
return getDynamicReadOnlyProxy({
|
|
1890
|
+
get(target, key) {
|
|
1891
|
+
return query.getAll(key);
|
|
1892
|
+
},
|
|
1838
1893
|
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1894
|
+
ownKeys() {
|
|
1895
|
+
return Array.from(query.keys());
|
|
1896
|
+
}
|
|
1842
1897
|
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1898
|
+
});
|
|
1899
|
+
|
|
1900
|
+
case "SEGUE":
|
|
1901
|
+
return {
|
|
1902
|
+
getUrl: getUrlBySegueFactory(app, segues)
|
|
1903
|
+
};
|
|
1904
|
+
|
|
1905
|
+
case "SESSION_STORAGE":
|
|
1906
|
+
return {
|
|
1907
|
+
getItem: getItemFactory("session")
|
|
1908
|
+
};
|
|
1909
|
+
|
|
1910
|
+
case "SYS":
|
|
1911
|
+
return getReadOnlyProxy(sys);
|
|
1912
|
+
|
|
1913
|
+
case "__WIDGET_FN__":
|
|
1914
|
+
return widgetFunctions;
|
|
1846
1915
|
|
|
1847
|
-
|
|
1848
|
-
|
|
1916
|
+
case "__WIDGET_IMG__":
|
|
1917
|
+
return widgetImagesFactory;
|
|
1918
|
+
|
|
1919
|
+
case "__WIDGET_I18N__":
|
|
1920
|
+
return widgetI18nFactory;
|
|
1921
|
+
}
|
|
1849
1922
|
}
|
|
1850
1923
|
|
|
1851
|
-
|
|
1852
|
-
|
|
1924
|
+
for (var variableName of attemptToVisitGlobals) {
|
|
1925
|
+
var variable = getIndividualGlobal(variableName);
|
|
1926
|
+
|
|
1927
|
+
if (variable !== undefined) {
|
|
1928
|
+
globalVariables[variableName] = variable;
|
|
1929
|
+
}
|
|
1853
1930
|
}
|
|
1854
1931
|
|
|
1932
|
+
Object.assign(globalVariables, getGeneralGlobals(precooked.attemptToVisitGlobals, {
|
|
1933
|
+
storyboardFunctions,
|
|
1934
|
+
app
|
|
1935
|
+
}));
|
|
1936
|
+
|
|
1855
1937
|
try {
|
|
1856
1938
|
var result = brickUtils.cook(precooked.expression, precooked.source, {
|
|
1857
1939
|
globalVariables: supply(precooked.attemptToVisitGlobals, globalVariables)
|