@next-core/brick-kit 2.71.0 → 2.72.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 +11 -0
- package/dist/index.bundle.js +61 -39
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +61 -40
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/StoryboardFunctionRegistryFactory.d.ts +17 -0
- package/dist/types/core/StoryboardFunctionRegistryFactory.d.ts.map +1 -0
- package/dist/types/core/StoryboardFunctions.d.ts +1 -5
- package/dist/types/core/StoryboardFunctions.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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.72.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.71.0...@next-core/brick-kit@2.72.0) (2021-09-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* expose StoryboardFunctionRegistryFactory ([c7079e8](https://github.com/easyops-cn/next-core/commit/c7079e838a37350264ca3bf210527e1b09a542f7))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [2.71.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.70.4...@next-core/brick-kit@2.71.0) (2021-09-23)
|
|
7
18
|
|
|
8
19
|
|
package/dist/index.bundle.js
CHANGED
|
@@ -2321,58 +2321,77 @@
|
|
|
2321
2321
|
}
|
|
2322
2322
|
}
|
|
2323
2323
|
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2324
|
+
/** @internal */
|
|
2325
|
+
|
|
2326
|
+
/** @internal */
|
|
2327
|
+
function StoryboardFunctionRegistryFactory() {
|
|
2328
|
+
var registeredFunctions = new Map(); // Use `Proxy` with a frozen target, to make a readonly function registry.
|
|
2329
|
+
|
|
2330
|
+
var storyboardFunctions = new Proxy(Object.freeze({}), {
|
|
2331
|
+
get(target, key) {
|
|
2332
|
+
return getStoryboardFunction(key);
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2335
|
+
});
|
|
2336
|
+
|
|
2337
|
+
function registerStoryboardFunctions(functions) {
|
|
2338
|
+
registeredFunctions.clear();
|
|
2339
|
+
|
|
2340
|
+
if (Array.isArray(functions)) {
|
|
2341
|
+
for (var fn of functions) {
|
|
2342
|
+
registeredFunctions.set(fn.name, {
|
|
2343
|
+
source: fn.source,
|
|
2344
|
+
typescript: fn.typescript
|
|
2345
|
+
});
|
|
2346
|
+
}
|
|
2347
|
+
}
|
|
2329
2348
|
}
|
|
2330
2349
|
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
var _storyboard$meta;
|
|
2350
|
+
function getStoryboardFunction(name) {
|
|
2351
|
+
var fn = registeredFunctions.get(name);
|
|
2334
2352
|
|
|
2335
|
-
|
|
2353
|
+
if (!fn) {
|
|
2354
|
+
return undefined;
|
|
2355
|
+
}
|
|
2336
2356
|
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
registeredFunctions.set(fn.name, {
|
|
2340
|
-
source: fn.source,
|
|
2357
|
+
if (!fn.processed) {
|
|
2358
|
+
var precooked = brickUtils.precookFunction(fn.source, {
|
|
2341
2359
|
typescript: fn.typescript
|
|
2342
2360
|
});
|
|
2361
|
+
fn.cooked = brickUtils.cook(precooked.function, fn.source, {
|
|
2362
|
+
rules: {
|
|
2363
|
+
noVar: true
|
|
2364
|
+
},
|
|
2365
|
+
globalVariables: supply(precooked.attemptToVisitGlobals, {
|
|
2366
|
+
// Functions can call other functions.
|
|
2367
|
+
FN: storyboardFunctions
|
|
2368
|
+
})
|
|
2369
|
+
});
|
|
2370
|
+
fn.processed = true;
|
|
2343
2371
|
}
|
|
2344
|
-
}
|
|
2345
|
-
}
|
|
2346
|
-
function getStoryboardFunctions() {
|
|
2347
|
-
return storyboardFunctions;
|
|
2348
|
-
}
|
|
2349
|
-
|
|
2350
|
-
function getStoryboardFunction(name) {
|
|
2351
|
-
var fn = registeredFunctions.get(name);
|
|
2352
2372
|
|
|
2353
|
-
|
|
2354
|
-
throw new ReferenceError("Function not found: ".concat(name));
|
|
2373
|
+
return fn.cooked;
|
|
2355
2374
|
}
|
|
2356
2375
|
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2376
|
+
function updateStoryboardFunction(name, data) {
|
|
2377
|
+
registeredFunctions.set(name, {
|
|
2378
|
+
source: data.source,
|
|
2379
|
+
typescript: data.typescript
|
|
2360
2380
|
});
|
|
2361
|
-
fn.cooked = brickUtils.cook(precooked.function, fn.source, {
|
|
2362
|
-
rules: {
|
|
2363
|
-
noVar: true
|
|
2364
|
-
},
|
|
2365
|
-
globalVariables: supply(precooked.attemptToVisitGlobals, {
|
|
2366
|
-
// Functions can call other functions.
|
|
2367
|
-
FN: storyboardFunctions
|
|
2368
|
-
})
|
|
2369
|
-
});
|
|
2370
|
-
fn.processed = true;
|
|
2371
2381
|
}
|
|
2372
2382
|
|
|
2373
|
-
return
|
|
2383
|
+
return {
|
|
2384
|
+
storyboardFunctions,
|
|
2385
|
+
registerStoryboardFunctions,
|
|
2386
|
+
updateStoryboardFunction
|
|
2387
|
+
};
|
|
2374
2388
|
}
|
|
2375
2389
|
|
|
2390
|
+
var {
|
|
2391
|
+
storyboardFunctions,
|
|
2392
|
+
registerStoryboardFunctions
|
|
2393
|
+
} = StoryboardFunctionRegistryFactory();
|
|
2394
|
+
|
|
2376
2395
|
var symbolForRaw = Symbol.for("pre.evaluated.raw");
|
|
2377
2396
|
var symbolForContext = Symbol.for("pre.evaluated.context");
|
|
2378
2397
|
function isPreEvaluated(raw) {
|
|
@@ -2588,7 +2607,7 @@
|
|
|
2588
2607
|
}
|
|
2589
2608
|
|
|
2590
2609
|
if (attemptToVisitGlobals.has("FN")) {
|
|
2591
|
-
globalVariables.FN =
|
|
2610
|
+
globalVariables.FN = storyboardFunctions;
|
|
2592
2611
|
}
|
|
2593
2612
|
|
|
2594
2613
|
try {
|
|
@@ -8586,6 +8605,8 @@
|
|
|
8586
8605
|
var storyboard = locationContext.matchStoryboard(_this3.kernel.bootstrapData.storyboards);
|
|
8587
8606
|
|
|
8588
8607
|
if (storyboard) {
|
|
8608
|
+
var _storyboard$meta;
|
|
8609
|
+
|
|
8589
8610
|
yield _this3.kernel.fulfilStoryboard(storyboard); // 将动态解析后的模板还原,以便重新动态解析。
|
|
8590
8611
|
|
|
8591
8612
|
brickUtils.restoreDynamicTemplates(storyboard); // 预加载权限信息
|
|
@@ -8601,7 +8622,7 @@
|
|
|
8601
8622
|
|
|
8602
8623
|
_this3.kernel.registerCustomTemplatesInStoryboard(storyboard);
|
|
8603
8624
|
|
|
8604
|
-
registerStoryboardFunctions(storyboard);
|
|
8625
|
+
registerStoryboardFunctions((_storyboard$meta = storyboard.meta) === null || _storyboard$meta === void 0 ? void 0 : _storyboard$meta.functions);
|
|
8605
8626
|
}
|
|
8606
8627
|
|
|
8607
8628
|
var {
|
|
@@ -10670,6 +10691,7 @@
|
|
|
10670
10691
|
exports.ForwardRefSingleBrickAsComponent = ForwardRefSingleBrickAsComponent;
|
|
10671
10692
|
exports.ModalElement = ModalElement;
|
|
10672
10693
|
exports.SingleBrickAsComponent = SingleBrickAsComponent;
|
|
10694
|
+
exports.StoryboardFunctionRegistryFactory = StoryboardFunctionRegistryFactory;
|
|
10673
10695
|
exports.UpdatingElement = UpdatingElement;
|
|
10674
10696
|
exports.authenticate = authenticate;
|
|
10675
10697
|
exports.checkIf = checkIf;
|