@next-core/runtime 1.57.0 → 1.57.2

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.
Files changed (64) hide show
  1. package/dist/cjs/internal/CustomTemplates/setupTemplateProxy.js +1 -1
  2. package/dist/cjs/internal/CustomTemplates/setupTemplateProxy.js.map +1 -1
  3. package/dist/cjs/internal/Renderer.js +38 -8
  4. package/dist/cjs/internal/Renderer.js.map +1 -1
  5. package/dist/cjs/internal/interfaces.js.map +1 -1
  6. package/dist/cjs/internal/secret_internals.js +2 -9
  7. package/dist/cjs/internal/secret_internals.js.map +1 -1
  8. package/dist/esm/CustomTemplates.js +11 -7
  9. package/dist/esm/CustomTemplates.js.map +1 -1
  10. package/dist/esm/ModalStack.js +2 -1
  11. package/dist/esm/ModalStack.js.map +1 -1
  12. package/dist/esm/StoryboardFunctionRegistry.js +2 -1
  13. package/dist/esm/StoryboardFunctionRegistry.js.map +1 -1
  14. package/dist/esm/createRoot.js +4 -4
  15. package/dist/esm/createRoot.js.map +1 -1
  16. package/dist/esm/internal/CustomTemplates/bindTemplateProxy.js +5 -4
  17. package/dist/esm/internal/CustomTemplates/bindTemplateProxy.js.map +1 -1
  18. package/dist/esm/internal/CustomTemplates/expandCustomTemplate.js +3 -2
  19. package/dist/esm/internal/CustomTemplates/expandCustomTemplate.js.map +1 -1
  20. package/dist/esm/internal/CustomTemplates/replaceSlotWithSlottedBricks.js +5 -4
  21. package/dist/esm/internal/CustomTemplates/replaceSlotWithSlottedBricks.js.map +1 -1
  22. package/dist/esm/internal/CustomTemplates/setupTemplateProxy.js +7 -6
  23. package/dist/esm/internal/CustomTemplates/setupTemplateProxy.js.map +1 -1
  24. package/dist/esm/internal/CustomTemplates/setupUseBrickInTemplate.js +3 -2
  25. package/dist/esm/internal/CustomTemplates/setupUseBrickInTemplate.js.map +1 -1
  26. package/dist/esm/internal/CustomTemplates/utils.js +3 -3
  27. package/dist/esm/internal/CustomTemplates/utils.js.map +1 -1
  28. package/dist/esm/internal/ErrorNode.js +2 -1
  29. package/dist/esm/internal/ErrorNode.js.map +1 -1
  30. package/dist/esm/internal/FormRenderer/expandFormRenderer.js +3 -3
  31. package/dist/esm/internal/FormRenderer/expandFormRenderer.js.map +1 -1
  32. package/dist/esm/internal/FormRenderer/utils.js +2 -2
  33. package/dist/esm/internal/FormRenderer/utils.js.map +1 -1
  34. package/dist/esm/internal/Renderer.js +58 -22
  35. package/dist/esm/internal/Renderer.js.map +1 -1
  36. package/dist/esm/internal/RendererContext.js +10 -8
  37. package/dist/esm/internal/RendererContext.js.map +1 -1
  38. package/dist/esm/internal/Runtime.js +15 -16
  39. package/dist/esm/internal/Runtime.js.map +1 -1
  40. package/dist/esm/internal/bindListeners.js +3 -2
  41. package/dist/esm/internal/bindListeners.js.map +1 -1
  42. package/dist/esm/internal/compute/evaluate.js +4 -4
  43. package/dist/esm/internal/compute/evaluate.js.map +1 -1
  44. package/dist/esm/internal/compute/getStorageItem.js +2 -1
  45. package/dist/esm/internal/compute/getStorageItem.js.map +1 -1
  46. package/dist/esm/internal/compute/listenOnTrackingContext.js +2 -1
  47. package/dist/esm/internal/compute/listenOnTrackingContext.js.map +1 -1
  48. package/dist/esm/internal/data/resolveDataStore.js +4 -2
  49. package/dist/esm/internal/data/resolveDataStore.js.map +1 -1
  50. package/dist/esm/internal/interfaces.js.map +1 -1
  51. package/dist/esm/internal/matchStoryboard.js +2 -2
  52. package/dist/esm/internal/matchStoryboard.js.map +1 -1
  53. package/dist/esm/internal/poll.js +3 -3
  54. package/dist/esm/internal/poll.js.map +1 -1
  55. package/dist/esm/internal/secret_internals.js +10 -16
  56. package/dist/esm/internal/secret_internals.js.map +1 -1
  57. package/dist/esm/internal/setupRootRuntimeContext.js +3 -2
  58. package/dist/esm/internal/setupRootRuntimeContext.js.map +1 -1
  59. package/dist/esm/setWatermark.js +4 -4
  60. package/dist/esm/setWatermark.js.map +1 -1
  61. package/dist/esm/themeAndMode.js +2 -1
  62. package/dist/esm/themeAndMode.js.map +1 -1
  63. package/dist/types/internal/interfaces.d.ts +1 -0
  64. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","names":[],"sources":["../../../src/internal/interfaces.ts"],"sourcesContent":["import type { LegacyCompatibleRuntimeContext } from \"@next-core/inject\";\nimport type {\n BrickEventHandler,\n BrickEventsMap,\n CustomTemplate,\n RouteConf,\n RuntimeSnippet,\n CustomTemplateProxy,\n CustomTemplateProxyBasicProperty,\n CustomTemplateProxySlot,\n SlotsConfOfBricks,\n Storyboard,\n StaticMenuConf,\n UseProviderResolveConf,\n MicroApp,\n} from \"@next-core/types\";\nimport type { DataStore } from \"./data/DataStore.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { RuntimeBrickConfWithTplSymbols } from \"./CustomTemplates/constants.js\";\nimport { RuntimeBrickConfOfFormSymbols } from \"./FormRenderer/constants.js\";\n\nexport interface RuntimeContext extends LegacyCompatibleRuntimeContext {\n ctxStore: DataStore<\"CTX\">;\n tplStateStoreMap: Map<string, DataStore<\"STATE\">>;\n pendingPermissionsPreCheck: (Promise<unknown> | undefined)[];\n tplStateStoreId?: string;\n // `useBrick` has a local tpl state store scope\n tplStateStoreScope?: DataStore<\"STATE\">[];\n forEachItem?: unknown;\n forEachIndex?: number;\n forEachSize?: number;\n appendI18nNamespace?: string;\n\n formStateStoreMap: Map<string, DataStore<\"FORM_STATE\">>;\n formStateStoreId?: string;\n formStateStoreScope?: DataStore<\"FORM_STATE\">[];\n}\n\nexport type AsyncPropertyEntry = [\n name: string,\n value: Promise<unknown>,\n ignoreUndefined?: boolean,\n];\n\nexport interface ElementHolder {\n element?: HTMLElement | null;\n}\n\nexport interface RenderRoot extends BaseRenderNode {\n tag: RenderTag.ROOT;\n container?: HTMLElement | DocumentFragment;\n createPortal:\n | HTMLElement\n | DocumentFragment\n | (() => HTMLElement | DocumentFragment);\n}\n\nexport interface RenderBrick extends BaseRenderNode, RuntimeBrick {\n tag: RenderTag.BRICK;\n return: RenderReturnNode;\n hasTrackingControls?: boolean;\n}\n\nexport interface RenderPlaceholder extends BaseRenderNode {\n tag: RenderTag.PLACEHOLDER;\n return: RenderReturnNode;\n}\n\nexport interface BaseRenderNode {\n tag: RenderTag;\n child?: RenderChildNode;\n sibling?: RenderChildNode;\n return?: RenderReturnNode | null;\n childElements?: HTMLElement[];\n}\n\nexport type RenderNode = RenderRoot | RenderBrick | RenderPlaceholder;\n\nexport type RenderChildNode = RenderBrick | RenderPlaceholder;\nexport type RenderReturnNode = RenderRoot | RenderBrick;\n\nexport interface RuntimeBrick {\n type: string;\n properties?: Record<string, unknown>;\n events?: BrickEventsMap;\n slotId?: string;\n element?: RuntimeBrickElement | null;\n iid?: string;\n runtimeContext: RuntimeContext;\n tplHostMetadata?: TemplateHostMetadata;\n portal?: boolean;\n ref?: string;\n disposes?: (() => void)[];\n}\n\nexport type MetaInfoOfEventListener = [\n string,\n // For compatibility of devtools, leave the second argument there.\n null | undefined,\n BrickEventHandler,\n];\n\nexport type RememberedEventListener = [string, EventListener];\n\nexport interface RuntimeBrickElement extends HTMLElement {\n $$typeof?: \"brick\" | \"provider\" | \"custom-template\" | \"native\" | \"invalid\";\n /** Meta info of listeners, for devtools only */\n $$eventListeners?: MetaInfoOfEventListener[];\n /** Remembered listeners for unbinding */\n $$listeners?: RememberedEventListener[];\n /** Remembered proxy listeners for unbinding */\n $$proxyListeners?: RememberedEventListener[];\n /** Find element by ref in a custom template */\n $$getElementByRef?: (ref: string) => HTMLElement | null | undefined;\n $$tplStateStore?: DataStore<\"STATE\">;\n}\n\nexport interface TemplateHostMetadata {\n internalBricksByRef: Map<string, RuntimeBrick>;\n tplStateStoreId: string;\n proxy?: CustomTemplateProxy;\n}\n\nexport type TemplateHostBrick = RuntimeBrick & {\n tplHostMetadata: TemplateHostMetadata;\n};\n\nexport interface TemplateHostContext {\n reversedProxies: ReversedProxies;\n asyncHostPropertyEntries: AsyncPropertyEntry[];\n externalSlots?: SlotsConfOfBricks;\n tplStateStoreId: string;\n hostBrick: TemplateHostBrick;\n usedSlots: Set<string>;\n}\n\ninterface ReversedProxies {\n properties: Map<string, ReversedPropertyProxy[]>;\n slots: Map<string, ReversedSlotProxy[]>;\n}\n\ninterface ReversedPropertyProxy {\n from: string;\n to: CustomTemplateProxyBasicProperty;\n}\n\ninterface ReversedSlotProxy {\n from: string;\n to: CustomTemplateProxySlot;\n}\n\nexport type RuntimeBrickConfWithSymbols = RuntimeBrickConfWithTplSymbols &\n RuntimeBrickConfOfFormSymbols;\n\nexport interface DataValueOption {\n tplStateStoreId?: string;\n routeId?: string;\n}\n\nexport type PreviewStoryboardPatch =\n | CustomTemplate\n | RouteConf\n | RuntimeSnippet;\n\nexport interface PreviewOption {\n appId: string;\n formId?: string;\n updateStoryboardType?: \"route\" | \"template\" | \"snippet\";\n collectUsedContracts?(storyboard: Storyboard): string[] | Promise<string[]>;\n}\n\nexport interface MenuRequestNode {\n child?: MenuRequestNode;\n sibling?: MenuRequestNode;\n return?: MenuRequestNode;\n request?: Promise<StaticMenuConf>;\n}\n\nexport interface DebugDataValue {\n resolve?: UseProviderResolveConf;\n value?: unknown;\n}\n\nexport interface RuntimeDataVale\n extends Pick<LegacyCompatibleRuntimeContext, \"match\" | \"sys\" | \"query\"> {\n location: {\n href: string;\n origin: string;\n hostname: string;\n host: string;\n };\n app?: MicroApp;\n}\n\nexport interface RuntimeDataValueOption {\n routeId?: string;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"interfaces.js","names":[],"sources":["../../../src/internal/interfaces.ts"],"sourcesContent":["import type { LegacyCompatibleRuntimeContext } from \"@next-core/inject\";\nimport type {\n BrickEventHandler,\n BrickEventsMap,\n CustomTemplate,\n RouteConf,\n RuntimeSnippet,\n CustomTemplateProxy,\n CustomTemplateProxyBasicProperty,\n CustomTemplateProxySlot,\n SlotsConfOfBricks,\n Storyboard,\n StaticMenuConf,\n UseProviderResolveConf,\n MicroApp,\n} from \"@next-core/types\";\nimport type { DataStore } from \"./data/DataStore.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { RuntimeBrickConfWithTplSymbols } from \"./CustomTemplates/constants.js\";\nimport { RuntimeBrickConfOfFormSymbols } from \"./FormRenderer/constants.js\";\n\nexport interface RuntimeContext extends LegacyCompatibleRuntimeContext {\n ctxStore: DataStore<\"CTX\">;\n tplStateStoreMap: Map<string, DataStore<\"STATE\">>;\n pendingPermissionsPreCheck: (Promise<unknown> | undefined)[];\n tplStateStoreId?: string;\n // `useBrick` has a local tpl state store scope\n tplStateStoreScope?: DataStore<\"STATE\">[];\n forEachItem?: unknown;\n forEachIndex?: number;\n forEachSize?: number;\n appendI18nNamespace?: string;\n\n formStateStoreMap: Map<string, DataStore<\"FORM_STATE\">>;\n formStateStoreId?: string;\n formStateStoreScope?: DataStore<\"FORM_STATE\">[];\n inUseBrick?: boolean;\n}\n\nexport type AsyncPropertyEntry = [\n name: string,\n value: Promise<unknown>,\n ignoreUndefined?: boolean,\n];\n\nexport interface ElementHolder {\n element?: HTMLElement | null;\n}\n\nexport interface RenderRoot extends BaseRenderNode {\n tag: RenderTag.ROOT;\n container?: HTMLElement | DocumentFragment;\n createPortal:\n | HTMLElement\n | DocumentFragment\n | (() => HTMLElement | DocumentFragment);\n}\n\nexport interface RenderBrick extends BaseRenderNode, RuntimeBrick {\n tag: RenderTag.BRICK;\n return: RenderReturnNode;\n hasTrackingControls?: boolean;\n}\n\nexport interface RenderPlaceholder extends BaseRenderNode {\n tag: RenderTag.PLACEHOLDER;\n return: RenderReturnNode;\n}\n\nexport interface BaseRenderNode {\n tag: RenderTag;\n child?: RenderChildNode;\n sibling?: RenderChildNode;\n return?: RenderReturnNode | null;\n childElements?: HTMLElement[];\n}\n\nexport type RenderNode = RenderRoot | RenderBrick | RenderPlaceholder;\n\nexport type RenderChildNode = RenderBrick | RenderPlaceholder;\nexport type RenderReturnNode = RenderRoot | RenderBrick;\n\nexport interface RuntimeBrick {\n type: string;\n properties?: Record<string, unknown>;\n events?: BrickEventsMap;\n slotId?: string;\n element?: RuntimeBrickElement | null;\n iid?: string;\n runtimeContext: RuntimeContext;\n tplHostMetadata?: TemplateHostMetadata;\n portal?: boolean;\n ref?: string;\n disposes?: (() => void)[];\n}\n\nexport type MetaInfoOfEventListener = [\n string,\n // For compatibility of devtools, leave the second argument there.\n null | undefined,\n BrickEventHandler,\n];\n\nexport type RememberedEventListener = [string, EventListener];\n\nexport interface RuntimeBrickElement extends HTMLElement {\n $$typeof?: \"brick\" | \"provider\" | \"custom-template\" | \"native\" | \"invalid\";\n /** Meta info of listeners, for devtools only */\n $$eventListeners?: MetaInfoOfEventListener[];\n /** Remembered listeners for unbinding */\n $$listeners?: RememberedEventListener[];\n /** Remembered proxy listeners for unbinding */\n $$proxyListeners?: RememberedEventListener[];\n /** Find element by ref in a custom template */\n $$getElementByRef?: (ref: string) => HTMLElement | null | undefined;\n $$tplStateStore?: DataStore<\"STATE\">;\n}\n\nexport interface TemplateHostMetadata {\n internalBricksByRef: Map<string, RuntimeBrick>;\n tplStateStoreId: string;\n proxy?: CustomTemplateProxy;\n}\n\nexport type TemplateHostBrick = RuntimeBrick & {\n tplHostMetadata: TemplateHostMetadata;\n};\n\nexport interface TemplateHostContext {\n reversedProxies: ReversedProxies;\n asyncHostPropertyEntries: AsyncPropertyEntry[];\n externalSlots?: SlotsConfOfBricks;\n tplStateStoreId: string;\n hostBrick: TemplateHostBrick;\n usedSlots: Set<string>;\n}\n\ninterface ReversedProxies {\n properties: Map<string, ReversedPropertyProxy[]>;\n slots: Map<string, ReversedSlotProxy[]>;\n}\n\ninterface ReversedPropertyProxy {\n from: string;\n to: CustomTemplateProxyBasicProperty;\n}\n\ninterface ReversedSlotProxy {\n from: string;\n to: CustomTemplateProxySlot;\n}\n\nexport type RuntimeBrickConfWithSymbols = RuntimeBrickConfWithTplSymbols &\n RuntimeBrickConfOfFormSymbols;\n\nexport interface DataValueOption {\n tplStateStoreId?: string;\n routeId?: string;\n}\n\nexport type PreviewStoryboardPatch =\n | CustomTemplate\n | RouteConf\n | RuntimeSnippet;\n\nexport interface PreviewOption {\n appId: string;\n formId?: string;\n updateStoryboardType?: \"route\" | \"template\" | \"snippet\";\n collectUsedContracts?(storyboard: Storyboard): string[] | Promise<string[]>;\n}\n\nexport interface MenuRequestNode {\n child?: MenuRequestNode;\n sibling?: MenuRequestNode;\n return?: MenuRequestNode;\n request?: Promise<StaticMenuConf>;\n}\n\nexport interface DebugDataValue {\n resolve?: UseProviderResolveConf;\n value?: unknown;\n}\n\nexport interface RuntimeDataVale\n extends Pick<LegacyCompatibleRuntimeContext, \"match\" | \"sys\" | \"query\"> {\n location: {\n href: string;\n origin: string;\n hostname: string;\n host: string;\n };\n app?: MicroApp;\n}\n\nexport interface RuntimeDataValueOption {\n routeId?: string;\n}\n"],"mappings":"","ignoreList":[]}
@@ -5,8 +5,8 @@ export function matchStoryboard(storyboards, pathname) {
5
5
  // E.g., `/legacy/tool` will match first before `/legacy`.
6
6
  // This enables two apps with relationship of parent-child of homepage.
7
7
  const sortedStoryboards = orderBy(storyboards, storyboard => {
8
- var _storyboard$app$homep;
9
- return ((_storyboard$app$homep = storyboard.app.homepage) === null || _storyboard$app$homep === void 0 ? void 0 : _storyboard$app$homep.length) ?? 0;
8
+ var _storyboard$app$homep, _storyboard$app$homep2;
9
+ return (_storyboard$app$homep = (_storyboard$app$homep2 = storyboard.app.homepage) === null || _storyboard$app$homep2 === void 0 ? void 0 : _storyboard$app$homep2.length) !== null && _storyboard$app$homep !== void 0 ? _storyboard$app$homep : 0;
10
10
  }, "desc");
11
11
  for (const storyboard of sortedStoryboards) {
12
12
  const homepage = storyboard.app.homepage;
@@ -1 +1 @@
1
- {"version":3,"file":"matchStoryboard.js","names":["orderBy","getRuntime","matchStoryboard","storyboards","pathname","sortedStoryboards","storyboard","_storyboard$app$homep","app","homepage","length","matchHomepage","replace","startsWith","isOutsideApp","_getRuntime$getCurren","process","env","NODE_ENV","getCurrentApp","id","window","STANDALONE_MICRO_APPS","standaloneMode"],"sources":["../../../src/internal/matchStoryboard.ts"],"sourcesContent":["import type { RuntimeStoryboard } from \"@next-core/types\";\nimport { orderBy } from \"lodash\";\nimport { getRuntime } from \"./Runtime.js\";\n\nexport function matchStoryboard(\n storyboards: RuntimeStoryboard[],\n pathname: string\n): RuntimeStoryboard | undefined {\n // Put apps with longer homepage before shorter ones.\n // E.g., `/legacy/tool` will match first before `/legacy`.\n // This enables two apps with relationship of parent-child of homepage.\n const sortedStoryboards = orderBy(\n storyboards,\n (storyboard) => storyboard.app.homepage?.length ?? 0,\n \"desc\"\n );\n for (const storyboard of sortedStoryboards) {\n const homepage = storyboard.app.homepage;\n if (typeof homepage === \"string\" && homepage[0] === \"/\") {\n if (matchHomepage(homepage, pathname)) {\n return storyboard;\n }\n }\n }\n}\n\nexport function matchHomepage(homepage: string, pathname: string) {\n return homepage === \"/\"\n ? pathname === homepage\n : `${pathname.replace(/\\/+$/, \"\")}/`.startsWith(\n `${homepage.replace(/\\/+$/, \"\")}/`\n );\n}\n\n// istanbul ignore next\n/**\n * We say it's an outside app when at least one of the below conditions are true:\n * - target app is not found.\n * - target app is not the current app.\n * - current app is non-standalone mode and target app is standalone mode.\n *\n * Note: when current app is standalone mode, other apps will not be found.\n */\nexport function isOutsideApp(\n storyboard: RuntimeStoryboard | undefined\n): boolean | undefined {\n if (process.env.NODE_ENV === \"test\") {\n return false;\n }\n return (\n !storyboard ||\n // Sometimes `storyboard.app.standaloneMode` is incorrect.\n (getRuntime().getCurrentApp()?.id !== storyboard.app.id &&\n !window.STANDALONE_MICRO_APPS &&\n storyboard.app.standaloneMode)\n );\n}\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,QAAQ;AAChC,SAASC,UAAU,QAAQ,cAAc;AAEzC,OAAO,SAASC,eAAeA,CAC7BC,WAAgC,EAChCC,QAAgB,EACe;EAC/B;EACA;EACA;EACA,MAAMC,iBAAiB,GAAGL,OAAO,CAC/BG,WAAW,EACVG,UAAU;IAAA,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board.js","names":["orderBy","getRuntime","matchStoryboard","storyboards","pathname","sortedStoryboards","storyboard","_storyboard$app$homep","_storyboard$app$homep2","app","homepage","length","matchHomepage","replace","startsWith","isOutsideApp","_getRuntime$getCurren","process","env","NODE_ENV","getCurrentApp","id","window","STANDALONE_MICRO_APPS","standaloneMode"],"sources":["../../../src/internal/matchStoryboard.ts"],"sourcesContent":["import type { RuntimeStoryboard } from \"@next-core/types\";\nimport { orderBy } from \"lodash\";\nimport { getRuntime } from \"./Runtime.js\";\n\nexport function matchStoryboard(\n storyboards: RuntimeStoryboard[],\n pathname: string\n): RuntimeStoryboard | undefined {\n // Put apps with longer homepage before shorter ones.\n // E.g., `/legacy/tool` will match first before `/legacy`.\n // This enables two apps with relationship of parent-child of homepage.\n const sortedStoryboards = orderBy(\n storyboards,\n (storyboard) => storyboard.app.homepage?.length ?? 0,\n \"desc\"\n );\n for (const storyboard of sortedStoryboards) {\n const homepage = storyboard.app.homepage;\n if (typeof homepage === \"string\" && homepage[0] === \"/\") {\n if (matchHomepage(homepage, pathname)) {\n return storyboard;\n }\n }\n }\n}\n\nexport function matchHomepage(homepage: string, pathname: string) {\n return homepage === \"/\"\n ? pathname === homepage\n : `${pathname.replace(/\\/+$/, \"\")}/`.startsWith(\n `${homepage.replace(/\\/+$/, \"\")}/`\n );\n}\n\n// istanbul ignore next\n/**\n * We say it's an outside app when at least one of the below conditions are true:\n * - target app is not found.\n * - target app is not the current app.\n * - current app is non-standalone mode and target app is standalone mode.\n *\n * Note: when current app is standalone mode, other apps will not be found.\n */\nexport function isOutsideApp(\n storyboard: RuntimeStoryboard | undefined\n): boolean | undefined {\n if (process.env.NODE_ENV === \"test\") {\n return false;\n }\n return (\n !storyboard ||\n // Sometimes `storyboard.app.standaloneMode` is incorrect.\n (getRuntime().getCurrentApp()?.id !== storyboard.app.id &&\n !window.STANDALONE_MICRO_APPS &&\n storyboard.app.standaloneMode)\n );\n}\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,QAAQ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AAC,CAACmB,aAAa,CAAC,CAAC,cAAAJ,qBAAA,uBAA5BA,qBAAA,CAA8BK,EAAE,MAAKf,UAAU,CAACG,GAAG,CAACY,EAAE,IACrD,CAACC,MAAM,CAACC,qBAAqB,IAC7BjB,UAAU,CAACG,GAAG,CAACe,cAAe;AAEpC","ignoreList":[]}
@@ -45,7 +45,7 @@ export function startPoll(task, _ref, pollOptions, runtimeContext) {
45
45
  success === null || success === void 0 || success(result);
46
46
  finallyCallback === null || finallyCallback === void 0 || finallyCallback();
47
47
  } else {
48
- delayedPoll(interval ?? 3000);
48
+ delayedPoll(interval !== null && interval !== void 0 ? interval : 3000);
49
49
  }
50
50
  } else if (expectPollStopImmediatelyResult) {
51
51
  finallyCallback === null || finallyCallback === void 0 || finallyCallback();
@@ -62,7 +62,7 @@ export function startPoll(task, _ref, pollOptions, runtimeContext) {
62
62
  if (!shouldStop) {
63
63
  error === null || error === void 0 || error(e);
64
64
  if (continueOnError) {
65
- delayedPoll(interval ?? 3000);
65
+ delayedPoll(interval !== null && interval !== void 0 ? interval : 3000);
66
66
  } else {
67
67
  finallyCallback === null || finallyCallback === void 0 || finallyCallback();
68
68
  }
@@ -80,7 +80,7 @@ export function startPoll(task, _ref, pollOptions, runtimeContext) {
80
80
  currentTimeoutId = setTimeout(poll, delay);
81
81
  timeoutIdList.add(currentTimeoutId);
82
82
  }
83
- delayedPoll(leadingRequestDelay ?? 0);
83
+ delayedPoll(leadingRequestDelay !== null && leadingRequestDelay !== void 0 ? leadingRequestDelay : 0);
84
84
  if (delegateLoadingBar) {
85
85
  window.dispatchEvent(new Event("request.start"));
86
86
  }
@@ -1 +1 @@
1
- {"version":3,"file":"poll.js","names":["pick","_internalApiGetRenderId","computeRealValue","timeoutIdList","Set","startPoll","task","_ref","pollOptions","runtimeContext","progress","success","error","finally","finallyCallback","expectPollStopImmediately","expectPollEnd","interval","leadingRequestDelay","continueOnError","delegateLoadingBar","currentRenderId","currentTimeoutId","poll","delete","shouldStop","_computeRealValue","_computeRealValue2","result","expectPollStopImmediatelyResult","_computeRealValue3","window","dispatchEvent","Event","delayedPoll","e","_computeRealValue4","delay","setTimeout","add","clearPollTimeout","timeoutId","clearTimeout","clear"],"sources":["../../../src/internal/poll.ts"],"sourcesContent":["import type { ProviderPollOptions } from \"@next-core/types\";\nimport { pick } from \"lodash\";\nimport { _internalApiGetRenderId } from \"./Runtime.js\";\nimport { computeRealValue } from \"./compute/computeRealValue.js\";\nimport { RuntimeContext } from \"./interfaces.js\";\n\nexport type PollableCallbackFunction = (result?: unknown) => unknown;\n\nexport interface PollableCallback {\n progress?: PollableCallbackFunction;\n success?: PollableCallbackFunction;\n error?: PollableCallbackFunction;\n finally?: PollableCallbackFunction;\n}\n\nconst timeoutIdList = new Set<number>();\n\nexport function startPoll(\n task: () => unknown,\n { progress, success, error, finally: finallyCallback }: PollableCallback,\n pollOptions: ProviderPollOptions,\n runtimeContext: RuntimeContext\n): void {\n const { expectPollStopImmediately, expectPollEnd } = pollOptions;\n const { interval, leadingRequestDelay, continueOnError, delegateLoadingBar } =\n computeRealValue(\n pick(pollOptions, [\n \"interval\",\n \"leadingRequestDelay\",\n \"continueOnError\",\n \"delegateLoadingBar\",\n ]),\n runtimeContext\n ) as ProviderPollOptions;\n const currentRenderId = _internalApiGetRenderId();\n let currentTimeoutId: number;\n async function poll(): Promise<void> {\n timeoutIdList.delete(currentTimeoutId);\n let shouldStop: boolean | undefined;\n try {\n shouldStop = (\n computeRealValue(expectPollStopImmediately, runtimeContext) as\n | (() => boolean)\n | undefined\n )?.();\n // Stop polling immediately when the expectation is match before task.\n if (!shouldStop) {\n const result = await task();\n const expectPollStopImmediatelyResult = (\n computeRealValue(expectPollStopImmediately, runtimeContext) as\n | (() => boolean)\n | undefined\n )?.();\n // Stop polling immediately when the expectation is match or a different router\n // is rendering after the task processed.\n shouldStop =\n expectPollStopImmediatelyResult ||\n currentRenderId !== _internalApiGetRenderId();\n if (!shouldStop) {\n progress?.(result);\n if (\n (\n computeRealValue(expectPollEnd, runtimeContext) as\n | ((result: unknown) => boolean)\n | undefined\n )?.(result)\n ) {\n if (delegateLoadingBar) {\n window.dispatchEvent(new Event(\"request.end\"));\n }\n success?.(result);\n finallyCallback?.();\n } else {\n delayedPoll(interval ?? 3000);\n }\n } else if (expectPollStopImmediatelyResult) {\n finallyCallback?.();\n }\n } else {\n finallyCallback?.();\n }\n } catch (e) {\n const expectPollStopImmediatelyResult = (\n computeRealValue(expectPollStopImmediately, runtimeContext) as\n | (() => boolean)\n | undefined\n )?.();\n // Stop polling immediately when the expectation is match or a different router\n // is rendering after the task processed.\n shouldStop =\n expectPollStopImmediatelyResult ||\n currentRenderId !== _internalApiGetRenderId();\n if (!shouldStop) {\n error?.(e);\n if (continueOnError) {\n delayedPoll(interval ?? 3000);\n } else {\n finallyCallback?.();\n }\n } else if (expectPollStopImmediatelyResult) {\n finallyCallback?.();\n }\n } finally {\n // Manually dispatch an event of `request.end` when the polling is stopped immediately.\n if (delegateLoadingBar && shouldStop) {\n window.dispatchEvent(new Event(\"request.end\"));\n }\n }\n }\n\n function delayedPoll(delay: number): void {\n currentTimeoutId = setTimeout(poll, delay) as unknown as number;\n timeoutIdList.add(currentTimeoutId);\n }\n\n delayedPoll(leadingRequestDelay ?? 0);\n\n if (delegateLoadingBar) {\n window.dispatchEvent(new Event(\"request.start\"));\n }\n}\n\nexport function clearPollTimeout(): void {\n for (const timeoutId of timeoutIdList) {\n clearTimeout(timeoutId);\n }\n timeoutIdList.clear();\n}\n"],"mappings":"AACA,SAASA,IAAI,QAAQ,QAAQ;AAC7B,SAASC,uBAAuB,QAAQ,cAAc;AACtD,SAASC,gBAAgB,QAAQ,+BAA+B;AAYhE,MAAMC,aAAa,GAAG,IAAIC,GAAG,CAAS,CAAC;AAEvC,OAAO,SAASC,SAASA,CACvBC,IAAmB,EAAAC,IAAA,EAEnBC,WAAgC,EAChCC,cAA8B,EACxB;EAAA,IAHN;IAAEC,QAAQ;IAAEC,OAAO;IAAEC,K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GgB,UAAU,CAACf,IAAI,EAAEc,KAAK,CAAsB;IAC/DlC,aAAa,CAACoC,GAAG,CAACjB,gBAAgB,CAAC;EACrC;EAEAY,WAAW,CAAChB,mBAAmB,IAAI,CAAC,CAAC;EAErC,IAAIE,kBAAkB,EAAE;IACtBW,MAAM,CAACC,aAAa,CAAC,IAAIC,KAAK,CAAC,eAAe,CAAC,CAAC;EAClD;AACF;AAEA,OAAO,SAASO,gBAAgBA,CAAA,EAAS;EACvC,KAAK,MAAMC,SAAS,IAAItC,aAAa,EAAE;IACrCuC,YAAY,CAACD,SAAS,CAAC;EACzB;EACAtC,aAAa,CAACwC,KAAK,CAAC,CAAC;AACvB","ignoreList":[]}
1
+ {"version":3,"file":"poll.js","names":["pick","_internalApiGetRenderId","computeRealValue","timeoutIdList","Set","startPoll","task","_ref","pollOptions","runtimeContext","progress","success","error","finally","finallyCallback","expectPollStopImmediately","expectPollEnd","interval","leadingRequestDelay","continueOnError","delegateLoadingBar","currentRenderId","currentTimeoutId","poll","delete","shouldStop","_computeRealValue","_computeRealValue2","result","expectPollStopImmediatelyResult","_computeRealValue3","window","dispatchEvent","Event","delayedPoll","e","_computeRealValue4","delay","setTimeout","add","clearPollTimeout","timeoutId","clearTimeout","clear"],"sources":["../../../src/internal/poll.ts"],"sourcesContent":["import type { ProviderPollOptions } from \"@next-core/types\";\nimport { pick } from \"lodash\";\nimport { _internalApiGetRenderId } from \"./Runtime.js\";\nimport { computeRealValue } from \"./compute/computeRealValue.js\";\nimport { RuntimeContext } from \"./interfaces.js\";\n\nexport type PollableCallbackFunction = (result?: unknown) => unknown;\n\nexport interface PollableCallback {\n progress?: PollableCallbackFunction;\n success?: PollableCallbackFunction;\n error?: PollableCallbackFunction;\n finally?: PollableCallbackFunction;\n}\n\nconst timeoutIdList = new Set<number>();\n\nexport function startPoll(\n task: () => unknown,\n { progress, success, error, finally: finallyCallback }: PollableCallback,\n pollOptions: ProviderPollOptions,\n runtimeContext: RuntimeContext\n): void {\n const { expectPollStopImmediately, expectPollEnd } = pollOptions;\n const { interval, leadingRequestDelay, continueOnError, delegateLoadingBar } =\n computeRealValue(\n pick(pollOptions, [\n \"interval\",\n \"leadingRequestDelay\",\n \"continueOnError\",\n \"delegateLoadingBar\",\n ]),\n runtimeContext\n ) as ProviderPollOptions;\n const currentRenderId = _internalApiGetRenderId();\n let currentTimeoutId: number;\n async function poll(): Promise<void> {\n timeoutIdList.delete(currentTimeoutId);\n let shouldStop: boolean | undefined;\n try {\n shouldStop = (\n computeRealValue(expectPollStopImmediately, runtimeContext) as\n | (() => boolean)\n | undefined\n )?.();\n // Stop polling immediately when the expectation is match before task.\n if (!shouldStop) {\n const result = await task();\n const expectPollStopImmediatelyResult = (\n computeRealValue(expectPollStopImmediately, runtimeContext) as\n | (() => boolean)\n | undefined\n )?.();\n // Stop polling immediately when the expectation is match or a different router\n // is rendering after the task processed.\n shouldStop =\n expectPollStopImmediatelyResult ||\n currentRenderId !== _internalApiGetRenderId();\n if (!shouldStop) {\n progress?.(result);\n if (\n (\n computeRealValue(expectPollEnd, runtimeContext) as\n | ((result: unknown) => boolean)\n | undefined\n )?.(result)\n ) {\n if (delegateLoadingBar) {\n window.dispatchEvent(new Event(\"request.end\"));\n }\n success?.(result);\n finallyCallback?.();\n } else {\n delayedPoll(interval ?? 3000);\n }\n } else if (expectPollStopImmediatelyResult) {\n finallyCallback?.();\n }\n } else {\n finallyCallback?.();\n }\n } catch (e) {\n const expectPollStopImmediatelyResult = (\n computeRealValue(expectPollStopImmediately, runtimeContext) as\n | (() => boolean)\n | undefined\n )?.();\n // Stop polling immediately when the expectation is match or a different router\n // is rendering after the task processed.\n shouldStop =\n expectPollStopImmediatelyResult ||\n currentRenderId !== _internalApiGetRenderId();\n if (!shouldStop) {\n error?.(e);\n if (continueOnError) {\n delayedPoll(interval ?? 3000);\n } else {\n finallyCallback?.();\n }\n } else if (expectPollStopImmediatelyResult) {\n finallyCallback?.();\n }\n } finally {\n // Manually dispatch an event of `request.end` when the polling is stopped immediately.\n if (delegateLoadingBar && shouldStop) {\n window.dispatchEvent(new Event(\"request.end\"));\n }\n }\n }\n\n function delayedPoll(delay: number): void {\n currentTimeoutId = setTimeout(poll, delay) as unknown as number;\n timeoutIdList.add(currentTimeoutId);\n }\n\n delayedPoll(leadingRequestDelay ?? 0);\n\n if (delegateLoadingBar) {\n window.dispatchEvent(new Event(\"request.start\"));\n }\n}\n\nexport function clearPollTimeout(): void {\n for (const timeoutId of timeoutIdList) {\n clearTimeout(timeoutId);\n }\n timeoutIdList.clear();\n}\n"],"mappings":"AACA,SAASA,IAAI,QAAQ,QAAQ;AAC7B,SAASC,uBAAuB,QAAQ,cAAc;AACtD,SAASC,gBAAgB,QAAQ,+BAA+B;AAYhE,MAAMC,aAAa,GAAG,IAAIC,GAAG,CAAS,CAAC;AAEvC,OAAO,SAASC,SAASA,CACvBC,IAAmB,EAAAC,IAAA,EAEnBC,WAAgC,EAChCC,cAA8B,EACxB;EAAA,IAHN;IAAEC,QAAQ;IAAEC,OAAO;IAAEC,KAAK;IAAEC,OAAO,EAAEC;EAAkC,CAAC,GAAAP,IAAA;EAIxE,MAAM;IAAEQ,yBAAyB;IAAEC;EAAc,CAAC,GAAGR,WAAW;EAChE,MAAM;IAAES,QAAQ;IAAEC,mBAAmB;IAAEC,eAAe;IAAEC;EAAmB,CAAC,GAC1ElB,gBAAgB,CACdF,IAAI,CAACQ,WAAW,EAAE,CAChB,UAAU,EACV,qBAAqB,EACrB,iBAAiB,EACjB,oBAAoB,CACrB,CAAC,EACFC,cACF,CAAwB;EAC1B,MAAMY,eAAe,GAAGpB,uBAAuB,CAAC,CAAC;EACjD,IAAIqB,gBAAwB;EAC5B,eAAeC,IAAIA,CAAA,EAAkB;IACnCpB,aAAa,CAACqB,MAAM,CAACF,gBAAgB,CAAC;IACtC,IAAIG,UAA+B;IACnC,IAAI;MAAA,IAAAC,iBAAA;MACFD,UAAU,IAAAC,iBAAA,GACRxB,gBAAgB,CAACa,yBAAyB,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Ac,CAAC,cAAA2B,kBAAA,uBADrBA,kBAAA,CAIpC,CAAC;MACL;MACA;MACAX,UAAU,GACRI,+BAA+B,IAC/BR,eAAe,KAAKpB,uBAAuB,CAAC,CAAC;MAC/C,IAAI,CAACwB,UAAU,EAAE;QACfb,KAAK,aAALA,KAAK,eAALA,KAAK,CAAGuB,CAAC,CAAC;QACV,IAAIhB,eAAe,EAAE;UACnBe,WAAW,CAACjB,QAAQ,aAARA,QAAQ,cAARA,QAAQ,GAAI,IAAI,CAAC;QAC/B,CAAC,MAAM;UACLH,eAAe,aAAfA,eAAe,eAAfA,eAAe,CAAG,CAAC;QACrB;MACF,CAAC,MAAM,IAAIe,+BAA+B,EAAE;QAC1Cf,eAAe,aAAfA,eAAe,eAAfA,eAAe,CAAG,CAAC;MACrB;IACF,CAAC,SAAS;MACR;MACA,IAAIM,kBAAkB,IAAIK,UAAU,EAAE;QACpCM,MAAM,CAACC,aAAa,CAAC,IAAIC,KAAK,CAAC,aAAa,CAAC,CAAC;MAChD;IACF;EACF;EAEA,SAASC,WAAWA,CAACG,KAAa,EAAQ;IACxCf,gBAAgB,GAAGgB,UAAU,CAACf,IAAI,EAAEc,KAAK,CAAsB;IAC/DlC,aAAa,CAACoC,GAAG,CAACjB,gBAAgB,CAAC;EACrC;EAEAY,WAAW,CAAChB,mBAAmB,aAAnBA,mBAAmB,cAAnBA,mBAAmB,GAAI,CAAC,CAAC;EAErC,IAAIE,kBAAkB,EAAE;IACtBW,MAAM,CAACC,aAAa,CAAC,IAAIC,KAAK,CAAC,eAAe,CAAC,CAAC;EAClD;AACF;AAEA,OAAO,SAASO,gBAAgBA,CAAA,EAAS;EACvC,KAAK,MAAMC,SAAS,IAAItC,aAAa,EAAE;IACrCuC,YAAY,CAACD,SAAS,CAAC;EACzB;EACAtC,aAAa,CAACwC,KAAK,CAAC,CAAC;AACvB","ignoreList":[]}
@@ -7,7 +7,7 @@ import { asyncComputeRealValue } from "./compute/computeRealValue.js";
7
7
  import { mountTree, unmountTree } from "./mount.js";
8
8
  import { RenderTag } from "./enums.js";
9
9
  import { computeRealValue } from "./compute/computeRealValue.js";
10
- import { isStrictMode, warnAboutStrictMode } from "../isStrictMode.js";
10
+ import { isStrictMode } from "../isStrictMode.js";
11
11
  import { customTemplates } from "../CustomTemplates.js";
12
12
  import { registerAppI18n } from "./registerAppI18n.js";
13
13
  import { getTplStateStore } from "./CustomTemplates/utils.js";
@@ -15,32 +15,25 @@ import { loadBricksImperatively, loadEditorsImperatively } from "@next-core/load
15
15
  import { getMatchedRoute } from "./routeMatchedMap.js";
16
16
  export const symbolForRootRuntimeContext = Symbol.for("root.runtimeContext");
17
17
  export async function renderUseBrick(useBrick, data, errorBoundary) {
18
- var _output$node, _output$node2;
18
+ var _useBrick$symbolForRo, _scopedRuntimeContext, _scopedRuntimeContext2, _output$node, _output$node2;
19
19
  const [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope] = createScopedRuntimeContext({
20
- ...(useBrick[symbolForRootRuntimeContext] ?? _internalApiGetRuntimeContext()),
20
+ ...((_useBrick$symbolForRo = useBrick[symbolForRootRuntimeContext]) !== null && _useBrick$symbolForRo !== void 0 ? _useBrick$symbolForRo : _internalApiGetRuntimeContext()),
21
21
  data,
22
22
  pendingPermissionsPreCheck: []
23
23
  });
24
- scopedRuntimeContext.tplStateStoreMap ?? (scopedRuntimeContext.tplStateStoreMap = new Map());
25
- scopedRuntimeContext.formStateStoreMap ?? (scopedRuntimeContext.formStateStoreMap = new Map());
24
+ scopedRuntimeContext.inUseBrick = true;
25
+ (_scopedRuntimeContext = scopedRuntimeContext.tplStateStoreMap) !== null && _scopedRuntimeContext !== void 0 ? _scopedRuntimeContext : scopedRuntimeContext.tplStateStoreMap = new Map();
26
+ (_scopedRuntimeContext2 = scopedRuntimeContext.formStateStoreMap) !== null && _scopedRuntimeContext2 !== void 0 ? _scopedRuntimeContext2 : scopedRuntimeContext.formStateStoreMap = new Map();
26
27
  const rendererContext = new RendererContext("fragment");
27
28
  const renderRoot = {
28
29
  tag: RenderTag.ROOT,
29
30
  // Will set during `mountUseBrick`
30
31
  createPortal: null
31
32
  };
32
- const transform = useBrick.transform;
33
33
  const strict = isStrictMode();
34
- if (transform) {
35
- warnAboutStrictMode(strict, "`useBrick.transform`", 'please use "properties" instead, check your useBrick:', useBrick);
36
- }
37
34
  const output = await renderBrick(renderRoot, strict && !errorBoundary ? useBrick : {
38
35
  errorBoundary,
39
- ...useBrick,
40
- properties: {
41
- ...useBrick.properties,
42
- ...transform
43
- }
36
+ ...useBrick
44
37
  }, scopedRuntimeContext, rendererContext, [], {});
45
38
  const scopedStores = [...tplStateStoreScope, ...formStateStoreScope];
46
39
  await postAsyncRender(output, scopedRuntimeContext, scopedStores);
@@ -251,7 +244,7 @@ export function loadBricks(bricks) {
251
244
  * Try the brick packages passed in, before using from bootstrap.
252
245
  */
253
246
  export function loadEditors(editors, brickPackages) {
254
- return loadEditorsImperatively(editors, brickPackages ?? getBrickPackages());
247
+ return loadEditorsImperatively(editors, brickPackages !== null && brickPackages !== void 0 ? brickPackages : getBrickPackages());
255
248
  }
256
249
  export function getRenderId() {
257
250
  return _internalApiGetRenderId();
@@ -317,9 +310,10 @@ export async function debugDataValue(debugData, _ref6) {
317
310
  return asyncComputeRealValue(debugData.value, runtimeContext);
318
311
  }
319
312
  export function getLegalRuntimeValue(options) {
313
+ var _runtimeContext$overr;
320
314
  const runtimeContext = _internalApiGetRuntimeContext();
321
315
  return {
322
- app: (runtimeContext === null || runtimeContext === void 0 ? void 0 : runtimeContext.overrideApp) ?? (runtimeContext === null || runtimeContext === void 0 ? void 0 : runtimeContext.app),
316
+ app: (_runtimeContext$overr = runtimeContext === null || runtimeContext === void 0 ? void 0 : runtimeContext.overrideApp) !== null && _runtimeContext$overr !== void 0 ? _runtimeContext$overr : runtimeContext === null || runtimeContext === void 0 ? void 0 : runtimeContext.app,
323
317
  location: pick(location, ["href", "origin", "hostname", "host"]),
324
318
  ...pick(runtimeContext, ["query", "sys"]),
325
319
  match: getMatchedRoute(options === null || options === void 0 ? void 0 : options.routeId)
@@ -1 +1 @@
1
- {"version":3,"file":"secret_internals.js","names":["pick","_internalApiGetRenderId","_internalApiGetRuntimeContext","_internalApiGetStoryboardInBootstrapData","getBrickPackages","createScopedRuntimeContext","postAsyncRender","renderBrick","RendererContext","resolveData","asyncComputeRealValue","mountTree","unmountTree","RenderTag","computeRealValue","isStrictMode","warnAboutStrictMode","customTemplates","registerAppI18n","getTplStateStore","loadBricksImperatively","loadEditorsImperatively","getMatchedRoute","symbolForRootRuntimeContext","Symbol","for","renderUseBrick","useBrick","data","errorBoundary","_output$node","_output$node2","scopedRuntimeContext","tplStateStoreScope","formStateStoreScope","pendingPermissionsPreCheck","tplStateStoreMap","Map","formStateStoreMap","rendererContext","renderRoot","tag","ROOT","createPortal","transform","strict","output","properties","scopedStores","node","PLACEHOLDER","Error","portal","child","tagName","type","mountUseBrick","_ref","element","portalRoot","document","querySelector","createElement","appendChild","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","initializeMessageDispatcher","store","mountAsyncData","unmountUseBrick","_ref2","mountResult","remove","dispatchOnUnmount","dispose","legacyDoTransform","to","options","noInject","updateStoryboard","appId","storyboardPatch","storyboard","Object","assign","meta","$$fulfilling","$$fulfilled","$$registerCustomTemplateProcessed","updateStoryboardByRoute","newRoute","matched","matchRoute","route","path","exact","replaceRoutes","routes","forEach","index","Array","isArray","bricks","replaceBricks","brick","slots","slotConf","values","unshift","updateStoryboardByTemplate","newTemplate","settings","tplName","name","define","proxy","state","updateTemplatePreviewSettings","templateId","_updatePreviewSettings","getSnippetPreviewPath","snippetId","updateStoryboardBySnippet","snippetData","_snippetData$bricks","length","context","updateSnippetPreviewSettings","previewRouteIndex","findIndex","newPreviewRoute","menu","splice","getContextValue","_ref3","tplStateStoreId","runtimeContext","tplStateStore","getValue","ctxStore","getAllContextValues","_ref4","getAllValues","getBrickPackagesById","id","find","pkg","filePath","startsWith","loadBricks","loadEditors","editors","brickPackages","getRenderId","getAddedContracts","_ref5","updateStoryboardType","collectUsedContracts","updatedStoryboard","_storyboard$routes","snippetPreviewPath","currentRoute","addedContracts","contractApis","api","_storyboard$meta","_","namespaceId","match","contracts","some","contract","push","debugDataValue","debugData","_ref6","routeId","resolve","cache","value","getLegalRuntimeValue","app","overrideApp","location","setRealTimeDataInspectRoot","addRealTimeDataInspectHook"],"sources":["../../../src/internal/secret_internals.ts"],"sourcesContent":["import type {\n BrickConf,\n CustomTemplate,\n RouteConf,\n Storyboard,\n UseSingleBrickConf,\n RuntimeSnippet,\n ContextConf,\n BrickPackage,\n RouteConfOfBricks,\n} from \"@next-core/types\";\nimport { pick } from \"lodash\";\nimport {\n _internalApiGetRenderId,\n _internalApiGetRuntimeContext,\n _internalApiGetStoryboardInBootstrapData,\n getBrickPackages,\n} from \"./Runtime.js\";\nimport {\n createScopedRuntimeContext,\n postAsyncRender,\n renderBrick,\n} from \"./Renderer.js\";\nimport { RendererContext } from \"./RendererContext.js\";\nimport type { DataStore } from \"./data/DataStore.js\";\nimport { resolveData } from \"./data/resolveData.js\";\nimport { asyncComputeRealValue } from \"./compute/computeRealValue.js\";\nimport type {\n DataValueOption,\n PreviewOption,\n PreviewStoryboardPatch,\n RenderRoot,\n RuntimeContext,\n DebugDataValue,\n RuntimeDataVale,\n RuntimeDataValueOption,\n} from \"./interfaces.js\";\nimport { mountTree, unmountTree } from \"./mount.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { computeRealValue } from \"./compute/computeRealValue.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"../isStrictMode.js\";\nimport { customTemplates } from \"../CustomTemplates.js\";\nimport { registerAppI18n } from \"./registerAppI18n.js\";\nimport { getTplStateStore } from \"./CustomTemplates/utils.js\";\nimport {\n loadBricksImperatively,\n loadEditorsImperatively,\n} from \"@next-core/loader\";\nimport { getMatchedRoute } from \"./routeMatchedMap.js\";\n\nexport type { DataValueOption, RuntimeContext };\n\nexport const symbolForRootRuntimeContext = Symbol.for(\"root.runtimeContext\");\n\nexport interface RuntimeUseBrickConfWithRootSymbols extends UseSingleBrickConf {\n [symbolForRootRuntimeContext]?: RuntimeContext;\n}\n\nexport interface RenderUseBrickResult {\n tagName: string | null;\n renderRoot: RenderRoot;\n rendererContext: RendererContext;\n scopedStores: DataStore<\"STATE\" | \"FORM_STATE\">[];\n}\n\nexport async function renderUseBrick(\n useBrick: RuntimeUseBrickConfWithRootSymbols,\n data: unknown,\n errorBoundary?: boolean\n): Promise<RenderUseBrickResult> {\n const [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope] =\n createScopedRuntimeContext({\n ...(useBrick[symbolForRootRuntimeContext] ??\n _internalApiGetRuntimeContext()!),\n data,\n pendingPermissionsPreCheck: [],\n });\n\n scopedRuntimeContext.tplStateStoreMap ??= new Map();\n scopedRuntimeContext.formStateStoreMap ??= new Map();\n\n const rendererContext = new RendererContext(\"fragment\");\n\n const renderRoot: RenderRoot = {\n tag: RenderTag.ROOT,\n // Will set during `mountUseBrick`\n createPortal: null!,\n };\n\n const transform = (useBrick as { transform?: Record<string, unknown> })\n .transform;\n const strict = isStrictMode();\n if (transform) {\n warnAboutStrictMode(\n strict,\n \"`useBrick.transform`\",\n 'please use \"properties\" instead, check your useBrick:',\n useBrick\n );\n }\n\n const output = await renderBrick(\n renderRoot,\n strict && !errorBoundary\n ? useBrick\n : {\n errorBoundary,\n ...useBrick,\n properties: {\n ...useBrick.properties,\n ...transform,\n },\n },\n scopedRuntimeContext,\n rendererContext,\n [],\n {}\n );\n\n const scopedStores = [...tplStateStoreScope, ...formStateStoreScope];\n\n await postAsyncRender(output, scopedRuntimeContext, scopedStores);\n\n if (output.node?.tag === RenderTag.PLACEHOLDER) {\n throw new Error(\n \"The root brick of useBrick cannot be an ignored control node\"\n );\n }\n\n if (output.node?.portal) {\n throw new Error(\"The root brick of useBrick cannot be a portal brick\");\n }\n\n renderRoot.child = output.node;\n\n const tagName = output.node ? output.node.type : null;\n\n return { tagName, renderRoot, rendererContext, scopedStores };\n}\n\nexport interface MountUseBrickResult {\n portal?: HTMLElement;\n}\n\nexport function mountUseBrick(\n { renderRoot, rendererContext, scopedStores }: RenderUseBrickResult,\n element: HTMLElement\n): MountUseBrickResult {\n let portal: HTMLElement | undefined;\n renderRoot.createPortal = () => {\n const portalRoot = document.querySelector(\n \"#portal-mount-point\"\n ) as HTMLElement;\n portal = document.createElement(\"div\");\n portalRoot.appendChild(portal);\n return portal;\n };\n\n mountTree(renderRoot, element);\n\n rendererContext.dispatchOnMount();\n rendererContext.initializeScrollIntoView();\n rendererContext.initializeMediaChange();\n rendererContext.initializeMessageDispatcher();\n\n for (const store of scopedStores) {\n store.mountAsyncData();\n }\n\n return {\n portal,\n };\n}\n\nexport function unmountUseBrick(\n { rendererContext }: RenderUseBrickResult,\n mountResult: MountUseBrickResult\n): void {\n // if (mountResult.mainBrick) {\n // mountResult.mainBrick.unmount();\n // }\n if (mountResult.portal) {\n unmountTree(mountResult.portal);\n mountResult.portal.remove();\n }\n rendererContext.dispatchOnUnmount();\n rendererContext.dispose();\n}\n\n/** For v2 compatibility of `doTransform` from brick-kit. */\nexport function legacyDoTransform(\n data: unknown,\n to: unknown,\n options?: unknown\n) {\n if (options) {\n throw new Error(\"Legacy doTransform does not support options in v3\");\n }\n return computeRealValue(\n to,\n {\n ..._internalApiGetRuntimeContext()!,\n data,\n },\n {\n noInject: true,\n }\n );\n}\n\nexport function updateStoryboard(\n appId: string,\n storyboardPatch: Partial<Storyboard>\n): void {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId)!;\n Object.assign(storyboard, {\n ...storyboardPatch,\n meta: {\n // Keep runtime fields such as `injectMenus`\n ...storyboard.meta,\n ...storyboardPatch.meta,\n },\n $$fulfilling: null,\n $$fulfilled: true,\n $$registerCustomTemplateProcessed: false,\n });\n registerAppI18n(storyboard);\n}\n\nexport function updateStoryboardByRoute(appId: string, newRoute: RouteConf) {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId)!;\n let matched = false;\n\n function matchRoute(route: RouteConf) {\n return route.path === newRoute.path && !route.exact === !newRoute.exact;\n }\n\n function replaceRoutes(routes: RouteConf[]) {\n routes.forEach((route, index) => {\n if (route.type === \"routes\") {\n replaceRoutes(route.routes);\n } else {\n if (matchRoute(route)) {\n matched = true;\n routes[index] = newRoute;\n } else if (Array.isArray((route as RouteConfOfBricks).bricks)) {\n replaceBricks((route as RouteConfOfBricks).bricks);\n }\n }\n });\n }\n\n function replaceBricks(bricks: BrickConf[]) {\n bricks.forEach((brick) => {\n if (brick.slots) {\n for (const slotConf of Object.values(brick.slots)) {\n if (slotConf.type === \"routes\") {\n replaceRoutes(slotConf.routes);\n } else {\n replaceBricks(slotConf.bricks);\n }\n }\n }\n });\n }\n\n replaceRoutes(storyboard.routes);\n\n if (!matched) {\n storyboard.routes.unshift(newRoute);\n }\n}\n\nexport function updateStoryboardByTemplate(\n appId: string,\n newTemplate: CustomTemplate,\n settings: unknown\n): void {\n const tplName = `${appId}.${newTemplate.name}`;\n // customTemplateRegistry.delete(tplName);\n customTemplates.define(tplName, {\n bricks: newTemplate.bricks,\n proxy: newTemplate.proxy,\n state: newTemplate.state,\n });\n updateTemplatePreviewSettings(appId, newTemplate.name, settings);\n}\n\nexport function updateTemplatePreviewSettings(\n appId: string,\n templateId: string,\n settings?: unknown\n): void {\n _updatePreviewSettings(\n appId,\n `\\${APP.homepage}/_dev_only_/template-preview/${templateId}`,\n [\n {\n brick: templateId,\n ...pick(\n settings,\n \"properties\",\n \"events\",\n \"lifeCycle\",\n \"context\",\n \"slots\",\n \"children\"\n ),\n },\n ]\n );\n}\n\nfunction getSnippetPreviewPath(snippetId: string): string {\n return `\\${APP.homepage}/_dev_only_/snippet-preview/${snippetId}`;\n}\n\nexport function updateStoryboardBySnippet(\n appId: string,\n snippetData: {\n snippetId: string;\n bricks?: BrickConf[];\n context?: ContextConf[];\n }\n): void {\n _updatePreviewSettings(\n appId,\n getSnippetPreviewPath(snippetData.snippetId),\n snippetData.bricks?.length ? snippetData.bricks : [{ brick: \"span\" }],\n snippetData.context\n );\n}\n\nexport const updateSnippetPreviewSettings = updateStoryboardBySnippet;\n\nfunction _updatePreviewSettings(\n appId: string,\n path: string,\n bricks: BrickConf[],\n context?: ContextConf[]\n) {\n const { routes } = _internalApiGetStoryboardInBootstrapData(appId)!;\n const previewRouteIndex = routes.findIndex((route) => route.path === path);\n const newPreviewRoute: RouteConf = {\n path,\n bricks,\n context,\n menu: false,\n exact: true,\n };\n if (previewRouteIndex === -1) {\n routes.unshift(newPreviewRoute);\n } else {\n routes.splice(previewRouteIndex, 1, newPreviewRoute);\n }\n}\n\nexport function getContextValue(\n name: string,\n { tplStateStoreId }: DataValueOption\n): unknown {\n const runtimeContext = _internalApiGetRuntimeContext()!;\n\n if (tplStateStoreId) {\n const tplStateStore = getTplStateStore(\n {\n ...runtimeContext,\n tplStateStoreId,\n },\n \"STATE\"\n );\n return tplStateStore.getValue(name);\n }\n\n return runtimeContext.ctxStore.getValue(name);\n}\n\nexport function getAllContextValues({\n tplStateStoreId,\n}: DataValueOption): Record<string, unknown> {\n const runtimeContext = _internalApiGetRuntimeContext()!;\n\n if (tplStateStoreId) {\n const tplStateStore = getTplStateStore(\n {\n ...runtimeContext,\n tplStateStoreId,\n },\n \"STATE\"\n );\n return tplStateStore.getAllValues();\n }\n\n return runtimeContext.ctxStore.getAllValues();\n}\n\nexport function getBrickPackagesById(id: string) {\n return getBrickPackages().find((pkg) =>\n pkg.id ? pkg.id === id : pkg.filePath.startsWith(`${id}/`)\n );\n}\n\n/**\n * Support loading v3 bricks only.\n */\nexport function loadBricks(bricks: string[]) {\n return loadBricksImperatively(bricks, getBrickPackages());\n}\n\n/**\n * Try the brick packages passed in, before using from bootstrap.\n */\nexport function loadEditors(\n editors: string[] | Set<string>,\n brickPackages?: BrickPackage[]\n) {\n return loadEditorsImperatively(editors, brickPackages ?? getBrickPackages());\n}\n\nexport function getRenderId() {\n return _internalApiGetRenderId();\n}\n\nexport async function getAddedContracts(\n storyboardPatch: PreviewStoryboardPatch,\n { appId, updateStoryboardType, collectUsedContracts }: PreviewOption\n): Promise<string[]> {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId);\n let updatedStoryboard;\n\n // 拿到更新部分的 storyboard 配置,然后扫描一遍,找到新增的 contracts\n if (updateStoryboardType === \"route\") {\n updatedStoryboard = {\n routes: [storyboardPatch as RouteConf],\n } as Storyboard;\n } else if (updateStoryboardType === \"template\") {\n updatedStoryboard = {\n meta: {\n customTemplates: [storyboardPatch as CustomTemplate],\n },\n } as Storyboard;\n } else if (updateStoryboardType === \"snippet\") {\n // snippet 是放在挂载 route 里预览,通过 previewPath 拿到当前修改 route\n const snippetPreviewPath = getSnippetPreviewPath(\n (storyboardPatch as RuntimeSnippet).snippetId\n );\n const currentRoute = storyboard?.routes?.find(\n (route) => route.path === snippetPreviewPath\n );\n\n updatedStoryboard = {\n routes: [currentRoute],\n } as Storyboard;\n }\n\n const addedContracts: string[] = [];\n\n if (updatedStoryboard && collectUsedContracts) {\n const contractApis = await collectUsedContracts(updatedStoryboard);\n\n contractApis.forEach((api: string) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [_, namespaceId, name] = api.match(\n /(.*)@(.*):\\d\\.\\d\\.\\d/\n ) as string[];\n\n if (\n !storyboard?.meta?.contracts?.some(\n (contract) =>\n contract.namespaceId === namespaceId && contract.name === name\n )\n ) {\n addedContracts.push(api);\n }\n });\n }\n\n return addedContracts;\n}\n\nexport async function debugDataValue(\n debugData: DebugDataValue,\n { tplStateStoreId, routeId }: DataValueOption\n): Promise<any> {\n const runtimeContext = {\n ..._internalApiGetRuntimeContext()!,\n tplStateStoreId,\n match: getMatchedRoute(routeId as string),\n };\n\n if (debugData.resolve) {\n return resolveData(debugData.resolve!, runtimeContext, { cache: \"reload\" });\n }\n\n return asyncComputeRealValue(debugData.value, runtimeContext);\n}\n\nexport function getLegalRuntimeValue(\n options?: RuntimeDataValueOption\n): RuntimeDataVale {\n const runtimeContext = _internalApiGetRuntimeContext();\n\n return {\n app: runtimeContext?.overrideApp ?? runtimeContext?.app,\n location: pick(location, [\"href\", \"origin\", \"hostname\", \"host\"]),\n ...pick(runtimeContext, [\"query\", \"sys\"]),\n match: getMatchedRoute(options?.routeId as string),\n } as RuntimeDataVale;\n}\n\nexport {\n setRealTimeDataInspectRoot,\n addRealTimeDataInspectHook,\n} from \"./data/realTimeDataInspect.js\";\n"],"mappings":"AAWA,SAASA,IAAI,QAAQ,QAAQ;AAC7B,SACEC,uBAAuB,EACvBC,6BAA6B,EAC7BC,wCAAwC,EACxCC,gBAAgB,QACX,cAAc;AACrB,SACEC,0BAA0B,EAC1BC,eAAe,EACfC,WAAW,QACN,eAAe;AACtB,SAASC,eAAe,QAAQ,sBAAsB;AAEtD,SAASC,WAAW,QAAQ,uBAAuB;AACnD,SAASC,qBAAqB,QAAQ,+BAA+B;AAWrE,SAASC,SAAS,EAAEC,WAAW,QAAQ,YAAY;AACnD,SAASC,SAAS,QAAQ,YAAY;AACtC,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SAASC,YAAY,EAAEC,mBAAmB,QAAQ,oBAAoB;AACtE,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SACEC,sBAAsB,EACtBC,uBAAuB,QAClB,mBAAmB;AAC1B,SAASC,eAAe,QAAQ,sBAAsB;AAItD,OAAO,MAAMC,2BAA2B,GAAGC,MAAM,CAACC,GAAG,CAAC,qBAAqB,CAAC;AAa5E,OAAO,eAAeC,cAAcA,CAClCC,QAA4C,EAC5CC,IAAa,EACbC,aAAuB,EACQ;EAAA,IAAAC,YAAA,EAAAC,aAAA;EAC/B,MAAM,CAACC,oBAAoB,EAAEC,kBAAkB,EAAEC,mBAAmB,CAAC,GACnE7B,0BAA0B,CAAC;IACzB,IAAIsB,QAAQ,CAACJ,2BAA2B,CAAC,IACvCrB,6BAA6B,CAAC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,IAAIF,SAAS,CAACG,OAAO,EAAE;IACrB,OAAOzK,WAAW,CAACsK,SAAS,CAACG,OAAO,EAAGzC,cAAc,EAAE;MAAE0C,KAAK,EAAE;IAAS,CAAC,CAAC;EAC7E;EAEA,OAAOzK,qBAAqB,CAACqK,SAAS,CAACK,KAAK,EAAE3C,cAAc,CAAC;AAC/D;AAEA,OAAO,SAAS4C,oBAAoBA,CAClCvG,OAAgC,EACf;EACjB,MAAM2D,cAAc,GAAGvI,6BAA6B,CAAC,CAAC;EAEtD,OAAO;IACLoL,GAAG,EAAE,CAAA7C,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAE8C,WAAW,MAAI9C,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAE6C,GAAG;IACvDE,QAAQ,EAAExL,IAAI,CAACwL,QAAQ,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IAChE,GAAGxL,IAAI,CAACyI,cAAc,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACzCgC,KAAK,EAAEnJ,eAAe,CAACwD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEmG,OAAiB;EACnD,CAAC;AACH;AAEA,SACEQ,0BAA0B,EAC1BC,0BAA0B,QACrB,+BAA+B","ignoreList":[]}
1
+ {"version":3,"file":"secret_internals.js","names":["pick","_internalApiGetRenderId","_internalApiGetRuntimeContext","_internalApiGetStoryboardInBootstrapData","getBrickPackages","createScopedRuntimeContext","postAsyncRender","renderBrick","RendererContext","resolveData","asyncComputeRealValue","mountTree","unmountTree","RenderTag","computeRealValue","isStrictMode","customTemplates","registerAppI18n","getTplStateStore","loadBricksImperatively","loadEditorsImperatively","getMatchedRoute","symbolForRootRuntimeContext","Symbol","for","renderUseBrick","useBrick","data","errorBoundary","_useBrick$symbolForRo","_scopedRuntimeContext","_scopedRuntimeContext2","_output$node","_output$node2","scopedRuntimeContext","tplStateStoreScope","formStateStoreScope","pendingPermissionsPreCheck","inUseBrick","tplStateStoreMap","Map","formStateStoreMap","rendererContext","renderRoot","tag","ROOT","createPortal","strict","output","scopedStores","node","PLACEHOLDER","Error","portal","child","tagName","type","mountUseBrick","_ref","element","portalRoot","document","querySelector","createElement","appendChild","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","initializeMessageDispatcher","store","mountAsyncData","unmountUseBrick","_ref2","mountResult","remove","dispatchOnUnmount","dispose","legacyDoTransform","to","options","noInject","updateStoryboard","appId","storyboardPatch","storyboard","Object","assign","meta","$$fulfilling","$$fulfilled","$$registerCustomTemplateProcessed","updateStoryboardByRoute","newRoute","matched","matchRoute","route","path","exact","replaceRoutes","routes","forEach","index","Array","isArray","bricks","replaceBricks","brick","slots","slotConf","values","unshift","updateStoryboardByTemplate","newTemplate","settings","tplName","name","define","proxy","state","updateTemplatePreviewSettings","templateId","_updatePreviewSettings","getSnippetPreviewPath","snippetId","updateStoryboardBySnippet","snippetData","_snippetData$bricks","length","context","updateSnippetPreviewSettings","previewRouteIndex","findIndex","newPreviewRoute","menu","splice","getContextValue","_ref3","tplStateStoreId","runtimeContext","tplStateStore","getValue","ctxStore","getAllContextValues","_ref4","getAllValues","getBrickPackagesById","id","find","pkg","filePath","startsWith","loadBricks","loadEditors","editors","brickPackages","getRenderId","getAddedContracts","_ref5","updateStoryboardType","collectUsedContracts","updatedStoryboard","_storyboard$routes","snippetPreviewPath","currentRoute","addedContracts","contractApis","api","_storyboard$meta","_","namespaceId","match","contracts","some","contract","push","debugDataValue","debugData","_ref6","routeId","resolve","cache","value","getLegalRuntimeValue","_runtimeContext$overr","app","overrideApp","location","setRealTimeDataInspectRoot","addRealTimeDataInspectHook"],"sources":["../../../src/internal/secret_internals.ts"],"sourcesContent":["import type {\n BrickConf,\n CustomTemplate,\n RouteConf,\n Storyboard,\n UseSingleBrickConf,\n RuntimeSnippet,\n ContextConf,\n BrickPackage,\n RouteConfOfBricks,\n} from \"@next-core/types\";\nimport { pick } from \"lodash\";\nimport {\n _internalApiGetRenderId,\n _internalApiGetRuntimeContext,\n _internalApiGetStoryboardInBootstrapData,\n getBrickPackages,\n} from \"./Runtime.js\";\nimport {\n createScopedRuntimeContext,\n postAsyncRender,\n renderBrick,\n} from \"./Renderer.js\";\nimport { RendererContext } from \"./RendererContext.js\";\nimport type { DataStore } from \"./data/DataStore.js\";\nimport { resolveData } from \"./data/resolveData.js\";\nimport { asyncComputeRealValue } from \"./compute/computeRealValue.js\";\nimport type {\n DataValueOption,\n PreviewOption,\n PreviewStoryboardPatch,\n RenderRoot,\n RuntimeContext,\n DebugDataValue,\n RuntimeDataVale,\n RuntimeDataValueOption,\n} from \"./interfaces.js\";\nimport { mountTree, unmountTree } from \"./mount.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { computeRealValue } from \"./compute/computeRealValue.js\";\nimport { isStrictMode } from \"../isStrictMode.js\";\nimport { customTemplates } from \"../CustomTemplates.js\";\nimport { registerAppI18n } from \"./registerAppI18n.js\";\nimport { getTplStateStore } from \"./CustomTemplates/utils.js\";\nimport {\n loadBricksImperatively,\n loadEditorsImperatively,\n} from \"@next-core/loader\";\nimport { getMatchedRoute } from \"./routeMatchedMap.js\";\n\nexport type { DataValueOption, RuntimeContext };\n\nexport const symbolForRootRuntimeContext = Symbol.for(\"root.runtimeContext\");\n\nexport interface RuntimeUseBrickConfWithRootSymbols extends UseSingleBrickConf {\n [symbolForRootRuntimeContext]?: RuntimeContext;\n}\n\nexport interface RenderUseBrickResult {\n tagName: string | null;\n renderRoot: RenderRoot;\n rendererContext: RendererContext;\n scopedStores: DataStore<\"STATE\" | \"FORM_STATE\">[];\n}\n\nexport async function renderUseBrick(\n useBrick: RuntimeUseBrickConfWithRootSymbols,\n data: unknown,\n errorBoundary?: boolean\n): Promise<RenderUseBrickResult> {\n const [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope] =\n createScopedRuntimeContext({\n ...(useBrick[symbolForRootRuntimeContext] ??\n _internalApiGetRuntimeContext()!),\n data,\n pendingPermissionsPreCheck: [],\n });\n\n scopedRuntimeContext.inUseBrick = true;\n scopedRuntimeContext.tplStateStoreMap ??= new Map();\n scopedRuntimeContext.formStateStoreMap ??= new Map();\n\n const rendererContext = new RendererContext(\"fragment\");\n\n const renderRoot: RenderRoot = {\n tag: RenderTag.ROOT,\n // Will set during `mountUseBrick`\n createPortal: null!,\n };\n\n const strict = isStrictMode();\n\n const output = await renderBrick(\n renderRoot,\n strict && !errorBoundary\n ? useBrick\n : {\n errorBoundary,\n ...useBrick,\n },\n scopedRuntimeContext,\n rendererContext,\n [],\n {}\n );\n\n const scopedStores = [...tplStateStoreScope, ...formStateStoreScope];\n\n await postAsyncRender(output, scopedRuntimeContext, scopedStores);\n\n if (output.node?.tag === RenderTag.PLACEHOLDER) {\n throw new Error(\n \"The root brick of useBrick cannot be an ignored control node\"\n );\n }\n\n if (output.node?.portal) {\n throw new Error(\"The root brick of useBrick cannot be a portal brick\");\n }\n\n renderRoot.child = output.node;\n\n const tagName = output.node ? output.node.type : null;\n\n return { tagName, renderRoot, rendererContext, scopedStores };\n}\n\nexport interface MountUseBrickResult {\n portal?: HTMLElement;\n}\n\nexport function mountUseBrick(\n { renderRoot, rendererContext, scopedStores }: RenderUseBrickResult,\n element: HTMLElement\n): MountUseBrickResult {\n let portal: HTMLElement | undefined;\n renderRoot.createPortal = () => {\n const portalRoot = document.querySelector(\n \"#portal-mount-point\"\n ) as HTMLElement;\n portal = document.createElement(\"div\");\n portalRoot.appendChild(portal);\n return portal;\n };\n\n mountTree(renderRoot, element);\n\n rendererContext.dispatchOnMount();\n rendererContext.initializeScrollIntoView();\n rendererContext.initializeMediaChange();\n rendererContext.initializeMessageDispatcher();\n\n for (const store of scopedStores) {\n store.mountAsyncData();\n }\n\n return {\n portal,\n };\n}\n\nexport function unmountUseBrick(\n { rendererContext }: RenderUseBrickResult,\n mountResult: MountUseBrickResult\n): void {\n // if (mountResult.mainBrick) {\n // mountResult.mainBrick.unmount();\n // }\n if (mountResult.portal) {\n unmountTree(mountResult.portal);\n mountResult.portal.remove();\n }\n rendererContext.dispatchOnUnmount();\n rendererContext.dispose();\n}\n\n/** For v2 compatibility of `doTransform` from brick-kit. */\nexport function legacyDoTransform(\n data: unknown,\n to: unknown,\n options?: unknown\n) {\n if (options) {\n throw new Error(\"Legacy doTransform does not support options in v3\");\n }\n return computeRealValue(\n to,\n {\n ..._internalApiGetRuntimeContext()!,\n data,\n },\n {\n noInject: true,\n }\n );\n}\n\nexport function updateStoryboard(\n appId: string,\n storyboardPatch: Partial<Storyboard>\n): void {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId)!;\n Object.assign(storyboard, {\n ...storyboardPatch,\n meta: {\n // Keep runtime fields such as `injectMenus`\n ...storyboard.meta,\n ...storyboardPatch.meta,\n },\n $$fulfilling: null,\n $$fulfilled: true,\n $$registerCustomTemplateProcessed: false,\n });\n registerAppI18n(storyboard);\n}\n\nexport function updateStoryboardByRoute(appId: string, newRoute: RouteConf) {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId)!;\n let matched = false;\n\n function matchRoute(route: RouteConf) {\n return route.path === newRoute.path && !route.exact === !newRoute.exact;\n }\n\n function replaceRoutes(routes: RouteConf[]) {\n routes.forEach((route, index) => {\n if (route.type === \"routes\") {\n replaceRoutes(route.routes);\n } else {\n if (matchRoute(route)) {\n matched = true;\n routes[index] = newRoute;\n } else if (Array.isArray((route as RouteConfOfBricks).bricks)) {\n replaceBricks((route as RouteConfOfBricks).bricks);\n }\n }\n });\n }\n\n function replaceBricks(bricks: BrickConf[]) {\n bricks.forEach((brick) => {\n if (brick.slots) {\n for (const slotConf of Object.values(brick.slots)) {\n if (slotConf.type === \"routes\") {\n replaceRoutes(slotConf.routes);\n } else {\n replaceBricks(slotConf.bricks);\n }\n }\n }\n });\n }\n\n replaceRoutes(storyboard.routes);\n\n if (!matched) {\n storyboard.routes.unshift(newRoute);\n }\n}\n\nexport function updateStoryboardByTemplate(\n appId: string,\n newTemplate: CustomTemplate,\n settings: unknown\n): void {\n const tplName = `${appId}.${newTemplate.name}`;\n // customTemplateRegistry.delete(tplName);\n customTemplates.define(tplName, {\n bricks: newTemplate.bricks,\n proxy: newTemplate.proxy,\n state: newTemplate.state,\n });\n updateTemplatePreviewSettings(appId, newTemplate.name, settings);\n}\n\nexport function updateTemplatePreviewSettings(\n appId: string,\n templateId: string,\n settings?: unknown\n): void {\n _updatePreviewSettings(\n appId,\n `\\${APP.homepage}/_dev_only_/template-preview/${templateId}`,\n [\n {\n brick: templateId,\n ...pick(\n settings,\n \"properties\",\n \"events\",\n \"lifeCycle\",\n \"context\",\n \"slots\",\n \"children\"\n ),\n },\n ]\n );\n}\n\nfunction getSnippetPreviewPath(snippetId: string): string {\n return `\\${APP.homepage}/_dev_only_/snippet-preview/${snippetId}`;\n}\n\nexport function updateStoryboardBySnippet(\n appId: string,\n snippetData: {\n snippetId: string;\n bricks?: BrickConf[];\n context?: ContextConf[];\n }\n): void {\n _updatePreviewSettings(\n appId,\n getSnippetPreviewPath(snippetData.snippetId),\n snippetData.bricks?.length ? snippetData.bricks : [{ brick: \"span\" }],\n snippetData.context\n );\n}\n\nexport const updateSnippetPreviewSettings = updateStoryboardBySnippet;\n\nfunction _updatePreviewSettings(\n appId: string,\n path: string,\n bricks: BrickConf[],\n context?: ContextConf[]\n) {\n const { routes } = _internalApiGetStoryboardInBootstrapData(appId)!;\n const previewRouteIndex = routes.findIndex((route) => route.path === path);\n const newPreviewRoute: RouteConf = {\n path,\n bricks,\n context,\n menu: false,\n exact: true,\n };\n if (previewRouteIndex === -1) {\n routes.unshift(newPreviewRoute);\n } else {\n routes.splice(previewRouteIndex, 1, newPreviewRoute);\n }\n}\n\nexport function getContextValue(\n name: string,\n { tplStateStoreId }: DataValueOption\n): unknown {\n const runtimeContext = _internalApiGetRuntimeContext()!;\n\n if (tplStateStoreId) {\n const tplStateStore = getTplStateStore(\n {\n ...runtimeContext,\n tplStateStoreId,\n },\n \"STATE\"\n );\n return tplStateStore.getValue(name);\n }\n\n return runtimeContext.ctxStore.getValue(name);\n}\n\nexport function getAllContextValues({\n tplStateStoreId,\n}: DataValueOption): Record<string, unknown> {\n const runtimeContext = _internalApiGetRuntimeContext()!;\n\n if (tplStateStoreId) {\n const tplStateStore = getTplStateStore(\n {\n ...runtimeContext,\n tplStateStoreId,\n },\n \"STATE\"\n );\n return tplStateStore.getAllValues();\n }\n\n return runtimeContext.ctxStore.getAllValues();\n}\n\nexport function getBrickPackagesById(id: string) {\n return getBrickPackages().find((pkg) =>\n pkg.id ? pkg.id === id : pkg.filePath.startsWith(`${id}/`)\n );\n}\n\n/**\n * Support loading v3 bricks only.\n */\nexport function loadBricks(bricks: string[]) {\n return loadBricksImperatively(bricks, getBrickPackages());\n}\n\n/**\n * Try the brick packages passed in, before using from bootstrap.\n */\nexport function loadEditors(\n editors: string[] | Set<string>,\n brickPackages?: BrickPackage[]\n) {\n return loadEditorsImperatively(editors, brickPackages ?? getBrickPackages());\n}\n\nexport function getRenderId() {\n return _internalApiGetRenderId();\n}\n\nexport async function getAddedContracts(\n storyboardPatch: PreviewStoryboardPatch,\n { appId, updateStoryboardType, collectUsedContracts }: PreviewOption\n): Promise<string[]> {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId);\n let updatedStoryboard;\n\n // 拿到更新部分的 storyboard 配置,然后扫描一遍,找到新增的 contracts\n if (updateStoryboardType === \"route\") {\n updatedStoryboard = {\n routes: [storyboardPatch as RouteConf],\n } as Storyboard;\n } else if (updateStoryboardType === \"template\") {\n updatedStoryboard = {\n meta: {\n customTemplates: [storyboardPatch as CustomTemplate],\n },\n } as Storyboard;\n } else if (updateStoryboardType === \"snippet\") {\n // snippet 是放在挂载 route 里预览,通过 previewPath 拿到当前修改 route\n const snippetPreviewPath = getSnippetPreviewPath(\n (storyboardPatch as RuntimeSnippet).snippetId\n );\n const currentRoute = storyboard?.routes?.find(\n (route) => route.path === snippetPreviewPath\n );\n\n updatedStoryboard = {\n routes: [currentRoute],\n } as Storyboard;\n }\n\n const addedContracts: string[] = [];\n\n if (updatedStoryboard && collectUsedContracts) {\n const contractApis = await collectUsedContracts(updatedStoryboard);\n\n contractApis.forEach((api: string) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [_, namespaceId, name] = api.match(\n /(.*)@(.*):\\d\\.\\d\\.\\d/\n ) as string[];\n\n if (\n !storyboard?.meta?.contracts?.some(\n (contract) =>\n contract.namespaceId === namespaceId && contract.name === name\n )\n ) {\n addedContracts.push(api);\n }\n });\n }\n\n return addedContracts;\n}\n\nexport async function debugDataValue(\n debugData: DebugDataValue,\n { tplStateStoreId, routeId }: DataValueOption\n): Promise<any> {\n const runtimeContext = {\n ..._internalApiGetRuntimeContext()!,\n tplStateStoreId,\n match: getMatchedRoute(routeId as string),\n };\n\n if (debugData.resolve) {\n return resolveData(debugData.resolve!, runtimeContext, { cache: \"reload\" });\n }\n\n return asyncComputeRealValue(debugData.value, runtimeContext);\n}\n\nexport function getLegalRuntimeValue(\n options?: RuntimeDataValueOption\n): RuntimeDataVale {\n const runtimeContext = _internalApiGetRuntimeContext();\n\n return {\n app: runtimeContext?.overrideApp ?? runtimeContext?.app,\n location: pick(location, [\"href\", \"origin\", \"hostname\", \"host\"]),\n ...pick(runtimeContext, [\"query\", \"sys\"]),\n match: getMatchedRoute(options?.routeId as string),\n } as RuntimeDataVale;\n}\n\nexport {\n setRealTimeDataInspectRoot,\n addRealTimeDataInspectHook,\n} from \"./data/realTimeDataInspect.js\";\n"],"mappings":"AAWA,SAASA,IAAI,QAAQ,QAAQ;AAC7B,SACEC,uBAAuB,EACvBC,6BAA6B,EAC7BC,wCAAwC,EACxCC,gBAAgB,QACX,cAAc;AACrB,SACEC,0BAA0B,EAC1BC,eAAe,EACfC,WAAW,QACN,eAAe;AACtB,SAASC,eAAe,QAAQ,sBAAsB;AAEtD,SAASC,WAAW,QAAQ,uBAAuB;AACnD,SAASC,qBAAqB,QAAQ,+BAA+B;AAWrE,SAASC,SAAS,EAAEC,WAAW,Q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M,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IAChE,GAAG1L,IAAI,CAAC0I,cAAc,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACzCgC,KAAK,EAAErJ,eAAe,CAAC0D,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEmG,OAAiB;EACnD,CAAC;AACH;AAEA,SACES,0BAA0B,EAC1BC,0BAA0B,QACrB,+BAA+B","ignoreList":[]}
@@ -33,8 +33,9 @@ export function setupRootRuntimeContext(bricks, runtimeContext, shallow) {
33
33
  return;
34
34
  }
35
35
  const transpiledSlots = childrenToSlots(brick.children, brick.slots);
36
- for (const slotConf of Object.values(transpiledSlots ?? {})) {
37
- for (const brick of slotConf.bricks ?? []) {
36
+ for (const slotConf of Object.values(transpiledSlots !== null && transpiledSlots !== void 0 ? transpiledSlots : {})) {
37
+ for (const brick of (_slotConf$bricks = slotConf.bricks) !== null && _slotConf$bricks !== void 0 ? _slotConf$bricks : []) {
38
+ var _slotConf$bricks;
38
39
  setupBrick(brick, inUseBrick);
39
40
  }
40
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"setupRootRuntimeContext.js","names":["isObject","symbolForRootRuntimeContext","childrenToSlots","setupRootRuntimeContext","bricks","runtimeContext","shallow","walk","props","Array","isArray","map","key","value","Object","entries","forEach","v","setupBrick","brick","inUseBrick","forceRecursive","properties","transpiledSlots","children","slots","slotConf","values"],"sources":["../../../src/internal/setupRootRuntimeContext.ts"],"sourcesContent":["import { isObject } from \"@next-core/utils/general\";\nimport type {\n BrickConf,\n UseBrickSlotsConf,\n UseSingleBrickConf,\n} from \"@next-core/types\";\nimport {\n RuntimeContext,\n RuntimeUseBrickConfWithRootSymbols,\n symbolForRootRuntimeContext,\n} from \"./secret_internals.js\";\nimport { childrenToSlots } from \"./Renderer.js\";\n\nexport function setupRootRuntimeContext(\n bricks: BrickConf[],\n runtimeContext: RuntimeContext,\n shallow?: boolean\n) {\n function walk(props: unknown) {\n if (!isObject(props) || typeof props === \"function\") {\n return;\n }\n\n if (Array.isArray(props)) {\n props.map(walk);\n return;\n }\n\n for (const [key, value] of Object.entries(props)) {\n if (isObject(value) && key === \"useBrick\") {\n if (Array.isArray(value)) {\n value.forEach((v) => setupBrick(v, true));\n } else {\n setupBrick(\n value as UseSingleBrickConf as RuntimeUseBrickConfWithRootSymbols,\n true,\n // For inside useBrick, we always need to setup recursively.\n true\n );\n }\n } else {\n walk(value);\n }\n }\n }\n\n function setupBrick(\n brick: BrickConf,\n inUseBrick?: boolean,\n forceRecursive?: boolean\n ) {\n if (inUseBrick) {\n (brick as RuntimeUseBrickConfWithRootSymbols)[\n symbolForRootRuntimeContext\n ] = runtimeContext;\n }\n\n walk(brick.properties);\n\n if (shallow && !forceRecursive) {\n return;\n }\n\n const transpiledSlots = childrenToSlots(brick.children, brick.slots) as\n | UseBrickSlotsConf\n | undefined;\n\n for (const slotConf of Object.values(transpiledSlots ?? {})) {\n for (const brick of slotConf.bricks ?? []) {\n setupBrick(brick, inUseBrick);\n }\n }\n }\n\n for (const brick of bricks) {\n setupBrick(brick);\n }\n}\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,0BAA0B;AAMnD,SAGEC,2BAA2B,QACtB,uBAAuB;AAC9B,SAASC,eAAe,QAAQ,eAAe;AAE/C,OAAO,SAASC,uBAAuBA,CACrCC,MAAmB,EACnBC,cAA8B,EAC9BC,OAAiB,EACjB;EACA,SAASC,IAAIA,CAACC,KAAc,EAAE;IAC5B,IAAI,CAACR,QAAQ,CAACQ,KAAK,CAAC,IAAI,OAAOA,KAAK,KAAK,UAAU,EAAE;MACnD;IACF;IAEA,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,EAAE;MACxBA,KAAK,CAACG,GAAG,CAACJ,IAAI,CAAC;MACf;IACF;IAEA,KAAK,MAAM,CAACK,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACP,KAAK,CAAC,EAAE;MAChD,IAAIR,QAAQ,CAACa,KAAK,CAAC,IAAID,GAAG,KAAK,UAAU,EAAE;QACzC,IAAIH,KAAK,CAACC,OAAO,CAACG,KAAK,CAAC,EAAE;UACxBA,KAAK,CAACG,OAAO,CAAEC,CAAC,IAAKC,UAAU,CAACD,CAAC,EAAE,IAAI,CAAC,CAAC;QAC3C,CAAC,MAAM;UACLC,UAAU,CACRL,KAAK,EACL,IAAI;UACJ;UACA,IACF,CAAC;QACH;MACF,CAAC,MAAM;QACLN,IAAI,CAACM,KAAK,CAAC;MACb;IACF;EACF;EAEA,SAASK,UAAUA,CACjBC,KAAgB,EAChBC,UAAoB,EACpBC,cAAwB,EACxB;IACA,IAAID,UAAU,EAAE;MACbD,KAAK,CACJlB,2BAA2B,CAC5B,GAAGI,cAAc;IACpB;IAEAE,IAAI,CAACY,KAAK,CAACG,UAAU,CAAC;IAEtB,IAAIhB,OAAO,IAAI,CAACe,cAAc,EAAE;MAC9B;IACF;IAEA,MAAME,eAAe,GAAGrB,eAAe,CAACiB,KAAK,CAACK,QAAQ,EAAEL,KAAK,CAACM,KAAK,CAEtD;IAEb,KAAK,MAAMC,QAAQ,IAAIZ,MAAM,CAACa,MAAM,CAACJ,eAAe,IAAI,CAAC,CAAC,CAAC,EAAE;MAC3D,KAAK,MAAMJ,KAAK,IAAIO,QAAQ,CAACtB,MAAM,IAAI,EAAE,EAAE;QACzCc,UAAU,CAACC,KAAK,EAAEC,UAAU,CAAC;MAC/B;IACF;EACF;EAEA,KAAK,MAAMD,KAAK,IAAIf,MAAM,EAAE;IAC1Bc,UAAU,CAACC,KAAK,CAAC;EACnB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"setupRootRuntimeContext.js","names":["isObject","symbolForRootRuntimeContext","childrenToSlots","setupRootRuntimeContext","bricks","runtimeContext","shallow","walk","props","Array","isArray","map","key","value","Object","entries","forEach","v","setupBrick","brick","inUseBrick","forceRecursive","properties","transpiledSlots","children","slots","slotConf","values","_slotConf$bricks"],"sources":["../../../src/internal/setupRootRuntimeContext.ts"],"sourcesContent":["import { isObject } from \"@next-core/utils/general\";\nimport type {\n BrickConf,\n UseBrickSlotsConf,\n UseSingleBrickConf,\n} from \"@next-core/types\";\nimport {\n RuntimeContext,\n RuntimeUseBrickConfWithRootSymbols,\n symbolForRootRuntimeContext,\n} from \"./secret_internals.js\";\nimport { childrenToSlots } from \"./Renderer.js\";\n\nexport function setupRootRuntimeContext(\n bricks: BrickConf[],\n runtimeContext: RuntimeContext,\n shallow?: boolean\n) {\n function walk(props: unknown) {\n if (!isObject(props) || typeof props === \"function\") {\n return;\n }\n\n if (Array.isArray(props)) {\n props.map(walk);\n return;\n }\n\n for (const [key, value] of Object.entries(props)) {\n if (isObject(value) && key === \"useBrick\") {\n if (Array.isArray(value)) {\n value.forEach((v) => setupBrick(v, true));\n } else {\n setupBrick(\n value as UseSingleBrickConf as RuntimeUseBrickConfWithRootSymbols,\n true,\n // For inside useBrick, we always need to setup recursively.\n true\n );\n }\n } else {\n walk(value);\n }\n }\n }\n\n function setupBrick(\n brick: BrickConf,\n inUseBrick?: boolean,\n forceRecursive?: boolean\n ) {\n if (inUseBrick) {\n (brick as RuntimeUseBrickConfWithRootSymbols)[\n symbolForRootRuntimeContext\n ] = runtimeContext;\n }\n\n walk(brick.properties);\n\n if (shallow && !forceRecursive) {\n return;\n }\n\n const transpiledSlots = childrenToSlots(brick.children, brick.slots) as\n | UseBrickSlotsConf\n | undefined;\n\n for (const slotConf of Object.values(transpiledSlots ?? {})) {\n for (const brick of slotConf.bricks ?? []) {\n setupBrick(brick, inUseBrick);\n }\n }\n }\n\n for (const brick of bricks) {\n setupBrick(brick);\n }\n}\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,0BAA0B;AAMnD,SAGEC,2BAA2B,QACtB,uBAAuB;AAC9B,SAASC,eAAe,QAAQ,eAAe;AAE/C,OAAO,SAASC,uBAAuBA,CACrCC,MAAmB,EACnBC,cAA8B,EAC9BC,OAAiB,EACjB;EACA,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,cAAAA,gBAAA,GAAI,EAAE,EAAE;QAAA,IAAAA,gBAAA;QACzCV,UAAU,CAACC,KAAK,EAAEC,UAAU,CAAC;MAC/B;IACF;EACF;EAEA,KAAK,MAAMD,KAAK,IAAIf,MAAM,EAAE;IAC1Bc,UAAU,CAACC,KAAK,CAAC;EACnB;AACF","ignoreList":[]}
@@ -4,18 +4,18 @@ import { omit } from "lodash";
4
4
  let brick;
5
5
  export const WATEMARK_BRICKNAME = "basic.show-watermark";
6
6
  export function setWatermark() {
7
- var _window$APP_ROOT, _window$APP_ROOT2, _hooks$auth, _watermarkConfig$flag, _watermarkConfig$flag2;
7
+ var _window$APP_ROOT, _window$APP_ROOT2, _username, _hooks$auth, _settings$watermarkCo, _watermarkConfig$cont, _watermarkConfig$flag, _watermarkConfig$flag2;
8
8
  const flags = getRuntime().getFeatureFlags();
9
9
  const settings = getRuntime().getMiscSettings();
10
10
  if (!flags["show-watermark"]) {
11
11
  return;
12
12
  }
13
13
  const isDeveloper = ((_window$APP_ROOT = window.APP_ROOT) === null || _window$APP_ROOT === void 0 || (_window$APP_ROOT = _window$APP_ROOT.match(/versions\/([^/]+)\//)) === null || _window$APP_ROOT === void 0 ? void 0 : _window$APP_ROOT[1]) === "0.0.0" || ((_window$APP_ROOT2 = window.APP_ROOT) === null || _window$APP_ROOT2 === void 0 || (_window$APP_ROOT2 = _window$APP_ROOT2.match(/micro-apps\/(?:v2|v3)\/[^/]+\/([^/]+)/)) === null || _window$APP_ROOT2 === void 0 ? void 0 : _window$APP_ROOT2[1]) === "0.0.0";
14
- const username = (hooks === null || hooks === void 0 || (_hooks$auth = hooks.auth) === null || _hooks$auth === void 0 || (_hooks$auth = _hooks$auth.getAuth()) === null || _hooks$auth === void 0 ? void 0 : _hooks$auth.username) ?? "";
15
- const watermarkConfig = settings.watermarkConfig ?? {
14
+ const username = (_username = hooks === null || hooks === void 0 || (_hooks$auth = hooks.auth) === null || _hooks$auth === void 0 || (_hooks$auth = _hooks$auth.getAuth()) === null || _hooks$auth === void 0 ? void 0 : _hooks$auth.username) !== null && _username !== void 0 ? _username : "";
15
+ const watermarkConfig = (_settings$watermarkCo = settings.watermarkConfig) !== null && _settings$watermarkCo !== void 0 ? _settings$watermarkCo : {
16
16
  flags: {}
17
17
  };
18
- const content = [...(typeof watermarkConfig.content === "string" ? [watermarkConfig.content] : watermarkConfig.content ?? []), (_watermarkConfig$flag = watermarkConfig.flags) !== null && _watermarkConfig$flag !== void 0 && _watermarkConfig$flag["show-development"] && isDeveloper ? "Development" : "", (_watermarkConfig$flag2 = watermarkConfig.flags) !== null && _watermarkConfig$flag2 !== void 0 && _watermarkConfig$flag2["show-user"] ? username : ""].filter(Boolean);
18
+ const content = [...(typeof watermarkConfig.content === "string" ? [watermarkConfig.content] : (_watermarkConfig$cont = watermarkConfig.content) !== null && _watermarkConfig$cont !== void 0 ? _watermarkConfig$cont : []), (_watermarkConfig$flag = watermarkConfig.flags) !== null && _watermarkConfig$flag !== void 0 && _watermarkConfig$flag["show-development"] && isDeveloper ? "Development" : "", (_watermarkConfig$flag2 = watermarkConfig.flags) !== null && _watermarkConfig$flag2 !== void 0 && _watermarkConfig$flag2["show-user"] ? username : ""].filter(Boolean);
19
19
 
20
20
  // Do not call showWatermark if there is no content
21
21
  if (content.length === 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"setWatermark.js","names":["loadBricksImperatively","getBrickPackages","getRuntime","hooks","omit","brick","WATEMARK_BRICKNAME","setWatermark","_window$APP_ROOT","_window$APP_ROOT2","_hooks$auth","_watermarkConfig$flag","_watermarkConfig$flag2","flags","getFeatureFlags","settings","getMiscSettings","isDeveloper","window","APP_ROOT","match","username","auth","getAuth","watermarkConfig","content","filter","Boolean","length","defaultProps","zIndex","width","font","fontSize","gap","resolve","then","document","createElement","error","console"],"sources":["../../src/setWatermark.ts"],"sourcesContent":["import { loadBricksImperatively } from \"@next-core/loader\";\nimport { getBrickPackages, getRuntime, hooks } from \"./internal/Runtime.js\";\nimport { omit } from \"lodash\";\n\ninterface WaterMarkProps {\n container?: HTMLElement;\n content?: string | string[];\n zIndex?: number;\n rotate?: number;\n width?: number;\n height?: number;\n image?: string;\n font?: {\n color?: CanvasFillStrokeStyles[\"fillStyle\"];\n fontSize?: number | string;\n fontWeight?: \"normal\" | \"light\" | \"weight\" | number;\n fontStyle?: \"none\" | \"normal\" | \"italic\" | \"oblique\";\n fontFamily?: string;\n textAlign?: CanvasTextAlign;\n };\n style?: React.CSSProperties;\n gap?: [number, number];\n offset?: [number, number];\n}\n\nlet brick: {\n resolve(options: WaterMarkProps): void;\n};\n\nexport const WATEMARK_BRICKNAME = \"basic.show-watermark\";\n\nexport function setWatermark() {\n const flags = getRuntime().getFeatureFlags();\n const settings = getRuntime().getMiscSettings();\n if (!flags[\"show-watermark\"]) {\n return;\n }\n const isDeveloper =\n window.APP_ROOT?.match(/versions\\/([^/]+)\\//)?.[1] === \"0.0.0\" ||\n window.APP_ROOT?.match(/micro-apps\\/(?:v2|v3)\\/[^/]+\\/([^/]+)/)?.[1] ===\n \"0.0.0\";\n const username =\n (hooks?.auth?.getAuth() as Record<string, any>)?.username ?? \"\";\n const watermarkConfig = (settings.watermarkConfig ?? {\n flags: {},\n }) as WaterMarkProps & {\n flags: {\n \"show-development\"?: boolean;\n \"show-user\"?: boolean;\n };\n };\n\n const content = [\n ...(typeof watermarkConfig.content === \"string\"\n ? [watermarkConfig.content]\n : watermarkConfig.content ?? []),\n watermarkConfig.flags?.[\"show-development\"] && isDeveloper\n ? \"Development\"\n : \"\",\n watermarkConfig.flags?.[\"show-user\"] ? username : \"\",\n ].filter(Boolean);\n\n // Do not call showWatermark if there is no content\n if (content.length === 0) {\n return;\n }\n\n const defaultProps: WaterMarkProps = {\n content,\n zIndex: 1001,\n width: 200,\n font: {\n fontSize: 28,\n },\n gap: [190, 190],\n ...omit(watermarkConfig, [\"content\", \"flags\"]),\n };\n if (brick) {\n brick.resolve(defaultProps);\n } else {\n loadBricksImperatively([WATEMARK_BRICKNAME], getBrickPackages()).then(\n () => {\n brick = document.createElement(WATEMARK_BRICKNAME) as any;\n\n brick.resolve(defaultProps);\n },\n // istanbul ignore next\n (error: unknown) => {\n // eslint-disable-next-line no-console\n console.error(\"Load watermark service failed:\", error);\n }\n );\n }\n}\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAQ,mBAAmB;AAC1D,SAASC,gBAAgB,EAAEC,UAAU,EAAEC,KAAK,QAAQ,uBAAuB;AAC3E,SAASC,IAAI,QAAQ,QAAQ;AAuB7B,IAAIC,KAEH;AAED,OAAO,MAAMC,kBAAkB,GAAG,sBAAsB;AAExD,OAAO,SAASC,YAAYA,CAAA,EAAG;EAAA,IAAAC,gBAAA,EAAAC,iBAAA,EAAAC,WAAA,EAAAC,qBAAA,EAAAC,sBAAA;EAC7B,MAAMC,KAAK,GAAGX,UAAU,CAAC,CAAC,CAACY,eAAe,CAAC,CAAC;EAC5C,MAAMC,QAAQ,GAAGb,UAAU,CAAC,CAAC,CAACc,eAAe,CAAC,CAAC;EAC/C,IAAI,CAACH,KAAK,CAAC,gBAAgB,CAAC,EAAE;IAC5B;EACF;EACA,MAAMI,WAAW,GACf,EAAAT,gBAAA,GAAAU,MAAM,CAACC,QAAQ,cAAAX,gBAAA,gBAAAA,gBAAA,GAAfA,gBAAA,CAAiBY,KAAK,CAAC,qBAAqB,CAAC,cAAAZ,gBAAA,uBAA7CA,gBAAA,CAAgD,CAAC,CAAC,MAAK,OAAO,IAC9D,EAAAC,iBAAA,GAAAS,MAAM,CAACC,QAAQ,cAAAV,iBAAA,gBAAAA,iBAAA,GAAfA,iBAAA,CAAiBW,KAAK,CAAC,uCAAuC,CAAC,cAAAX,iBAAA,uBAA/DA,iBAAA,CAAkE,CAAC,CAAC,MAClE,OAAO;EACX,MAAMY,QAAQ,GACZ,CAAClB,KAAK,aAALA,KAAK,gBAAAO,WAAA,GAALP,KAAK,CAAEmB,IAAI,cAAAZ,WAAA,gBAAAA,WAAA,GAAXA,WAAA,CAAaa,O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,CAAC;IAC7B,CAAC;IACD;IACCU,KAAc,IAAK;MAClB;MACAC,OAAO,CAACD,KAAK,CAAC,gCAAgC,EAAEA,KAAK,CAAC;IACxD,CACF,CAAC;EACH;AACF","ignoreList":[]}
1
+ {"version":3,"file":"setWatermark.js","names":["loadBricksImperatively","getBrickPackages","getRuntime","hooks","omit","brick","WATEMARK_BRICKNAME","setWatermark","_window$APP_ROOT","_window$APP_ROOT2","_username","_hooks$auth","_settings$watermarkCo","_watermarkConfig$cont","_watermarkConfig$flag","_watermarkConfig$flag2","flags","getFeatureFlags","settings","getMiscSettings","isDeveloper","window","APP_ROOT","match","username","auth","getAuth","watermarkConfig","content","filter","Boolean","length","defaultProps","zIndex","width","font","fontSize","gap","resolve","then","document","createElement","error","console"],"sources":["../../src/setWatermark.ts"],"sourcesContent":["import { loadBricksImperatively } from \"@next-core/loader\";\nimport { getBrickPackages, getRuntime, hooks } from \"./internal/Runtime.js\";\nimport { omit } from \"lodash\";\n\ninterface WaterMarkProps {\n container?: HTMLElement;\n content?: string | string[];\n zIndex?: number;\n rotate?: number;\n width?: number;\n height?: number;\n image?: string;\n font?: {\n color?: CanvasFillStrokeStyles[\"fillStyle\"];\n fontSize?: number | string;\n fontWeight?: \"normal\" | \"light\" | \"weight\" | number;\n fontStyle?: \"none\" | \"normal\" | \"italic\" | \"oblique\";\n fontFamily?: string;\n textAlign?: CanvasTextAlign;\n };\n style?: React.CSSProperties;\n gap?: [number, number];\n offset?: [number, number];\n}\n\nlet brick: {\n resolve(options: WaterMarkProps): void;\n};\n\nexport const WATEMARK_BRICKNAME = \"basic.show-watermark\";\n\nexport function setWatermark() {\n const flags = getRuntime().getFeatureFlags();\n const settings = getRuntime().getMiscSettings();\n if (!flags[\"show-watermark\"]) {\n return;\n }\n const isDeveloper =\n window.APP_ROOT?.match(/versions\\/([^/]+)\\//)?.[1] === \"0.0.0\" ||\n window.APP_ROOT?.match(/micro-apps\\/(?:v2|v3)\\/[^/]+\\/([^/]+)/)?.[1] ===\n \"0.0.0\";\n const username =\n (hooks?.auth?.getAuth() as Record<string, any>)?.username ?? \"\";\n const watermarkConfig = (settings.watermarkConfig ?? {\n flags: {},\n }) as WaterMarkProps & {\n flags: {\n \"show-development\"?: boolean;\n \"show-user\"?: boolean;\n };\n };\n\n const content = [\n ...(typeof watermarkConfig.content === \"string\"\n ? [watermarkConfig.content]\n : watermarkConfig.content ?? []),\n watermarkConfig.flags?.[\"show-development\"] && isDeveloper\n ? \"Development\"\n : \"\",\n watermarkConfig.flags?.[\"show-user\"] ? username : \"\",\n ].filter(Boolean);\n\n // Do not call showWatermark if there is no content\n if (content.length === 0) {\n return;\n }\n\n const defaultProps: WaterMarkProps = {\n content,\n zIndex: 1001,\n width: 200,\n font: {\n fontSize: 28,\n },\n gap: [190, 190],\n ...omit(watermarkConfig, [\"content\", \"flags\"]),\n };\n if (brick) {\n brick.resolve(defaultProps);\n } else {\n loadBricksImperatively([WATEMARK_BRICKNAME], getBrickPackages()).then(\n () => {\n brick = document.createElement(WATEMARK_BRICKNAME) as any;\n\n brick.resolve(defaultProps);\n },\n // istanbul ignore next\n (error: unknown) => {\n // eslint-disable-next-line no-console\n console.error(\"Load watermark service failed:\", error);\n }\n );\n }\n}\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAQ,mBAAmB;AAC1D,SAASC,gBAAgB,EAAEC,UAAU,EAAEC,KAAK,QAAQ,uBAAuB;AAC3E,SAASC,IAAI,QAAQ,QAAQ;AAuB7B,IAAIC,KAEH;AAED,OAAO,MAAMC,kBAAkB,GAAG,sBAAsB;AAExD,OAAO,SAASC,YAAYA,CAAA,EAAG;EAAA,IAAAC,gBAAA,EAAAC,iBAAA,EAAAC,SAAA,EAAAC,WAAA,EAAAC,qBAAA,EAAAC,qBAAA,EAAAC,qBAAA,EAAAC,sBAAA;EAC7B,MAAMC,KAAK,GAAGd,UAAU,CAAC,CAAC,CAACe,eAAe,CAAC,CAAC;EAC5C,MAAMC,QAAQ,GAAGhB,UAAU,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,eAAe,CAACX,KAAK,cAAAD,sBAAA,eAArBA,sBAAA,CAAwB,WAAW,CAAC,GAAGS,QAAQ,GAAG,EAAE,CACrD,CAACK,MAAM,CAACC,OAAO,CAAC;;EAEjB;EACA,IAAIF,OAAO,CAACG,MAAM,KAAK,CAAC,EAAE;IACxB;EACF;EAEA,MAAMC,YAA4B,GAAG;IACnCJ,OAAO;IACPK,MAAM,EAAE,IAAI;IACZC,KAAK,EAAE,GAAG;IACVC,IAAI,EAAE;MACJC,QAAQ,EAAE;IACZ,CAAC;IACDC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;IACf,GAAGjC,IAAI,CAACuB,eAAe,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC;EAC/C,CAAC;EACD,IAAItB,KAAK,EAAE;IACTA,KAAK,CAACiC,OAAO,CAACN,YAAY,CAAC;EAC7B,CAAC,MAAM;IACLhC,sBAAsB,CAAC,CAACM,kBAAkB,CAAC,EAAEL,gBAAgB,CAAC,CAAC,CAAC,CAACsC,IAAI,CACnE,MAAM;MACJlC,KAAK,GAAGmC,QAAQ,CAACC,aAAa,CAACnC,kBAAkB,CAAQ;MAEzDD,KAAK,CAACiC,OAAO,CAACN,YAAY,CAAC;IAC7B,CAAC;IACD;IACCU,KAAc,IAAK;MAClB;MACAC,OAAO,CAACD,KAAK,CAAC,gCAAgC,EAAEA,KAAK,CAAC;IACxD,CACF,CAAC;EACH;AACF","ignoreList":[]}
@@ -35,6 +35,7 @@ export function batchSetAppsLocalTheme(appsTheme) {
35
35
  });
36
36
  }
37
37
  export function getLocalAppsTheme() {
38
+ var _result;
38
39
  let result;
39
40
  try {
40
41
  result = storage.getItem(LOCAL_STORAGE_APPS_THEME_KEY);
@@ -42,7 +43,7 @@ export function getLocalAppsTheme() {
42
43
  // eslint-disable-next-line no-console
43
44
  console.error("JSON parse error inside `getLocalAppsTheme()`");
44
45
  }
45
- return result ?? {};
46
+ return (_result = result) !== null && _result !== void 0 ? _result : {};
46
47
  }
47
48
 
48
49
  // Modes.
@@ -1 +1 @@
1
- {"version":3,"file":"themeAndMode.js","names":["JsonStorage","theme","storage","localStorage","LOCAL_STORAGE_APPS_THEME_KEY","setTheme","value","Error","getTheme","getCurrentTheme","document","documentElement","dataset","applyTheme","window","dispatchEvent","CustomEvent","detail","batchSetAppsLocalTheme","appsTheme","setItem","getLocalAppsTheme","result","getItem","console","error","mode","setMode","getMode","getCurrentMode","applyMode","getCssPropertyValue","name","_window$getComputedSt","el","arguments","length","undefined","getComputedStyle","getPropertyValue"],"sources":["../../src/themeAndMode.ts"],"sourcesContent":["import type { SiteMode, SiteTheme } from \"@next-core/types\";\nimport { JsonStorage } from \"@next-core/utils/general\";\n\ninterface AppThemes {\n [appId: string]: SiteTheme;\n}\n\n// Themes.\nlet theme: SiteTheme = \"light\";\nconst storage = new JsonStorage<Record<string, AppThemes>>(localStorage);\nconst LOCAL_STORAGE_APPS_THEME_KEY = \"apps-theme\";\n\nexport function setTheme(value: SiteTheme): void {\n if (value !== \"dark\" && value !== \"light\" && value !== \"dark-v2\") {\n throw new Error(`Unsupported theme: ${value}`);\n }\n theme = value;\n}\n\nexport function getTheme(): SiteTheme {\n return theme;\n}\n\nexport function getCurrentTheme(): SiteTheme {\n return document.documentElement.dataset.theme as SiteTheme;\n}\n\nexport function applyTheme(value?: SiteTheme): void {\n if (value) {\n setTheme(value);\n } else {\n value = getTheme();\n }\n if (value !== getCurrentTheme()) {\n document.documentElement.dataset.theme = value;\n window.dispatchEvent(\n new CustomEvent<SiteTheme>(\"theme.change\", {\n detail: value,\n })\n );\n }\n}\n\nexport function batchSetAppsLocalTheme(appsTheme: AppThemes): void {\n storage.setItem(LOCAL_STORAGE_APPS_THEME_KEY, {\n ...getLocalAppsTheme(),\n ...appsTheme,\n });\n}\n\nexport function getLocalAppsTheme(): AppThemes {\n let result: AppThemes | undefined;\n try {\n result = storage.getItem(LOCAL_STORAGE_APPS_THEME_KEY);\n } catch {\n // eslint-disable-next-line no-console\n console.error(\"JSON parse error inside `getLocalAppsTheme()`\");\n }\n\n return result ?? {};\n}\n\n// Modes.\nlet mode: SiteMode = \"default\";\n\nexport function setMode(value: SiteMode): void {\n if (value !== \"dashboard\" && value !== \"default\") {\n throw new Error(`Unsupported mode: ${value}`);\n }\n mode = value;\n}\n\nexport function getMode(): SiteMode {\n return mode;\n}\n\nexport function getCurrentMode(): SiteMode {\n return document.documentElement.dataset.mode as SiteMode;\n}\n\nexport function applyMode(value?: SiteMode): void {\n if (value) {\n setMode(value);\n } else {\n value = getMode();\n }\n if (value !== getCurrentMode()) {\n document.documentElement.dataset.mode = value;\n window.dispatchEvent(\n new CustomEvent<SiteMode>(\"mode.change\", {\n detail: value,\n })\n );\n }\n}\n\nexport function getCssPropertyValue(\n name: string,\n el = document.documentElement\n): string {\n if (!el) return \"\";\n return window.getComputedStyle(el)?.getPropertyValue(name) || \"\";\n}\n"],"mappings":"AACA,SAASA,WAAW,QAAQ,0BAA0B;AAMtD;AACA,IAAIC,KAAgB,GAAG,OAAO;AAC9B,MAAMC,OAAO,GAAG,IAAIF,WAAW,CAA4BG,YAAY,CAAC;AACxE,MAAMC,4BAA4B,GAAG,YAAY;AAEjD,OAAO,SAASC,QAAQA,CAACC,KAAgB,EAAQ;EAC/C,IAAIA,KAAK,KAAK,MAAM,IAAIA,KAAK,KAAK,OAAO,IAAIA,KAAK,KAAK,SAAS,EAAE;IAChE,MAAM,IAAIC,KAAK,CAAC,sBAAsBD,KAAK,EAAE,CAAC;EAChD;EACAL,KAAK,GAAGK,KAAK;AACf;AAEA,OAAO,SAASE,QAAQA,CAAA,EAAc;EACpC,OAAOP,KAAK;AACd;AAEA,OAAO,SAASQ,eAAeA,CAAA,EAAc;EAC3C,OAAOC,QAAQ,CAACC,eAAe,CAACC,OAAO,CAACX,KAAK;AAC/C;AAEA,OAAO,SAASY,UAAUA,CAACP,KAAiB,EAAQ;EAClD,IAAIA,KAAK,EAAE;IACTD,QAAQ,CAACC,KAAK,CAAC;EACj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EAChB,CAAC,MAAM;IACLA,KAAK,GAAGsB,OAAO,CAAC,CAAC;EACnB;EACA,IAAItB,KAAK,KAAKuB,cAAc,CAAC,CAAC,EAAE;IAC9BnB,QAAQ,CAACC,eAAe,CAACC,OAAO,CAACc,IAAI,GAAGpB,KAAK;IAC7CQ,MAAM,CAACC,aAAa,CAClB,IAAIC,WAAW,CAAW,aAAa,EAAE;MACvCC,MAAM,EAAEX;IACV,CAAC,CACH,CAAC;EACH;AACF;AAEA,OAAO,SAASyB,mBAAmBA,CACjCC,IAAY,EAEJ;EAAA,IAAAC,qBAAA;EAAA,IADRC,EAAE,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGzB,QAAQ,CAACC,eAAe;EAE7B,IAAI,CAACuB,EAAE,EAAE,OAAO,EAAE;EAClB,OAAO,EAAAD,qBAAA,GAAAnB,MAAM,CAACwB,gBAAgB,CAACJ,EAAE,CAAC,cAAAD,qBAAA,uBAA3BA,qBAAA,CAA6BM,gBAAgB,CAACP,IAAI,CAAC,KAAI,EAAE;AAClE","ignoreList":[]}
1
+ {"version":3,"file":"themeAndMode.js","names":["JsonStorage","theme","storage","localStorage","LOCAL_STORAGE_APPS_THEME_KEY","setTheme","value","Error","getTheme","getCurrentTheme","document","documentElement","dataset","applyTheme","window","dispatchEvent","CustomEvent","detail","batchSetAppsLocalTheme","appsTheme","setItem","getLocalAppsTheme","_result","result","getItem","console","error","mode","setMode","getMode","getCurrentMode","applyMode","getCssPropertyValue","name","_window$getComputedSt","el","arguments","length","undefined","getComputedStyle","getPropertyValue"],"sources":["../../src/themeAndMode.ts"],"sourcesContent":["import type { SiteMode, SiteTheme } from \"@next-core/types\";\nimport { JsonStorage } from \"@next-core/utils/general\";\n\ninterface AppThemes {\n [appId: string]: SiteTheme;\n}\n\n// Themes.\nlet theme: SiteTheme = \"light\";\nconst storage = new JsonStorage<Record<string, AppThemes>>(localStorage);\nconst LOCAL_STORAGE_APPS_THEME_KEY = \"apps-theme\";\n\nexport function setTheme(value: SiteTheme): void {\n if (value !== \"dark\" && value !== \"light\" && value !== \"dark-v2\") {\n throw new Error(`Unsupported theme: ${value}`);\n }\n theme = value;\n}\n\nexport function getTheme(): SiteTheme {\n return theme;\n}\n\nexport function getCurrentTheme(): SiteTheme {\n return document.documentElement.dataset.theme as SiteTheme;\n}\n\nexport function applyTheme(value?: SiteTheme): void {\n if (value) {\n setTheme(value);\n } else {\n value = getTheme();\n }\n if (value !== getCurrentTheme()) {\n document.documentElement.dataset.theme = value;\n window.dispatchEvent(\n new CustomEvent<SiteTheme>(\"theme.change\", {\n detail: value,\n })\n );\n }\n}\n\nexport function batchSetAppsLocalTheme(appsTheme: AppThemes): void {\n storage.setItem(LOCAL_STORAGE_APPS_THEME_KEY, {\n ...getLocalAppsTheme(),\n ...appsTheme,\n });\n}\n\nexport function getLocalAppsTheme(): AppThemes {\n let result: AppThemes | undefined;\n try {\n result = storage.getItem(LOCAL_STORAGE_APPS_THEME_KEY);\n } catch {\n // eslint-disable-next-line no-console\n console.error(\"JSON parse error inside `getLocalAppsTheme()`\");\n }\n\n return result ?? {};\n}\n\n// Modes.\nlet mode: SiteMode = \"default\";\n\nexport function setMode(value: SiteMode): void {\n if (value !== \"dashboard\" && value !== \"default\") {\n throw new Error(`Unsupported mode: ${value}`);\n }\n mode = value;\n}\n\nexport function getMode(): SiteMode {\n return mode;\n}\n\nexport function getCurrentMode(): SiteMode {\n return document.documentElement.dataset.mode as SiteMode;\n}\n\nexport function applyMode(value?: SiteMode): void {\n if (value) {\n setMode(value);\n } else {\n value = getMode();\n }\n if (value !== getCurrentMode()) {\n document.documentElement.dataset.mode = value;\n window.dispatchEvent(\n new CustomEvent<SiteMode>(\"mode.change\", {\n detail: value,\n })\n );\n }\n}\n\nexport function getCssPropertyValue(\n name: string,\n el = document.documentElement\n): string {\n if (!el) return \"\";\n return window.getComputedStyle(el)?.getPropertyValue(name) || \"\";\n}\n"],"mappings":"AACA,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AAE,OAAO,EAAE;EAClB,OAAO,EAAAD,qBAAA,GAAApB,MAAM,CAACyB,gBAAgB,CAACJ,EAAE,CAAC,cAAAD,qBAAA,uBAA3BA,qBAAA,CAA6BM,gBAAgB,CAACP,IAAI,CAAC,KAAI,EAAE;AAClE","ignoreList":[]}
@@ -17,6 +17,7 @@ export interface RuntimeContext extends LegacyCompatibleRuntimeContext {
17
17
  formStateStoreMap: Map<string, DataStore<"FORM_STATE">>;
18
18
  formStateStoreId?: string;
19
19
  formStateStoreScope?: DataStore<"FORM_STATE">[];
20
+ inUseBrick?: boolean;
20
21
  }
21
22
  export type AsyncPropertyEntry = [
22
23
  name: string,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-core/runtime",
3
- "version": "1.57.0",
3
+ "version": "1.57.2",
4
4
  "homepage": "https://github.com/easyops-cn/next-core/tree/v3/packages/runtime",
5
5
  "license": "GPL-3.0",
6
6
  "repository": {
@@ -67,5 +67,5 @@
67
67
  "@next-core/build-next-libs": "^1.0.20",
68
68
  "@next-core/test-next": "^1.1.7"
69
69
  },
70
- "gitHead": "4d4bc3902718297643bae650a60c500c7b68f035"
70
+ "gitHead": "978acb00c6024e004921835fc314be8c7b14362f"
71
71
  }