@next-core/runtime 1.22.10 → 1.22.12

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 (45) hide show
  1. package/dist/cjs/CustomProcessors.js +16 -1
  2. package/dist/cjs/CustomProcessors.js.map +1 -1
  3. package/dist/cjs/CustomTemplates.js +17 -2
  4. package/dist/cjs/CustomTemplates.js.map +1 -1
  5. package/dist/cjs/getV2RuntimeFromDll.js +16 -0
  6. package/dist/cjs/getV2RuntimeFromDll.js.map +1 -0
  7. package/dist/cjs/history.js +13 -14
  8. package/dist/cjs/history.js.map +1 -1
  9. package/dist/cjs/index.js +12 -0
  10. package/dist/cjs/index.js.map +1 -1
  11. package/dist/cjs/internal/Runtime.js +35 -3
  12. package/dist/cjs/internal/Runtime.js.map +1 -1
  13. package/dist/cjs/internal/compute/WidgetFunctions.js +17 -3
  14. package/dist/cjs/internal/compute/WidgetFunctions.js.map +1 -1
  15. package/dist/cjs/internal/compute/WidgetI18n.js +17 -4
  16. package/dist/cjs/internal/compute/WidgetI18n.js.map +1 -1
  17. package/dist/cjs/internal/compute/checkIf.js +15 -2
  18. package/dist/cjs/internal/compute/checkIf.js.map +1 -1
  19. package/dist/esm/CustomProcessors.js +16 -1
  20. package/dist/esm/CustomProcessors.js.map +1 -1
  21. package/dist/esm/CustomTemplates.js +16 -1
  22. package/dist/esm/CustomTemplates.js.map +1 -1
  23. package/dist/esm/getV2RuntimeFromDll.js +10 -0
  24. package/dist/esm/getV2RuntimeFromDll.js.map +1 -0
  25. package/dist/esm/history.js +9 -11
  26. package/dist/esm/history.js.map +1 -1
  27. package/dist/esm/index.js +1 -0
  28. package/dist/esm/index.js.map +1 -1
  29. package/dist/esm/internal/Runtime.js +33 -1
  30. package/dist/esm/internal/Runtime.js.map +1 -1
  31. package/dist/esm/internal/compute/WidgetFunctions.js +15 -1
  32. package/dist/esm/internal/compute/WidgetFunctions.js.map +1 -1
  33. package/dist/esm/internal/compute/WidgetI18n.js +15 -2
  34. package/dist/esm/internal/compute/WidgetI18n.js.map +1 -1
  35. package/dist/esm/internal/compute/checkIf.js +13 -1
  36. package/dist/esm/internal/compute/checkIf.js.map +1 -1
  37. package/dist/types/getV2RuntimeFromDll.d.ts +21 -0
  38. package/dist/types/history.d.ts +1 -1
  39. package/dist/types/index.d.ts +1 -0
  40. package/dist/types/internal/Renderer.d.ts +1 -1
  41. package/dist/types/internal/Runtime.d.ts +1 -1
  42. package/dist/types/internal/compute/WidgetFunctions.d.ts +1 -1
  43. package/dist/types/internal/compute/WidgetI18n.d.ts +1 -1
  44. package/dist/types/internal/compute/checkIf.d.ts +1 -1
  45. package/package.json +2 -2
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.customProcessors = void 0;
7
+ var _getV2RuntimeFromDll = require("./getV2RuntimeFromDll.js");
7
8
  class CustomProcessorRegistry {
8
9
  #registry = new Map();
9
10
  define(processorFullName, processorFunc) {
@@ -24,6 +25,20 @@ class CustomProcessorRegistry {
24
25
  return this.#registry.get(namespace);
25
26
  }
26
27
  }
27
- const customProcessors = new CustomProcessorRegistry();
28
+
29
+ // istanbul ignore next
30
+ function getCustomProcessorsV2() {
31
+ const v2Kit = (0, _getV2RuntimeFromDll.getV2RuntimeFromDll)();
32
+ if (v2Kit) {
33
+ return Object.freeze({
34
+ define(processorFullName, processorFunc) {
35
+ return v2Kit.getRuntime().registerCustomProcessor(processorFullName, processorFunc);
36
+ }
37
+ });
38
+ }
39
+ }
40
+
41
+ // istanbul ignore next
42
+ const customProcessors = getCustomProcessorsV2() || new CustomProcessorRegistry();
28
43
  exports.customProcessors = customProcessors;
29
44
  //# sourceMappingURL=CustomProcessors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomProcessors.js","names":["CustomProcessorRegistry","registry","Map","define","processorFullName","processorFunc","namespace","processorName","split","pkg","get","set","has","Error","customProcessors","exports"],"sources":["../../src/CustomProcessors.ts"],"sourcesContent":["class CustomProcessorRegistry {\n readonly #registry = new Map<string, Map<string, Function>>();\n\n define(processorFullName: string, processorFunc: Function) {\n // `namespace` should be the camelCase of the package name.\n const [namespace, processorName] = processorFullName.split(\".\");\n let pkg = this.#registry.get(namespace);\n if (!pkg) {\n pkg = new Map();\n this.#registry.set(namespace, pkg);\n }\n if (pkg.has(processorName)) {\n // eslint-disable-next-line no-console\n throw new Error(\n `Custom processor of \"${processorFullName}\" already registered`\n );\n }\n pkg.set(processorName, processorFunc);\n }\n\n get(namespace: string) {\n return this.#registry.get(namespace);\n }\n}\n\nexport const customProcessors = new CustomProcessorRegistry();\n"],"mappings":";;;;;;AAAA,MAAMA,uBAAuB,CAAC;EACnB,CAACC,QAAQ,GAAG,IAAIC,GAAG,CAAgC,CAAC;EAE7DC,MAAMA,CAACC,iBAAyB,EAAEC,aAAuB,EAAE;IACzD;IACA,MAAM,CAACC,SAAS,EAAEC,aAAa,CAAC,GAAGH,iBAAiB,CAACI,KAAK,CAAC,GAAG,CAAC;IAC/D,IAAIC,GAAG,GAAG,IAAI,CAAC,CAACR,QAAQ,CAACS,GAAG,CAACJ,SAAS,CAAC;IACvC,IAAI,CAACG,GAAG,EAAE;MACRA,GAAG,GAAG,IAAIP,GAAG,CAAC,CAAC;MACf,IAAI,CAAC,CAACD,QAAQ,CAACU,GAAG,CAACL,SAAS,EAAEG,GAAG,CAAC;IACpC;IACA,IAAIA,GAAG,CAACG,GAAG,CAACL,aAAa,CAAC,EAAE;MAC1B;MACA,MAAM,IAAIM,KAAK,CACZ,wBAAuBT,iBAAkB,sBAC5C,CAAC;IACH;IACAK,GAAG,CAACE,GAAG,CAACJ,aAAa,EAAEF,aAAa,CAAC;EACvC;EAEAK,GAAGA,CAACJ,SAAiB,EAAE;IACrB,OAAO,IAAI,CAAC,CAACL,QAAQ,CAACS,GAAG,CAACJ,SAAS,CAAC;EACtC;AACF;AAEO,MAAMQ,gBAAgB,GAAG,IAAId,uBAAuB,CAAC,CAAC;AAACe,OAAA,CAAAD,gBAAA,GAAAA,gBAAA"}
1
+ {"version":3,"file":"CustomProcessors.js","names":["_getV2RuntimeFromDll","require","CustomProcessorRegistry","registry","Map","define","processorFullName","processorFunc","namespace","processorName","split","pkg","get","set","has","Error","getCustomProcessorsV2","v2Kit","getV2RuntimeFromDll","Object","freeze","getRuntime","registerCustomProcessor","customProcessors","exports"],"sources":["../../src/CustomProcessors.ts"],"sourcesContent":["import { getV2RuntimeFromDll } from \"./getV2RuntimeFromDll.js\";\n\nclass CustomProcessorRegistry {\n readonly #registry = new Map<string, Map<string, Function>>();\n\n define(processorFullName: string, processorFunc: Function) {\n // `namespace` should be the camelCase of the package name.\n const [namespace, processorName] = processorFullName.split(\".\");\n let pkg = this.#registry.get(namespace);\n if (!pkg) {\n pkg = new Map();\n this.#registry.set(namespace, pkg);\n }\n if (pkg.has(processorName)) {\n // eslint-disable-next-line no-console\n throw new Error(\n `Custom processor of \"${processorFullName}\" already registered`\n );\n }\n pkg.set(processorName, processorFunc);\n }\n\n get(namespace: string) {\n return this.#registry.get(namespace);\n }\n}\n\n// istanbul ignore next\nfunction getCustomProcessorsV2() {\n const v2Kit = getV2RuntimeFromDll();\n if (v2Kit) {\n return Object.freeze({\n define(processorFullName: string, processorFunc: Function) {\n return v2Kit\n .getRuntime()\n .registerCustomProcessor(processorFullName, processorFunc);\n },\n }) as CustomProcessorRegistry;\n }\n}\n\n// istanbul ignore next\nexport const customProcessors =\n getCustomProcessorsV2() || new CustomProcessorRegistry();\n"],"mappings":";;;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AAEA,MAAMC,uBAAuB,CAAC;EACnB,CAACC,QAAQ,GAAG,IAAIC,GAAG,CAAgC,CAAC;EAE7DC,MAAMA,CAACC,iBAAyB,EAAEC,aAAuB,EAAE;IACzD;IACA,MAAM,CAACC,SAAS,EAAEC,aAAa,CAAC,GAAGH,iBAAiB,CAACI,KAAK,CAAC,GAAG,CAAC;IAC/D,IAAIC,GAAG,GAAG,IAAI,CAAC,CAACR,QAAQ,CAACS,GAAG,CAACJ,SAAS,CAAC;IACvC,IAAI,CAACG,GAAG,EAAE;MACRA,GAAG,GAAG,IAAIP,GAAG,CAAC,CAAC;MACf,IAAI,CAAC,CAACD,QAAQ,CAACU,GAAG,CAACL,SAAS,EAAEG,GAAG,CAAC;IACpC;IACA,IAAIA,GAAG,CAACG,GAAG,CAACL,aAAa,CAAC,EAAE;MAC1B;MACA,MAAM,IAAIM,KAAK,CACZ,wBAAuBT,iBAAkB,sBAC5C,CAAC;IACH;IACAK,GAAG,CAACE,GAAG,CAACJ,aAAa,EAAEF,aAAa,CAAC;EACvC;EAEAK,GAAGA,CAACJ,SAAiB,EAAE;IACrB,OAAO,IAAI,CAAC,CAACL,QAAQ,CAACS,GAAG,CAACJ,SAAS,CAAC;EACtC;AACF;;AAEA;AACA,SAASQ,qBAAqBA,CAAA,EAAG;EAC/B,MAAMC,KAAK,GAAG,IAAAC,wCAAmB,EAAC,CAAC;EACnC,IAAID,KAAK,EAAE;IACT,OAAOE,MAAM,CAACC,MAAM,CAAC;MACnBf,MAAMA,CAACC,iBAAyB,EAAEC,aAAuB,EAAE;QACzD,OAAOU,KAAK,CACTI,UAAU,CAAC,CAAC,CACZC,uBAAuB,CAAChB,iBAAiB,EAAEC,aAAa,CAAC;MAC9D;IACF,CAAC,CAAC;EACJ;AACF;;AAEA;AACO,MAAMgB,gBAAgB,GAC3BP,qBAAqB,CAAC,CAAC,IAAI,IAAId,uBAAuB,CAAC,CAAC;AAACsB,OAAA,CAAAD,gBAAA,GAAAA,gBAAA"}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.customTemplates = void 0;
7
7
  var _lodash = require("lodash");
8
8
  var _isStrictMode = require("./isStrictMode.js");
9
+ var _getV2RuntimeFromDll = require("./getV2RuntimeFromDll.js");
9
10
  // Note: `prefix` is a native prop on Element, but it's only used in XML documents.
10
11
  const allowedNativeProps = new Set(["prefix"]);
11
12
  class CustomTemplateRegistry {
@@ -177,11 +178,25 @@ class CustomTemplateRegistry {
177
178
  return this.#registry.get(tagName);
178
179
  }
179
180
  }
180
- const customTemplates = new CustomTemplateRegistry();
181
- exports.customTemplates = customTemplates;
182
181
  function getExposedStates(state) {
183
182
  var _state$filter$map;
184
183
  // Allow duplicated state names which maybe mutually exclusive.
185
184
  return (0, _lodash.uniq)((_state$filter$map = state === null || state === void 0 ? void 0 : state.filter(item => item.expose).map(item => item.name)) !== null && _state$filter$map !== void 0 ? _state$filter$map : []);
186
185
  }
186
+
187
+ // istanbul ignore next
188
+ function getCustomTemplatesV2() {
189
+ const v2Kit = (0, _getV2RuntimeFromDll.getV2RuntimeFromDll)();
190
+ if (v2Kit) {
191
+ return Object.freeze({
192
+ define(tagName, constructor) {
193
+ return v2Kit.getRuntime().registerCustomTemplate(tagName, constructor);
194
+ }
195
+ });
196
+ }
197
+ }
198
+
199
+ // istanbul ignore next
200
+ const customTemplates = getCustomTemplatesV2() || new CustomTemplateRegistry();
201
+ exports.customTemplates = customTemplates;
187
202
  //# sourceMappingURL=CustomTemplates.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomTemplates.js","names":["_lodash","require","_isStrictMode","allowedNativeProps","Set","CustomTemplateRegistry","registry","Map","define","tagName","constructor","_constructor$proxy$pr","_constructor$proxy","_compatibleConstructo","_compatibleConstructo2","registered","has","console","warn","customElements","get","strict","isStrictMode","proxyProperties","proxy","properties","validProxyProps","legacyTplVariables","key","value","Object","entries","asVariable","warnAboutStrictMode","push","mergeProperty","refTransform","error","ref","compatibleConstructor","fromEntries","state","map","item","expose","concat","tpl","name","set","exposedStates","getExposedStates","proxyMethods","methods","props","entry","nativeProps","filter","prop","HTMLElement","prototype","length","Error","p","join","TplElement","$$typeof","_dev_only_definedProperties","_dev_only_definedMethods","$$getElementByRef","_this$$$tplStateStore","$$tplStateStore","hostBrick","tplHostMetadata","internalBricksByRef","element","connectedCallback","shadowRoot","attachShadow","mode","fragment","document","createDocumentFragment","style","createElement","textContent","slot","appendChild","disconnectedCallback","propName","some","defineProperty","getValue","_this$$$tplStateStore2","updateValue","enumerable","from","to","_to$refProperty","refProperty","_this$$$getElementByR","call","_to$refProperty2","args","_to$refMethod","refMethod","customTemplates","exports","_state$filter$map","uniq"],"sources":["../../src/CustomTemplates.ts"],"sourcesContent":["import type {\n ContextConf,\n CustomTemplate,\n CustomTemplateConstructor,\n CustomTemplateProxyBasicProperty,\n} from \"@next-core/types\";\nimport { uniq } from \"lodash\";\nimport type { RuntimeBrickElement } from \"./internal/interfaces.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"./isStrictMode.js\";\n\n// Note: `prefix` is a native prop on Element, but it's only used in XML documents.\nconst allowedNativeProps = new Set([\"prefix\"]);\n\ninterface LegacyTplPropProxy extends CustomTemplateProxyBasicProperty {\n asVariable?: boolean;\n mergeProperty?: unknown;\n refTransform?: unknown;\n}\n\nclass CustomTemplateRegistry {\n readonly #registry = new Map<string, CustomTemplate>();\n\n define(tagName: string, constructor: CustomTemplateConstructor): void {\n let registered = this.#registry.has(tagName);\n if (registered) {\n // When open launchpad, the storyboard will be updated.\n // However, we can't *undefine* a custom element.\n // Just ignore re-registering custom templates.\n // eslint-disable-next-line no-console\n console.warn(`Custom template of \"${tagName}\" already registered.`);\n } else {\n registered = !!customElements.get(tagName);\n if (registered) {\n // eslint-disable-next-line no-console\n console.warn(\n `Custom template of \"${tagName}\" already defined by customElements.`\n );\n }\n }\n\n // Transform legacy `proxy.properties[].asVariable` as states.\n const strict = isStrictMode();\n const proxyProperties = (constructor.proxy?.properties ?? {}) as {\n [name: string]: LegacyTplPropProxy;\n };\n const validProxyProps: [string, CustomTemplateProxyBasicProperty][] = [];\n const legacyTplVariables: string[] = [];\n for (const [key, value] of Object.entries(proxyProperties)) {\n if (value.asVariable) {\n warnAboutStrictMode(strict, \"Template `asVariable`\", tagName, key);\n // istanbul ignore next\n if (!strict) {\n // For existed TPL usage, treat it as a STATE.\n legacyTplVariables.push(key);\n }\n } else if (value.mergeProperty || value.refTransform) {\n // eslint-disable-next-line no-console\n console.error(\n \"Template `mergeProperty` and `refTransform` are dropped in v3:\",\n tagName,\n key\n );\n } else if (value.ref) {\n validProxyProps.push([key, value]);\n }\n // Else: documentation only, for exposed states.\n }\n\n const compatibleConstructor = {\n ...constructor,\n proxy: {\n ...constructor.proxy,\n properties: Object.fromEntries(validProxyProps),\n },\n state: (constructor.state\n ? strict\n ? constructor.state\n : constructor.state.map((item) => ({\n // Make `expose` defaults to true in non-strict mode.\n expose: true,\n ...item,\n }))\n : []\n ).concat(legacyTplVariables.map((tpl) => ({ name: tpl, expose: true }))),\n };\n\n // Now we allow re-register custom template\n this.#registry.set(tagName, {\n ...compatibleConstructor,\n name: tagName,\n });\n\n const exposedStates = getExposedStates(compatibleConstructor.state);\n const proxyMethods = Object.entries(\n compatibleConstructor.proxy?.methods ?? {}\n );\n\n const props = exposedStates.concat(\n validProxyProps.map((entry) => entry[0])\n );\n const methods = proxyMethods.map((entry) => entry[0]);\n\n const nativeProps = props\n .concat(methods)\n .filter(\n (prop) => prop in HTMLElement.prototype && !allowedNativeProps.has(prop)\n );\n if (nativeProps.length > 0) {\n warnAboutStrictMode(\n strict,\n \"Using native HTMLElement properties as template properties or methods\",\n tagName,\n ...nativeProps\n );\n // istanbul ignore next\n if (strict) {\n throw new Error(\n `In custom template \"${tagName}\", ${nativeProps\n .map((p) => `\"${p}\"`)\n .join(\n \", \"\n )} are native HTMLElement properties, and should be avoid to be used as brick properties or methods.`\n );\n }\n }\n\n if (registered) {\n return;\n }\n\n class TplElement extends HTMLElement {\n get $$typeof() {\n return \"custom-template\" as const;\n }\n\n static get _dev_only_definedProperties(): string[] {\n return props;\n }\n\n static get _dev_only_definedMethods(): string[] {\n return methods;\n }\n\n $$getElementByRef(this: RuntimeBrickElement, ref: string) {\n return this.$$tplStateStore?.hostBrick?.tplHostMetadata?.internalBricksByRef.get(\n ref\n )?.element;\n }\n\n connectedCallback() {\n let shadowRoot = this.shadowRoot;\n if (!shadowRoot) {\n shadowRoot = this.attachShadow({ mode: \"open\" });\n }\n const fragment = document.createDocumentFragment();\n const style = document.createElement(\"style\");\n style.textContent = \":host{display:block}:host([hidden]){display:none}\";\n const slot = document.createElement(\"slot\");\n fragment.appendChild(style);\n fragment.appendChild(slot);\n shadowRoot.appendChild(fragment);\n }\n\n disconnectedCallback() {\n if (this.shadowRoot) {\n this.shadowRoot.textContent = \"\";\n }\n }\n }\n\n for (const propName of exposedStates) {\n if (validProxyProps.some((entry) => entry[0] === propName)) {\n // eslint-disable-next-line no-console\n console.error(\n `Cannot define an exposed state that is also a proxy property: \"${propName}\" in ${tagName}`\n );\n continue;\n }\n Object.defineProperty(TplElement.prototype, propName, {\n get(this: RuntimeBrickElement) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this.$$tplStateStore!.getValue(propName);\n },\n set(this: RuntimeBrickElement, value: unknown) {\n // 在 mount 过程中,先设置属性,再设置 `$$tplStateStore`,这样,当触发属性设置时,\n // 避免初始化的一次 state update 操作及其 onChange 事件。\n this.$$tplStateStore?.updateValue(propName, value, \"replace\");\n },\n enumerable: true,\n });\n }\n\n for (const [from, to] of validProxyProps) {\n Object.defineProperty(TplElement.prototype, from, {\n get(this: TplElement) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const element = this.$$getElementByRef!(to.ref) as unknown as Record<\n string,\n unknown\n >;\n return element[to.refProperty ?? from];\n },\n set(this: TplElement, value: unknown) {\n // 同上 exposedState.set\n const element = this.$$getElementByRef?.(to.ref) as unknown as Record<\n string,\n unknown\n >;\n if (element) {\n element[to.refProperty ?? from] = value;\n }\n },\n enumerable: true,\n });\n }\n\n for (const [from, to] of proxyMethods) {\n Object.defineProperty(TplElement.prototype, from, {\n value(this: TplElement, ...args: unknown[]) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const element = this.$$getElementByRef!(to.ref) as unknown as Record<\n string,\n Function\n >;\n element[to.refMethod ?? from](...args);\n },\n enumerable: true,\n });\n }\n\n customElements.define(tagName, TplElement);\n }\n\n get(tagName: string) {\n return this.#registry.get(tagName);\n }\n}\n\nexport const customTemplates = new CustomTemplateRegistry();\n\nfunction getExposedStates(state: ContextConf[] | undefined): string[] {\n // Allow duplicated state names which maybe mutually exclusive.\n return uniq(\n state?.filter((item) => item.expose).map((item) => item.name) ?? []\n );\n}\n"],"mappings":";;;;;;AAMA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AAEA;AACA,MAAME,kBAAkB,GAAG,IAAIC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;AAQ9C,MAAMC,sBAAsB,CAAC;EAClB,CAACC,QAAQ,GAAG,IAAIC,GAAG,CAAyB,CAAC;EAEtDC,MAAMA,CAACC,OAAe,EAAEC,WAAsC,EAAQ;IAAA,IAAAC,qBAAA,EAAAC,kBAAA,EAAAC,qBAAA,EAAAC,sBAAA;IACpE,IAAIC,UAAU,GAAG,IAAI,CAAC,CAACT,QAAQ,CAACU,GAAG,CAACP,OAAO,CAAC;IAC5C,IAAIM,UAAU,EAAE;MACd;MACA;MACA;MACA;MACAE,OAAO,CAACC,IAAI,CAAE,uBAAsBT,OAAQ,uBAAsB,CAAC;IACrE,CAAC,MAAM;MACLM,UAAU,GAAG,CAAC,CAACI,cAAc,CAACC,GAAG,CAACX,OAAO,CAAC;MAC1C,IAAIM,UAAU,EAAE;QACd;QACAE,OAAO,CAACC,IAAI,CACT,uBAAsBT,OAAQ,sCACjC,CAAC;MACH;IACF;;IAEA;IACA,MAAMY,MAAM,GAAG,IAAAC,0BAAY,EAAC,CAAC;IAC7B,MAAMC,eAAe,IAAAZ,qBAAA,IAAAC,kBAAA,GAAIF,WAAW,CAACc,KAAK,cAAAZ,kBAAA,uBAAjBA,kBAAA,CAAmBa,UAAU,cAAAd,qBAAA,cAAAA,qBAAA,GAAI,CAAC,CAE1D;IACD,MAAMe,eAA6D,GAAG,EAAE;IACxE,M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AAI,CAAC,cAAA4D,iBAAA,cAAAA,iBAAA,GAAI,EACnE,CAAC;AACH"}
1
+ {"version":3,"file":"CustomTemplates.js","names":["_lodash","require","_isStrictMode","_getV2RuntimeFromDll","allowedNativeProps","Set","CustomTemplateRegistry","registry","Map","define","tagName","constructor","_constructor$proxy$pr","_constructor$proxy","_compatibleConstructo","_compatibleConstructo2","registered","has","console","warn","customElements","get","strict","isStrictMode","proxyProperties","proxy","properties","validProxyProps","legacyTplVariables","key","value","Object","entries","asVariable","warnAboutStrictMode","push","mergeProperty","refTransform","error","ref","compatibleConstructor","fromEntries","state","map","item","expose","concat","tpl","name","set","exposedStates","getExposedStates","proxyMethods","methods","props","entry","nativeProps","filter","prop","HTMLElement","prototype","length","Error","p","join","TplElement","$$typeof","_dev_only_definedProperties","_dev_only_definedMethods","$$getElementByRef","_this$$$tplStateStore","$$tplStateStore","hostBrick","tplHostMetadata","internalBricksByRef","element","connectedCallback","shadowRoot","attachShadow","mode","fragment","document","createDocumentFragment","style","createElement","textContent","slot","appendChild","disconnectedCallback","propName","some","defineProperty","getValue","_this$$$tplStateStore2","updateValue","enumerable","from","to","_to$refProperty","refProperty","_this$$$getElementByR","call","_to$refProperty2","args","_to$refMethod","refMethod","_state$filter$map","uniq","getCustomTemplatesV2","v2Kit","getV2RuntimeFromDll","freeze","getRuntime","registerCustomTemplate","customTemplates","exports"],"sources":["../../src/CustomTemplates.ts"],"sourcesContent":["import type {\n ContextConf,\n CustomTemplate,\n CustomTemplateConstructor,\n CustomTemplateProxyBasicProperty,\n} from \"@next-core/types\";\nimport { uniq } from \"lodash\";\nimport type { RuntimeBrickElement } from \"./internal/interfaces.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"./isStrictMode.js\";\nimport { getV2RuntimeFromDll } from \"./getV2RuntimeFromDll.js\";\n\n// Note: `prefix` is a native prop on Element, but it's only used in XML documents.\nconst allowedNativeProps = new Set([\"prefix\"]);\n\ninterface LegacyTplPropProxy extends CustomTemplateProxyBasicProperty {\n asVariable?: boolean;\n mergeProperty?: unknown;\n refTransform?: unknown;\n}\n\nclass CustomTemplateRegistry {\n readonly #registry = new Map<string, CustomTemplate>();\n\n define(tagName: string, constructor: CustomTemplateConstructor): void {\n let registered = this.#registry.has(tagName);\n if (registered) {\n // When open launchpad, the storyboard will be updated.\n // However, we can't *undefine* a custom element.\n // Just ignore re-registering custom templates.\n // eslint-disable-next-line no-console\n console.warn(`Custom template of \"${tagName}\" already registered.`);\n } else {\n registered = !!customElements.get(tagName);\n if (registered) {\n // eslint-disable-next-line no-console\n console.warn(\n `Custom template of \"${tagName}\" already defined by customElements.`\n );\n }\n }\n\n // Transform legacy `proxy.properties[].asVariable` as states.\n const strict = isStrictMode();\n const proxyProperties = (constructor.proxy?.properties ?? {}) as {\n [name: string]: LegacyTplPropProxy;\n };\n const validProxyProps: [string, CustomTemplateProxyBasicProperty][] = [];\n const legacyTplVariables: string[] = [];\n for (const [key, value] of Object.entries(proxyProperties)) {\n if (value.asVariable) {\n warnAboutStrictMode(strict, \"Template `asVariable`\", tagName, key);\n // istanbul ignore next\n if (!strict) {\n // For existed TPL usage, treat it as a STATE.\n legacyTplVariables.push(key);\n }\n } else if (value.mergeProperty || value.refTransform) {\n // eslint-disable-next-line no-console\n console.error(\n \"Template `mergeProperty` and `refTransform` are dropped in v3:\",\n tagName,\n key\n );\n } else if (value.ref) {\n validProxyProps.push([key, value]);\n }\n // Else: documentation only, for exposed states.\n }\n\n const compatibleConstructor = {\n ...constructor,\n proxy: {\n ...constructor.proxy,\n properties: Object.fromEntries(validProxyProps),\n },\n state: (constructor.state\n ? strict\n ? constructor.state\n : constructor.state.map((item) => ({\n // Make `expose` defaults to true in non-strict mode.\n expose: true,\n ...item,\n }))\n : []\n ).concat(legacyTplVariables.map((tpl) => ({ name: tpl, expose: true }))),\n };\n\n // Now we allow re-register custom template\n this.#registry.set(tagName, {\n ...compatibleConstructor,\n name: tagName,\n });\n\n const exposedStates = getExposedStates(compatibleConstructor.state);\n const proxyMethods = Object.entries(\n compatibleConstructor.proxy?.methods ?? {}\n );\n\n const props = exposedStates.concat(\n validProxyProps.map((entry) => entry[0])\n );\n const methods = proxyMethods.map((entry) => entry[0]);\n\n const nativeProps = props\n .concat(methods)\n .filter(\n (prop) => prop in HTMLElement.prototype && !allowedNativeProps.has(prop)\n );\n if (nativeProps.length > 0) {\n warnAboutStrictMode(\n strict,\n \"Using native HTMLElement properties as template properties or methods\",\n tagName,\n ...nativeProps\n );\n // istanbul ignore next\n if (strict) {\n throw new Error(\n `In custom template \"${tagName}\", ${nativeProps\n .map((p) => `\"${p}\"`)\n .join(\n \", \"\n )} are native HTMLElement properties, and should be avoid to be used as brick properties or methods.`\n );\n }\n }\n\n if (registered) {\n return;\n }\n\n class TplElement extends HTMLElement {\n get $$typeof() {\n return \"custom-template\" as const;\n }\n\n static get _dev_only_definedProperties(): string[] {\n return props;\n }\n\n static get _dev_only_definedMethods(): string[] {\n return methods;\n }\n\n $$getElementByRef(this: RuntimeBrickElement, ref: string) {\n return this.$$tplStateStore?.hostBrick?.tplHostMetadata?.internalBricksByRef.get(\n ref\n )?.element;\n }\n\n connectedCallback() {\n let shadowRoot = this.shadowRoot;\n if (!shadowRoot) {\n shadowRoot = this.attachShadow({ mode: \"open\" });\n }\n const fragment = document.createDocumentFragment();\n const style = document.createElement(\"style\");\n style.textContent = \":host{display:block}:host([hidden]){display:none}\";\n const slot = document.createElement(\"slot\");\n fragment.appendChild(style);\n fragment.appendChild(slot);\n shadowRoot.appendChild(fragment);\n }\n\n disconnectedCallback() {\n if (this.shadowRoot) {\n this.shadowRoot.textContent = \"\";\n }\n }\n }\n\n for (const propName of exposedStates) {\n if (validProxyProps.some((entry) => entry[0] === propName)) {\n // eslint-disable-next-line no-console\n console.error(\n `Cannot define an exposed state that is also a proxy property: \"${propName}\" in ${tagName}`\n );\n continue;\n }\n Object.defineProperty(TplElement.prototype, propName, {\n get(this: RuntimeBrickElement) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this.$$tplStateStore!.getValue(propName);\n },\n set(this: RuntimeBrickElement, value: unknown) {\n // 在 mount 过程中,先设置属性,再设置 `$$tplStateStore`,这样,当触发属性设置时,\n // 避免初始化的一次 state update 操作及其 onChange 事件。\n this.$$tplStateStore?.updateValue(propName, value, \"replace\");\n },\n enumerable: true,\n });\n }\n\n for (const [from, to] of validProxyProps) {\n Object.defineProperty(TplElement.prototype, from, {\n get(this: TplElement) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const element = this.$$getElementByRef!(to.ref) as unknown as Record<\n string,\n unknown\n >;\n return element[to.refProperty ?? from];\n },\n set(this: TplElement, value: unknown) {\n // 同上 exposedState.set\n const element = this.$$getElementByRef?.(to.ref) as unknown as Record<\n string,\n unknown\n >;\n if (element) {\n element[to.refProperty ?? from] = value;\n }\n },\n enumerable: true,\n });\n }\n\n for (const [from, to] of proxyMethods) {\n Object.defineProperty(TplElement.prototype, from, {\n value(this: TplElement, ...args: unknown[]) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const element = this.$$getElementByRef!(to.ref) as unknown as Record<\n string,\n Function\n >;\n element[to.refMethod ?? from](...args);\n },\n enumerable: true,\n });\n }\n\n customElements.define(tagName, TplElement);\n }\n\n get(tagName: string) {\n return this.#registry.get(tagName);\n }\n}\n\nfunction getExposedStates(state: ContextConf[] | undefined): string[] {\n // Allow duplicated state names which maybe mutually exclusive.\n return uniq(\n state?.filter((item) => item.expose).map((item) => item.name) ?? []\n );\n}\n\n// istanbul ignore next\nfunction getCustomTemplatesV2() {\n const v2Kit = getV2RuntimeFromDll();\n if (v2Kit) {\n return Object.freeze({\n define(tagName: string, constructor: CustomTemplateConstructor) {\n return v2Kit.getRuntime().registerCustomTemplate(tagName, constructor);\n },\n }) as CustomTemplateRegistry;\n }\n}\n\n// istanbul ignore next\nexport const customTemplates =\n getCustomTemplatesV2() || new CustomTemplateRegistry();\n"],"mappings":";;;;;;AAMA,IAAAA,OAAA,GAAA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EC,WAAW,CAAC;MACxE;IACF,CAAC,CAAC;EACJ;AACF;;AAEA;AACO,MAAMuG,eAAe,GAC1BN,oBAAoB,CAAC,CAAC,IAAI,IAAItG,sBAAsB,CAAC,CAAC;AAAC6G,OAAA,CAAAD,eAAA,GAAAA,eAAA"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getV2RuntimeFromDll = getV2RuntimeFromDll;
7
+ function getV2RuntimeFromDll() {
8
+ var _window$BRICK_NEXT_VE;
9
+ const {
10
+ dll
11
+ } = window;
12
+ if (dll && (_window$BRICK_NEXT_VE = window.BRICK_NEXT_VERSIONS) !== null && _window$BRICK_NEXT_VE !== void 0 && (_window$BRICK_NEXT_VE = _window$BRICK_NEXT_VE["brick-container"]) !== null && _window$BRICK_NEXT_VE !== void 0 && _window$BRICK_NEXT_VE.startsWith("2.")) {
13
+ return dll("tYg3");
14
+ }
15
+ }
16
+ //# sourceMappingURL=getV2RuntimeFromDll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getV2RuntimeFromDll.js","names":["getV2RuntimeFromDll","_window$BRICK_NEXT_VE","dll","window","BRICK_NEXT_VERSIONS","startsWith"],"sources":["../../src/getV2RuntimeFromDll.ts"],"sourcesContent":["import type {\n CustomTemplateConstructor,\n MetaI18n,\n StoryboardFunction,\n} from \"@next-core/types\";\nimport type { NextHistory } from \"./history.js\";\nimport type { IfContainer } from \"./internal/compute/checkIf.js\";\n\ninterface DLL {\n (moduleId: \"tYg3\"): Kit;\n}\n\ninterface Kit {\n getRuntime(): {\n registerCustomTemplate(\n tagName: string,\n constructor: CustomTemplateConstructor\n ): void;\n registerCustomProcessor(\n processorFullName: string,\n processorFunc: Function\n ): void;\n registerWidgetFunctions(\n widgetId: string,\n functions: StoryboardFunction[],\n widgetVersion?: string\n ): void;\n registerWidgetI18n(widgetId: string, i18nData: MetaI18n): void;\n };\n getHistory(): NextHistory;\n looseCheckIfByTransform(ifContainer: IfContainer, data: unknown): boolean;\n SingleBrickAsComponentFactory: any;\n BrickAsComponentFactory: any;\n authenticate: any;\n getAuth: any;\n isLoggedIn: any;\n logout: any;\n}\n\nexport function getV2RuntimeFromDll() {\n const { dll } = window as { dll?: DLL };\n if (\n dll &&\n window.BRICK_NEXT_VERSIONS?.[\"brick-container\"]?.startsWith(\"2.\")\n ) {\n return dll(\"tYg3\");\n }\n}\n"],"mappings":";;;;;;AAuCO,SAASA,mBAAmBA,CAAA,EAAG;EAAA,IAAAC,qBAAA;EACpC,MAAM;IAAEC;EAAI,CAAC,GAAGC,MAAuB;EACvC,IACED,GAAG,KAAAD,qBAAA,GACHE,MAAM,CAACC,mBAAmB,cAAAH,qBAAA,gBAAAA,qBAAA,GAA1BA,qBAAA,CAA6B,iBAAiB,CAAC,cAAAA,qBAAA,eAA/CA,qBAAA,CAAiDI,UAAU,CAAC,IAAI,CAAC,EACjE;IACA,OAAOH,GAAG,CAAC,MAAM,CAAC;EACpB;AACF"}
@@ -4,15 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createHistory = createHistory;
7
- exports.getHistory = getHistory;
8
- var _history2 = require("history");
7
+ exports.getHistory = void 0;
8
+ var _history = require("history");
9
9
  var _getBasePath = require("./getBasePath.js");
10
10
  var _historyExtended = require("./internal/historyExtended.js");
11
+ var _getV2RuntimeFromDll = require("./getV2RuntimeFromDll.js");
11
12
  let history;
12
13
  function createHistory() {
13
14
  if (!history) {
14
15
  // https://github.com/remix-run/history/issues/810
15
- const browserHistory = (0, _history2.createBrowserHistory)({
16
+ const browserHistory = (0, _history.createBrowserHistory)({
16
17
  basename: (0, _getBasePath.getBasePath)().replace(/\/$/, ""),
17
18
  getUserConfirmation: _historyExtended.getUserConfirmation
18
19
  });
@@ -21,21 +22,19 @@ function createHistory() {
21
22
  }
22
23
  return history;
23
24
  }
24
- function getHistory() {
25
- var _history;
26
- return (_history = history) !== null && _history !== void 0 ? _history : getV2History();
25
+ function getHistoryV3() {
26
+ return history;
27
27
  }
28
28
 
29
29
  /**
30
- * When using v3 bricks in v2 runtime, return history from v2 runtime.
30
+ * When using v3 bricks in v2 container, return history from v2 container.
31
31
  */
32
- function getV2History() {
33
- const {
34
- dll
35
- } = window;
36
- if (typeof dll === "function") {
37
- const LegacyBrickKit = dll("tYg3");
38
- return LegacyBrickKit.getHistory();
32
+ function getHistoryV2Factory() {
33
+ const v2Kit = (0, _getV2RuntimeFromDll.getV2RuntimeFromDll)();
34
+ if (v2Kit) {
35
+ return v2Kit.getHistory;
39
36
  }
40
37
  }
38
+ const getHistory = getHistoryV2Factory() || getHistoryV3;
39
+ exports.getHistory = getHistory;
41
40
  //# sourceMappingURL=history.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"history.js","names":["_history2","require","_getBasePath","_historyExtended","history","createHistory","browserHistory","createBrowserHistory","basename","getBasePath","replace","getUserConfirmation","Object","assign","historyExtended","getHistory","_history","getV2History","dll","window","LegacyBrickKit"],"sources":["../../src/history.ts"],"sourcesContent":["import { History, Location, createBrowserHistory } from \"history\";\nimport { getBasePath } from \"./getBasePath.js\";\nimport {\n type ExtendedHistory,\n getUserConfirmation,\n historyExtended,\n NextHistoryState,\n} from \"./internal/historyExtended.js\";\n\nexport type NextHistory = History<NextHistoryState> & ExtendedHistory;\n\nlet history: NextHistory;\n\nexport function createHistory(): NextHistory {\n if (!history) {\n // https://github.com/remix-run/history/issues/810\n const browserHistory = createBrowserHistory<NextHistoryState>({\n basename: getBasePath().replace(/\\/$/, \"\"),\n getUserConfirmation,\n });\n Object.assign(browserHistory, historyExtended(browserHistory));\n history = browserHistory as NextHistory;\n }\n return history;\n}\n\nexport function getHistory(): NextHistory {\n return history ?? getV2History();\n}\n\n/**\n * When using v3 bricks in v2 runtime, return history from v2 runtime.\n */\nfunction getV2History() {\n const { dll } = window as unknown as { dll?: DLL };\n if (typeof dll === \"function\") {\n const LegacyBrickKit = dll(\"tYg3\");\n return LegacyBrickKit.getHistory();\n }\n}\n\ninterface DLL {\n (moduleId: \"tYg3\"): {\n getHistory(): NextHistory;\n };\n}\n\nexport type NextLocation = Location<NextHistoryState>;\n\nexport type { NextHistoryState };\n"],"mappings":";;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AASA,IAAIG,OAAoB;AAEjB,SAASC,aAAaA,CAAA,EAAgB;EAC3C,IAAI,CAACD,OAAO,EAAE;IACZ;IACA,MAAME,cAAc,GAAG,IAAAC,8BAAoB,EAAmB;MAC5DC,QAAQ,EAAE,IAAAC,wBAAW,EAAC,CAAC,CAACC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;MAC1CC,mBAAmB,EAAnBA;IACF,CAAC,CAAC;IACFC,MAAM,CAACC,MAAM,CAACP,cAAc,EAAE,IAAAQ,gCAAe,EAACR,cAAc,CAAC,CAAC;IAC9DF,OAAO,GAAGE,cAA6B;EACzC;EACA,OAAOF,OAAO;AAChB;AAEO,SAASW,UAAUA,CAAA,EAAgB;EAAA,IAAAC,QAAA;EACxC,QAAAA,QAAA,GAAOZ,OAAO,cAAAY,QAAA,cAAAA,QAAA,GAAIC,YAAY,CAAC,CAAC;AAClC;;AAEA;AACA;AACA;AACA,SAASA,YAAYA,CAAA,EAAG;EACtB,MAAM;IAAEC;EAAI,CAAC,GAAGC,MAAkC;EAClD,IAAI,OAAOD,GAAG,KAAK,UAAU,EAAE;IAC7B,MAAME,cAAc,GAAGF,GAAG,CAAC,MAAM,CAAC;IAClC,OAAOE,cAAc,CAACL,UAAU,CAAC,CAAC;EACpC;AACF"}
1
+ {"version":3,"file":"history.js","names":["_history","require","_getBasePath","_historyExtended","_getV2RuntimeFromDll","history","createHistory","browserHistory","createBrowserHistory","basename","getBasePath","replace","getUserConfirmation","Object","assign","historyExtended","getHistoryV3","getHistoryV2Factory","v2Kit","getV2RuntimeFromDll","getHistory","exports"],"sources":["../../src/history.ts"],"sourcesContent":["import { History, Location, createBrowserHistory } from \"history\";\nimport { getBasePath } from \"./getBasePath.js\";\nimport {\n type ExtendedHistory,\n getUserConfirmation,\n historyExtended,\n NextHistoryState,\n} from \"./internal/historyExtended.js\";\nimport { getV2RuntimeFromDll } from \"./getV2RuntimeFromDll.js\";\n\nexport type NextHistory = History<NextHistoryState> & ExtendedHistory;\n\nlet history: NextHistory;\n\nexport function createHistory(): NextHistory {\n if (!history) {\n // https://github.com/remix-run/history/issues/810\n const browserHistory = createBrowserHistory<NextHistoryState>({\n basename: getBasePath().replace(/\\/$/, \"\"),\n getUserConfirmation,\n });\n Object.assign(browserHistory, historyExtended(browserHistory));\n history = browserHistory as NextHistory;\n }\n return history;\n}\n\nfunction getHistoryV3(): NextHistory {\n return history;\n}\n\n/**\n * When using v3 bricks in v2 container, return history from v2 container.\n */\nfunction getHistoryV2Factory() {\n const v2Kit = getV2RuntimeFromDll();\n if (v2Kit) {\n return v2Kit.getHistory;\n }\n}\n\nexport const getHistory = getHistoryV2Factory() || getHistoryV3;\n\nexport type NextLocation = Location<NextHistoryState>;\n\nexport type { NextHistoryState };\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AAMA,IAAAG,oBAAA,GAAAH,OAAA;AAIA,IAAII,OAAoB;AAEjB,SAASC,aAAaA,CAAA,EAAgB;EAC3C,IAAI,CAACD,OAAO,EAAE;IACZ;IACA,MAAME,cAAc,GAAG,IAAAC,6BAAoB,EAAmB;MAC5DC,QAAQ,EAAE,IAAAC,wBAAW,EAAC,CAAC,CAACC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;MAC1CC,mBAAmB,EAAnBA;IACF,CAAC,CAAC;IACFC,MAAM,CAACC,MAAM,CAACP,cAAc,EAAE,IAAAQ,gCAAe,EAACR,cAAc,CAAC,CAAC;IAC9DF,OAAO,GAAGE,cAA6B;EACzC;EACA,OAAOF,OAAO;AAChB;AAEA,SAASW,YAAYA,CAAA,EAAgB;EACnC,OAAOX,OAAO;AAChB;;AAEA;AACA;AACA;AACA,SAASY,mBAAmBA,CAAA,EAAG;EAC7B,MAAMC,KAAK,GAAG,IAAAC,wCAAmB,EAAC,CAAC;EACnC,IAAID,KAAK,EAAE;IACT,OAAOA,KAAK,CAACE,UAAU;EACzB;AACF;AAEO,MAAMA,UAAU,GAAGH,mBAAmB,CAAC,CAAC,IAAID,YAAY;AAACK,OAAA,CAAAD,UAAA,GAAAA,UAAA"}
package/dist/cjs/index.js CHANGED
@@ -240,4 +240,16 @@ var _StoryboardFunctionRegistry = require("./StoryboardFunctionRegistry.js");
240
240
  var _matchPath = require("./internal/matchPath.js");
241
241
  var _Notification = require("./Notification.js");
242
242
  var _Dialog = require("./Dialog.js");
243
+ var _getV2RuntimeFromDll = require("./getV2RuntimeFromDll.js");
244
+ Object.keys(_getV2RuntimeFromDll).forEach(function (key) {
245
+ if (key === "default" || key === "__esModule") return;
246
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
247
+ if (key in exports && exports[key] === _getV2RuntimeFromDll[key]) return;
248
+ Object.defineProperty(exports, key, {
249
+ enumerable: true,
250
+ get: function () {
251
+ return _getV2RuntimeFromDll[key];
252
+ }
253
+ });
254
+ });
243
255
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_auth","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_CustomProcessors","_CustomTemplates","_fetchByProvider","_getBasePath","_getPageInfo","_handleHttpError","_history","_createRoot","_Runtime","__secret_internals","_interopRequireWildcard","_test_only","_themeAndMode","_checkIf","_WidgetFunctions","_WidgetI18n","_StoryboardFunctionRegistry","_matchPath","_Notification","_Dialog"],"sources":["../../src/index.ts"],"sourcesContent":["export * from \"./auth.js\";\nexport * from \"./CustomProcessors.js\";\nexport * from \"./CustomTemplates.js\";\nexport * from \"./fetchByProvider.js\";\nexport * from \"./getBasePath.js\";\nexport * from \"./getPageInfo.js\";\nexport * from \"./handleHttpError.js\";\nexport * from \"./history.js\";\nexport * from \"./createRoot.js\";\nexport {\n createRuntime,\n getRuntime,\n type RuntimeOptions,\n type RuntimeHooks,\n type RuntimeHooksMenuHelpers,\n type ImagesFactory,\n type PageViewInfo,\n} from \"./internal/Runtime.js\";\nimport * as __secret_internals from \"./internal/secret_internals.js\";\nexport { __secret_internals };\nexport { __test_only } from \"./internal/test_only.js\";\nexport {\n getCssPropertyValue,\n getCurrentTheme,\n getCurrentMode,\n batchSetAppsLocalTheme,\n applyTheme,\n} from \"./themeAndMode.js\";\nexport {\n checkIfOfComputed,\n checkIfByTransform,\n} from \"./internal/compute/checkIf.js\";\nexport { registerWidgetFunctions } from \"./internal/compute/WidgetFunctions.js\";\nexport { registerWidgetI18n } from \"./internal/compute/WidgetI18n.js\";\nexport { StoryboardFunctionRegistryFactory } from \"./StoryboardFunctionRegistry.js\";\nexport { matchPath } from \"./internal/matchPath.js\";\nexport { Notification, type NotificationOptions } from \"./Notification.js\";\nexport { Dialog, type DialogOptions } from \"./Dialog.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,KAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,C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AAhB,GAAA;IAAA;EAAA;AAAA;AACA,IAAAiB,QAAA,GAAArB,OAAA;AASA,IAAAsB,kBAAA,GAAAC,uBAAA,CAAAvB,OAAA;AAAqES,OAAA,CAAAa,kBAAA,GAAAA,kBAAA;AAErE,IAAAE,UAAA,GAAAxB,OAAA;AACA,IAAAyB,aAAA,GAAAzB,OAAA;AAOA,IAAA0B,QAAA,GAAA1B,OAAA;AAIA,IAAA2B,gBAAA,GAAA3B,OAAA;AACA,IAAA4B,WAAA,GAAA5B,OAAA;AACA,IAAA6B,2BAAA,GAAA7B,OAAA;AACA,IAAA8B,UAAA,GAAA9B,OAAA;AACA,IAAA+B,aAAA,GAAA/B,OAAA;AACA,IAAAgC,OAAA,GAAAhC,OAAA"}
1
+ {"version":3,"file":"index.js","names":["_auth","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_CustomProcessors","_CustomTemplates","_fetchByProvider","_getBasePath","_getPageInfo","_handleHttpError","_history","_createRoot","_Runtime","__secret_internals","_interopRequireWildcard","_test_only","_themeAndMode","_checkIf","_WidgetFunctions","_WidgetI18n","_StoryboardFunctionRegistry","_matchPath","_Notification","_Dialog","_getV2RuntimeFromDll"],"sources":["../../src/index.ts"],"sourcesContent":["export * from \"./auth.js\";\nexport * from \"./CustomProcessors.js\";\nexport * from \"./CustomTemplates.js\";\nexport * from \"./fetchByProvider.js\";\nexport * from \"./getBasePath.js\";\nexport * from \"./getPageInfo.js\";\nexport * from \"./handleHttpError.js\";\nexport * from \"./history.js\";\nexport * from \"./createRoot.js\";\nexport {\n createRuntime,\n getRuntime,\n type RuntimeOptions,\n type RuntimeHooks,\n type RuntimeHooksMenuHelpers,\n type ImagesFactory,\n type PageViewInfo,\n} from \"./internal/Runtime.js\";\nimport * as __secret_internals from \"./internal/secret_internals.js\";\nexport { __secret_internals };\nexport { __test_only } from \"./internal/test_only.js\";\nexport {\n getCssPropertyValue,\n getCurrentTheme,\n getCurrentMode,\n batchSetAppsLocalTheme,\n applyTheme,\n} from \"./themeAndMode.js\";\nexport {\n checkIfOfComputed,\n checkIfByTransform,\n} from \"./internal/compute/checkIf.js\";\nexport { registerWidgetFunctions } from \"./internal/compute/WidgetFunctions.js\";\nexport { registerWidgetI18n } from \"./internal/compute/WidgetI18n.js\";\nexport { StoryboardFunctionRegistryFactory } from \"./StoryboardFunctionRegistry.js\";\nexport { matchPath } from \"./internal/matchPath.js\";\nexport { Notification, type NotificationOptions } from \"./Notification.js\";\nexport { Dialog, type DialogOptions } from \"./Dialog.js\";\nexport * from \"./getV2RuntimeFromDll.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,KAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,KAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,iBAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,iBAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,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AA8B,UAAA,GAAA9B,OAAA;AACA,IAAA+B,aAAA,GAAA/B,OAAA;AACA,IAAAgC,OAAA,GAAAhC,OAAA;AACA,IAAAiC,oBAAA,GAAAjC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAA+B,oBAAA,EAAA9B,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAA6B,oBAAA,CAAA7B,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAqB,oBAAA,CAAA7B,GAAA;IAAA;EAAA;AAAA"}
@@ -13,8 +13,7 @@ exports._internalApiMatchStoryboard = _internalApiMatchStoryboard;
13
13
  exports._test_only_setBootstrapData = void 0;
14
14
  exports.createRuntime = createRuntime;
15
15
  exports.getBrickPackages = getBrickPackages;
16
- exports.getRuntime = getRuntime;
17
- exports.hooks = void 0;
16
+ exports.hooks = exports.getRuntime = void 0;
18
17
  var _i18n = require("@next-core/i18n");
19
18
  var _loader = require("@next-core/loader");
20
19
  var _general = require("@next-core/utils/general");
@@ -29,6 +28,7 @@ var _Dialog = require("../Dialog.js");
29
28
  var _injected = require("./injected.js");
30
29
  var _hasInstalledApp = require("./hasInstalledApp.js");
31
30
  var _devtools = require("./devtools.js");
31
+ var _getV2RuntimeFromDll = require("../getV2RuntimeFromDll.js");
32
32
  let runtime;
33
33
 
34
34
  // Allow inject bootstrap data in a runtime other than Brick Next.
@@ -51,9 +51,41 @@ function createRuntime(options) {
51
51
  runtime = new Runtime();
52
52
  return runtime;
53
53
  }
54
- function getRuntime() {
54
+ function getRuntimeV3() {
55
55
  return runtime;
56
56
  }
57
+
58
+ // istanbul ignore next
59
+ function getRuntimeV2Factory() {
60
+ const v2Kit = (0, _getV2RuntimeFromDll.getV2RuntimeFromDll)();
61
+ if (v2Kit) {
62
+ return function getRuntimeV2() {
63
+ return new Proxy(v2Kit.getRuntime(), {
64
+ get(...args) {
65
+ const key = args[1];
66
+ switch (key) {
67
+ case "getCurrentApp":
68
+ case "hasInstalledApp":
69
+ case "getDesktops":
70
+ case "getLaunchpadSettings":
71
+ case "getLaunchpadSiteMap":
72
+ case "toggleLaunchpadEffect":
73
+ case "applyPageTitle":
74
+ case "getNavConfig":
75
+ case "getFeatureFlags":
76
+ case "getMiscSettings":
77
+ case "getBrandSettings":
78
+ return Reflect.get(...args);
79
+ }
80
+ }
81
+ });
82
+ };
83
+ }
84
+ }
85
+
86
+ // istanbul ignore next
87
+ const getRuntime = getRuntimeV2Factory() || getRuntimeV3;
88
+ exports.getRuntime = getRuntime;
57
89
  class Runtime {
58
90
  #initialized = false;
59
91
  #bootstrapped = false;
@@ -1 +1 @@
1
- {"version":3,"file":"Runtime.js","names":["_i18n","require","_loader","_general","_moment","_interopRequireDefault","_history","_matchStoryboard","_Router","_i18n2","_Notification","_Dialog","_injected","_hasInstalledApp","_devtools","runtime","bootstrapData","router","hooks","exports","createRuntime","options","Error","listenDevtoolsEagerly","initializeI18n","NS","locales","moment","locale","i18n","language","on","createHistory","Runtime","getRuntime","initialized","bootstrapped","initialize","data","_data$settings$preset","_data$settings","normalizeBootstrapData","notification","dialog","settings","presetBricks","loadNotificationService","loadBricks","loadDialogService","bootstrap","Router","storyboards","getRecentApps","_router$getRecentApps","_router","getCurrentApp","_router2","currentApp","hasInstalledApp","appId","matchVersion","getFeatureFlags","_bootstrapData","_router3","featureFlags","config","getMiscSettings","_bootstrapData2","_router4","misc","getBrandSettings","_bootstrapData3","base_title","brand","getLaunchpadSettings","_bootstrapData4","columns","rows","launchpad","getDesktops","_bootstrapData$deskto","_bootstrapData5","desktops","getLaunchpadSiteMap","_bootstrapData$siteSo","_bootstrapData6","siteSort","toggleLaunchpadEffect","open","document","body","classList","toggle","applyPageTitle","pageTitle","baseTitle","title","getNavConfig","_router5","bricks","loadBricksImperatively","getBrickPackages","Array","isArray","app","ns","id","Object","entries","forEach","lang","resources","addResourceBundle","localeName","getFixedT","name","keys","removeResourceBundle","isObject","deepFreeze","brickPackages","_ref","_ref2","_bootstrapData$brickP","_bootstrapData7","injectedBrickPackages","window","STANDALONE_BRICK_PACKAGES","_internalApiGetRenderId","_router6","getRenderId","_internalApiMatchStoryboard","pathname","_bootstrapData$storyb","_bootstrapData8","matchStoryboard","_internalApiGetRuntimeContext","_router7","getRuntimeContext","_internalApiGetStoryboardInBootstrapData","_bootstrapData9","find","storyboard","_internalApiGetAppInBootstrapData","_internalApiGetStoryb","_test_only_setBootstrapData","process","env","NODE_ENV"],"sources":["../../../src/internal/Runtime.ts"],"sourcesContent":["import type {\n RuntimeStoryboard,\n BootstrapSettings,\n FeatureFlags,\n BootstrapData,\n Contract,\n Storyboard,\n BrickConf,\n RouteConf,\n ResolveConf,\n BrickPackage,\n} from \"@next-core/types\";\nimport { i18n, initializeI18n } from \"@next-core/i18n\";\nimport { loadBricksImperatively } from \"@next-core/loader\";\nimport { deepFreeze, isObject } from \"@next-core/utils/general\";\nimport type { PermissionApi_validatePermissions } from \"@next-api-sdk/micro-app-sdk\";\nimport moment from \"moment\";\nimport \"moment/locale/zh-cn.js\";\nimport { createHistory } from \"../history.js\";\nimport { matchStoryboard } from \"./matchStoryboard.js\";\nimport { Router } from \"./Router.js\";\nimport { NS, locales } from \"./i18n.js\";\nimport { loadNotificationService } from \"../Notification.js\";\nimport { loadDialogService } from \"../Dialog.js\";\nimport { injectedBrickPackages } from \"./injected.js\";\nimport { type AppForCheck, hasInstalledApp } from \"./hasInstalledApp.js\";\nimport type { RuntimeContext } from \"./interfaces.js\";\nimport { listenDevtoolsEagerly } from \"./devtools.js\";\n\nlet runtime: Runtime;\n\n// Allow inject bootstrap data in a runtime other than Brick Next.\nlet bootstrapData: BootstrapData | undefined;\nlet router: Router | undefined;\n\nexport interface RuntimeOptions {\n hooks?: RuntimeHooks;\n}\n\nexport interface ImagesFactory {\n get(name: string): string;\n}\n\nexport interface PageViewInfo {\n status: \"ok\" | \"failed\" | \"redirected\" | \"not-found\";\n path?: string;\n pageTitle?: string;\n}\n\nexport interface RuntimeHooks {\n auth?: {\n getAuth(): object;\n isLoggedIn(): boolean;\n authenticate?(...args: unknown[]): unknown;\n logout?(...args: unknown[]): unknown;\n };\n fulfilStoryboard?: (storyboard: RuntimeStoryboard) => Promise<void>;\n validatePermissions?: typeof PermissionApi_validatePermissions;\n checkPermissions?: {\n checkPermissions(...actions: string[]): boolean;\n preCheckPermissions(storyboard: Storyboard): Promise<void> | undefined;\n preCheckPermissionsForBrickOrRoute(\n container: BrickConf | RouteConf,\n asyncComputeRealValue: (value: unknown) => Promise<unknown>\n ): Promise<void> | undefined;\n };\n checkInstalledApps?: {\n preCheckInstalledApps(\n storyboard: Storyboard,\n hasAppInBootstrap: (appId: string) => boolean\n ): void;\n waitForCheckingApps(appIds: string[]): Promise<void>;\n getCheckedApp(appId: string): AppForCheck | undefined;\n };\n flowApi?: {\n FLOW_API_PROVIDER: string;\n registerFlowApiProvider(): void;\n isFlowApiProvider(provider: string): boolean;\n getArgsOfFlowApi(\n provider: string,\n originalArgs: unknown[],\n method?: string\n ): Promise<unknown[]>;\n collectContract(contracts: Contract[] | undefined): void;\n collectWidgetContract(contracts: Contract[] | undefined): void;\n clearCollectWidgetContract(): void;\n };\n menu?: {\n getMenuById(menuId: string): unknown;\n fetchMenuById(\n menuId: string,\n runtimeContext: RuntimeContext,\n runtimeHelpers: RuntimeHooksMenuHelpers\n ): Promise<unknown>;\n };\n images?: {\n imagesFactory(\n appId: string,\n isBuildPush?: boolean,\n version?: string\n ): ImagesFactory;\n widgetImagesFactory(\n widgetId: string,\n widgetVersion?: string\n ): ImagesFactory;\n };\n messageDispatcher?: {\n subscribe(...args: unknown[]): Promise<unknown>;\n unsubscribe(...args: unknown[]): Promise<unknown>;\n onMessage(channel: string, listener: (data: unknown) => void): void;\n onClose(listener: () => void): void;\n reset(): void;\n };\n pageView?: {\n create(): (info: PageViewInfo) => void;\n };\n}\n\nexport interface RuntimeHooksMenuHelpers {\n getStoryboardByAppId(appId: string): Storyboard | undefined;\n resolveData(\n resolveConf: ResolveConf,\n runtimeContext: RuntimeContext\n ): Promise<unknown>;\n asyncComputeRealValue(\n value: unknown,\n runtimeContext: RuntimeContext,\n options?: { ignoreSymbols?: boolean; noInject?: boolean }\n ): Promise<unknown>;\n}\n\nexport let hooks: RuntimeHooks | undefined;\n\nexport function createRuntime(options?: RuntimeOptions) {\n if (runtime) {\n throw new Error(\"Cannot create multiple runtimes\");\n }\n listenDevtoolsEagerly();\n hooks = options?.hooks;\n initializeI18n(NS, locales);\n moment.locale(i18n.language);\n i18n.on(\"languageChanged\", () => {\n moment.locale(i18n.language);\n });\n createHistory();\n runtime = new Runtime();\n return runtime;\n}\n\nexport function getRuntime() {\n return runtime;\n}\n\nexport class Runtime {\n #initialized = false;\n #bootstrapped = false;\n\n initialize(data: BootstrapData) {\n if (this.#initialized) {\n throw new Error(\"The runtime cannot be initialized more than once\");\n }\n this.#initialized = true;\n normalizeBootstrapData(data);\n bootstrapData = data;\n const { notification, dialog } = (data.settings?.presetBricks ?? {}) as {\n notification?: string | false;\n dialog?: string | false;\n };\n if (notification !== false) {\n loadNotificationService(\n notification ?? \"basic.show-notification\",\n this.loadBricks\n );\n }\n if (dialog !== false) {\n loadDialogService(dialog ?? \"basic.show-dialog\", this.loadBricks);\n }\n }\n\n async bootstrap(data?: BootstrapData) {\n if (data) {\n this.initialize(data);\n }\n if (this.#bootstrapped) {\n throw new Error(\"The runtime cannot be bootstrapped more than once\");\n }\n this.#bootstrapped = true;\n router = new Router(bootstrapData!.storyboards!);\n await router.bootstrap();\n }\n\n getRecentApps() {\n return router?.getRecentApps() ?? {};\n }\n\n getCurrentApp() {\n return router?.getRecentApps().currentApp;\n }\n\n hasInstalledApp(appId: string, matchVersion?: string): boolean {\n return hasInstalledApp(appId, matchVersion);\n }\n\n getFeatureFlags(): FeatureFlags {\n return {\n ...bootstrapData?.settings?.featureFlags,\n ...(\n router?.getRecentApps().currentApp?.config\n ?.settings as BootstrapSettings\n )?.featureFlags,\n \"migrate-to-brick-next-v3\": true,\n };\n }\n\n getMiscSettings() {\n return {\n ...bootstrapData?.settings?.misc,\n ...(\n router?.getRecentApps().currentApp?.config\n ?.settings as BootstrapSettings\n )?.misc,\n };\n }\n\n getBrandSettings(): Record<string, string> {\n return {\n base_title: \"DevOps 管理专家\",\n ...(bootstrapData?.settings?.brand as Record<string, string>),\n };\n }\n\n getLaunchpadSettings() {\n return {\n columns: 7,\n rows: 4,\n ...bootstrapData?.settings?.launchpad,\n };\n }\n\n getDesktops(): unknown[] {\n return bootstrapData?.desktops ?? [];\n }\n\n getLaunchpadSiteMap(): unknown[] {\n return bootstrapData?.siteSort ?? [];\n }\n\n toggleLaunchpadEffect(open: boolean): void {\n document.body.classList.toggle(\"launchpad-open\", open);\n }\n\n applyPageTitle(pageTitle: string): void {\n const baseTitle = this.getBrandSettings().base_title;\n document.title = pageTitle ? `${pageTitle} - ${baseTitle}` : baseTitle;\n }\n\n getNavConfig() {\n return router?.getNavConfig();\n }\n\n loadBricks(bricks: string[] | Set<string>) {\n return loadBricksImperatively(bricks, getBrickPackages());\n }\n}\n\nfunction normalizeBootstrapData(data: BootstrapData) {\n if (Array.isArray(data.storyboards)) {\n for (const { app } of data.storyboards) {\n if (app.locales) {\n // Prefix to avoid conflict between brick package's i18n namespace.\n const ns = `tmp/${app.id}`;\n // Support any languages in `app.locales`.\n Object.entries(app.locales).forEach(([lang, resources]) => {\n i18n.addResourceBundle(lang, ns, resources);\n });\n // Use `app.name` as the fallback `app.localeName`.\n app.localeName = i18n.getFixedT(null, ns)(\"name\", app.name) as string;\n // Remove the temporary i18n resource bundles.\n Object.keys(app.locales).forEach((lang) => {\n i18n.removeResourceBundle(lang, ns);\n });\n } else {\n app.localeName = app.name;\n }\n }\n }\n if (isObject(data.settings)) {\n deepFreeze(data.settings);\n }\n if (data.brickPackages) {\n deepFreeze(data.brickPackages);\n }\n}\n\nexport function getBrickPackages() {\n return (\n bootstrapData?.brickPackages ??\n injectedBrickPackages ??\n (window.STANDALONE_BRICK_PACKAGES as BrickPackage[]) ??\n []\n );\n}\n\nexport function _internalApiGetRenderId(): string | undefined {\n return router?.getRenderId();\n}\n\nexport function _internalApiMatchStoryboard(\n pathname: string\n): RuntimeStoryboard | undefined {\n return matchStoryboard(bootstrapData?.storyboards ?? [], pathname);\n}\n\nexport function _internalApiGetRuntimeContext() {\n return router?.getRuntimeContext();\n}\n\nexport function _internalApiGetStoryboardInBootstrapData(appId: string) {\n return bootstrapData?.storyboards?.find(\n (storyboard) => storyboard.app.id === appId\n );\n}\n\nexport function _internalApiGetAppInBootstrapData(appId: string) {\n return _internalApiGetStoryboardInBootstrapData(appId)?.app;\n}\n\nexport let _test_only_setBootstrapData: (data: BootstrapData) => void;\n\n// istanbul ignore next\nif (process.env.NODE_ENV === \"test\") {\n _test_only_setBootstrapData = (data) => {\n bootstrapData = data as BootstrapData;\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAYA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACAA,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,gBAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,aAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,SAAA,GAAAX,OAAA;AACA,IAAAY,gBAAA,GAAAZ,OAAA;AAEA,IAAAa,SAAA,GAAAb,OAAA;AAEA,IAAIc,OAAgB;;AAEpB;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BAAA,uBAA/CA,qBAAA,CAAiDxC,GAAG;AAC7D;AAEO,IAAIyC,2BAA0D;;AAErE;AAAA9H,OAAA,CAAA8H,2BAAA,GAAAA,2BAAA;AACA,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,MAAM,EAAE;EACnCjI,OAAA,CAAA8H,2BAAA,GAAAA,2BAA2B,GAAI3G,IAAI,IAAK;IACtCtB,aAAa,GAAGsB,IAAqB;EACvC,CAAC;AACH"}
1
+ {"version":3,"file":"Runtime.js","names":["_i18n","require","_loader","_general","_moment","_interopRequireDefault","_history","_matchStoryboard","_Router","_i18n2","_Notification","_Dialog","_injected","_hasInstalledApp","_devtools","_getV2RuntimeFromDll","runtime","bootstrapData","router","hooks","exports","createRuntime","options","Error","listenDevtoolsEagerly","initializeI18n","NS","locales","moment","locale","i18n","language","on","createHistory","Runtime","getRuntimeV3","getRuntimeV2Factory","v2Kit","getV2RuntimeFromDll","getRuntimeV2","Proxy","getRuntime","get","args","key","Reflect","initialized","bootstrapped","initialize","data","_data$settings$preset","_data$settings","normalizeBootstrapData","notification","dialog","settings","presetBricks","loadNotificationService","loadBricks","loadDialogService","bootstrap","Router","storyboards","getRecentApps","_router$getRecentApps","_router","getCurrentApp","_router2","currentApp","hasInstalledApp","appId","matchVersion","getFeatureFlags","_bootstrapData","_router3","featureFlags","config","getMiscSettings","_bootstrapData2","_router4","misc","getBrandSettings","_bootstrapData3","base_title","brand","getLaunchpadSettings","_bootstrapData4","columns","rows","launchpad","getDesktops","_bootstrapData$deskto","_bootstrapData5","desktops","getLaunchpadSiteMap","_bootstrapData$siteSo","_bootstrapData6","siteSort","toggleLaunchpadEffect","open","document","body","classList","toggle","applyPageTitle","pageTitle","baseTitle","title","getNavConfig","_router5","bricks","loadBricksImperatively","getBrickPackages","Array","isArray","app","ns","id","Object","entries","forEach","lang","resources","addResourceBundle","localeName","getFixedT","name","keys","removeResourceBundle","isObject","deepFreeze","brickPackages","_ref","_ref2","_bootstrapData$brickP","_bootstrapData7","injectedBrickPackages","window","STANDALONE_BRICK_PACKAGES","_internalApiGetRenderId","_router6","getRenderId","_internalApiMatchStoryboard","pathname","_bootstrapData$storyb","_bootstrapData8","matchStoryboard","_internalApiGetRuntimeContext","_router7","getRuntimeContext","_internalApiGetStoryboardInBootstrapData","_bootstrapData9","find","storyboard","_internalApiGetAppInBootstrapData","_internalApiGetStoryb","_test_only_setBootstrapData","process","env","NODE_ENV"],"sources":["../../../src/internal/Runtime.ts"],"sourcesContent":["import type {\n RuntimeStoryboard,\n BootstrapSettings,\n FeatureFlags,\n BootstrapData,\n Contract,\n Storyboard,\n BrickConf,\n RouteConf,\n ResolveConf,\n BrickPackage,\n} from \"@next-core/types\";\nimport { i18n, initializeI18n } from \"@next-core/i18n\";\nimport { loadBricksImperatively } from \"@next-core/loader\";\nimport { deepFreeze, isObject } from \"@next-core/utils/general\";\nimport type { PermissionApi_validatePermissions } from \"@next-api-sdk/micro-app-sdk\";\nimport moment from \"moment\";\nimport \"moment/locale/zh-cn.js\";\nimport { createHistory } from \"../history.js\";\nimport { matchStoryboard } from \"./matchStoryboard.js\";\nimport { Router } from \"./Router.js\";\nimport { NS, locales } from \"./i18n.js\";\nimport { loadNotificationService } from \"../Notification.js\";\nimport { loadDialogService } from \"../Dialog.js\";\nimport { injectedBrickPackages } from \"./injected.js\";\nimport { type AppForCheck, hasInstalledApp } from \"./hasInstalledApp.js\";\nimport type { RuntimeContext } from \"./interfaces.js\";\nimport { listenDevtoolsEagerly } from \"./devtools.js\";\nimport { getV2RuntimeFromDll } from \"../getV2RuntimeFromDll.js\";\n\nlet runtime: Runtime;\n\n// Allow inject bootstrap data in a runtime other than Brick Next.\nlet bootstrapData: BootstrapData | undefined;\nlet router: Router | undefined;\n\nexport interface RuntimeOptions {\n hooks?: RuntimeHooks;\n}\n\nexport interface ImagesFactory {\n get(name: string): string;\n}\n\nexport interface PageViewInfo {\n status: \"ok\" | \"failed\" | \"redirected\" | \"not-found\";\n path?: string;\n pageTitle?: string;\n}\n\nexport interface RuntimeHooks {\n auth?: {\n getAuth(): object;\n isLoggedIn(): boolean;\n authenticate?(...args: unknown[]): unknown;\n logout?(...args: unknown[]): unknown;\n };\n fulfilStoryboard?: (storyboard: RuntimeStoryboard) => Promise<void>;\n validatePermissions?: typeof PermissionApi_validatePermissions;\n checkPermissions?: {\n checkPermissions(...actions: string[]): boolean;\n preCheckPermissions(storyboard: Storyboard): Promise<void> | undefined;\n preCheckPermissionsForBrickOrRoute(\n container: BrickConf | RouteConf,\n asyncComputeRealValue: (value: unknown) => Promise<unknown>\n ): Promise<void> | undefined;\n };\n checkInstalledApps?: {\n preCheckInstalledApps(\n storyboard: Storyboard,\n hasAppInBootstrap: (appId: string) => boolean\n ): void;\n waitForCheckingApps(appIds: string[]): Promise<void>;\n getCheckedApp(appId: string): AppForCheck | undefined;\n };\n flowApi?: {\n FLOW_API_PROVIDER: string;\n registerFlowApiProvider(): void;\n isFlowApiProvider(provider: string): boolean;\n getArgsOfFlowApi(\n provider: string,\n originalArgs: unknown[],\n method?: string\n ): Promise<unknown[]>;\n collectContract(contracts: Contract[] | undefined): void;\n collectWidgetContract(contracts: Contract[] | undefined): void;\n clearCollectWidgetContract(): void;\n };\n menu?: {\n getMenuById(menuId: string): unknown;\n fetchMenuById(\n menuId: string,\n runtimeContext: RuntimeContext,\n runtimeHelpers: RuntimeHooksMenuHelpers\n ): Promise<unknown>;\n };\n images?: {\n imagesFactory(\n appId: string,\n isBuildPush?: boolean,\n version?: string\n ): ImagesFactory;\n widgetImagesFactory(\n widgetId: string,\n widgetVersion?: string\n ): ImagesFactory;\n };\n messageDispatcher?: {\n subscribe(...args: unknown[]): Promise<unknown>;\n unsubscribe(...args: unknown[]): Promise<unknown>;\n onMessage(channel: string, listener: (data: unknown) => void): void;\n onClose(listener: () => void): void;\n reset(): void;\n };\n pageView?: {\n create(): (info: PageViewInfo) => void;\n };\n}\n\nexport interface RuntimeHooksMenuHelpers {\n getStoryboardByAppId(appId: string): Storyboard | undefined;\n resolveData(\n resolveConf: ResolveConf,\n runtimeContext: RuntimeContext\n ): Promise<unknown>;\n asyncComputeRealValue(\n value: unknown,\n runtimeContext: RuntimeContext,\n options?: { ignoreSymbols?: boolean; noInject?: boolean }\n ): Promise<unknown>;\n}\n\nexport let hooks: RuntimeHooks | undefined;\n\nexport function createRuntime(options?: RuntimeOptions) {\n if (runtime) {\n throw new Error(\"Cannot create multiple runtimes\");\n }\n listenDevtoolsEagerly();\n hooks = options?.hooks;\n initializeI18n(NS, locales);\n moment.locale(i18n.language);\n i18n.on(\"languageChanged\", () => {\n moment.locale(i18n.language);\n });\n createHistory();\n runtime = new Runtime();\n return runtime;\n}\n\nfunction getRuntimeV3() {\n return runtime;\n}\n\n// istanbul ignore next\nfunction getRuntimeV2Factory() {\n const v2Kit = getV2RuntimeFromDll();\n if (v2Kit) {\n return function getRuntimeV2() {\n return new Proxy(v2Kit.getRuntime(), {\n get(...args) {\n const key = args[1];\n switch (key) {\n case \"getCurrentApp\":\n case \"hasInstalledApp\":\n case \"getDesktops\":\n case \"getLaunchpadSettings\":\n case \"getLaunchpadSiteMap\":\n case \"toggleLaunchpadEffect\":\n case \"applyPageTitle\":\n case \"getNavConfig\":\n case \"getFeatureFlags\":\n case \"getMiscSettings\":\n case \"getBrandSettings\":\n return Reflect.get(...args);\n }\n },\n }) as unknown as Runtime;\n };\n }\n}\n\n// istanbul ignore next\nexport const getRuntime = getRuntimeV2Factory() || getRuntimeV3;\n\nexport class Runtime {\n #initialized = false;\n #bootstrapped = false;\n\n initialize(data: BootstrapData) {\n if (this.#initialized) {\n throw new Error(\"The runtime cannot be initialized more than once\");\n }\n this.#initialized = true;\n normalizeBootstrapData(data);\n bootstrapData = data;\n const { notification, dialog } = (data.settings?.presetBricks ?? {}) as {\n notification?: string | false;\n dialog?: string | false;\n };\n if (notification !== false) {\n loadNotificationService(\n notification ?? \"basic.show-notification\",\n this.loadBricks\n );\n }\n if (dialog !== false) {\n loadDialogService(dialog ?? \"basic.show-dialog\", this.loadBricks);\n }\n }\n\n async bootstrap(data?: BootstrapData) {\n if (data) {\n this.initialize(data);\n }\n if (this.#bootstrapped) {\n throw new Error(\"The runtime cannot be bootstrapped more than once\");\n }\n this.#bootstrapped = true;\n router = new Router(bootstrapData!.storyboards!);\n await router.bootstrap();\n }\n\n getRecentApps() {\n return router?.getRecentApps() ?? {};\n }\n\n getCurrentApp() {\n return router?.getRecentApps().currentApp;\n }\n\n hasInstalledApp(appId: string, matchVersion?: string): boolean {\n return hasInstalledApp(appId, matchVersion);\n }\n\n getFeatureFlags(): FeatureFlags {\n return {\n ...bootstrapData?.settings?.featureFlags,\n ...(\n router?.getRecentApps().currentApp?.config\n ?.settings as BootstrapSettings\n )?.featureFlags,\n \"migrate-to-brick-next-v3\": true,\n };\n }\n\n getMiscSettings() {\n return {\n ...bootstrapData?.settings?.misc,\n ...(\n router?.getRecentApps().currentApp?.config\n ?.settings as BootstrapSettings\n )?.misc,\n };\n }\n\n getBrandSettings(): Record<string, string> {\n return {\n base_title: \"DevOps 管理专家\",\n ...(bootstrapData?.settings?.brand as Record<string, string>),\n };\n }\n\n getLaunchpadSettings() {\n return {\n columns: 7,\n rows: 4,\n ...bootstrapData?.settings?.launchpad,\n };\n }\n\n getDesktops(): unknown[] {\n return bootstrapData?.desktops ?? [];\n }\n\n getLaunchpadSiteMap(): unknown[] {\n return bootstrapData?.siteSort ?? [];\n }\n\n toggleLaunchpadEffect(open: boolean): void {\n document.body.classList.toggle(\"launchpad-open\", open);\n }\n\n applyPageTitle(pageTitle: string): void {\n const baseTitle = this.getBrandSettings().base_title;\n document.title = pageTitle ? `${pageTitle} - ${baseTitle}` : baseTitle;\n }\n\n getNavConfig() {\n return router?.getNavConfig();\n }\n\n loadBricks(bricks: string[] | Set<string>) {\n return loadBricksImperatively(bricks, getBrickPackages());\n }\n}\n\nfunction normalizeBootstrapData(data: BootstrapData) {\n if (Array.isArray(data.storyboards)) {\n for (const { app } of data.storyboards) {\n if (app.locales) {\n // Prefix to avoid conflict between brick package's i18n namespace.\n const ns = `tmp/${app.id}`;\n // Support any languages in `app.locales`.\n Object.entries(app.locales).forEach(([lang, resources]) => {\n i18n.addResourceBundle(lang, ns, resources);\n });\n // Use `app.name` as the fallback `app.localeName`.\n app.localeName = i18n.getFixedT(null, ns)(\"name\", app.name) as string;\n // Remove the temporary i18n resource bundles.\n Object.keys(app.locales).forEach((lang) => {\n i18n.removeResourceBundle(lang, ns);\n });\n } else {\n app.localeName = app.name;\n }\n }\n }\n if (isObject(data.settings)) {\n deepFreeze(data.settings);\n }\n if (data.brickPackages) {\n deepFreeze(data.brickPackages);\n }\n}\n\nexport function getBrickPackages() {\n return (\n bootstrapData?.brickPackages ??\n injectedBrickPackages ??\n (window.STANDALONE_BRICK_PACKAGES as BrickPackage[]) ??\n []\n );\n}\n\nexport function _internalApiGetRenderId(): string | undefined {\n return router?.getRenderId();\n}\n\nexport function _internalApiMatchStoryboard(\n pathname: string\n): RuntimeStoryboard | undefined {\n return matchStoryboard(bootstrapData?.storyboards ?? [], pathname);\n}\n\nexport function _internalApiGetRuntimeContext() {\n return router?.getRuntimeContext();\n}\n\nexport function _internalApiGetStoryboardInBootstrapData(appId: string) {\n return bootstrapData?.storyboards?.find(\n (storyboard) => storyboard.app.id === appId\n );\n}\n\nexport function _internalApiGetAppInBootstrapData(appId: string) {\n return _internalApiGetStoryboardInBootstrapData(appId)?.app;\n}\n\nexport let _test_only_setBootstrapData: (data: BootstrapData) => void;\n\n// istanbul ignore next\nif (process.env.NODE_ENV === \"test\") {\n _test_only_setBootstrapData = (data) => {\n bootstrapData = data as BootstrapData;\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAYA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACAA,OAAA;AACA,IAAAK,QAAA,GAAAL,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O,CAACC,GAAG,CAACC,QAAQ,KAAK,MAAM,EAAE;EACnC3I,OAAA,CAAAwI,2BAAA,GAAAA,2BAA2B,GAAI3G,IAAI,IAAK;IACtChC,aAAa,GAAGgC,IAAqB;EACvC,CAAC;AACH"}
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.registerWidgetFunctions = registerWidgetFunctions;
7
- exports.widgetFunctions = void 0;
6
+ exports.widgetFunctions = exports.registerWidgetFunctions = void 0;
8
7
  var _StoryboardFunctionRegistry = require("../../StoryboardFunctionRegistry.js");
8
+ var _getV2RuntimeFromDll = require("../../getV2RuntimeFromDll.js");
9
9
  const widgetFunctionRegistry = new Map();
10
10
  const widgetFunctions = new Proxy(Object.freeze({}), {
11
11
  get(target, key) {
@@ -13,7 +13,7 @@ const widgetFunctions = new Proxy(Object.freeze({}), {
13
13
  }
14
14
  });
15
15
  exports.widgetFunctions = widgetFunctions;
16
- function registerWidgetFunctions(widgetId, functions, widgetVersion) {
16
+ function registerWidgetFunctionsV3(widgetId, functions, widgetVersion) {
17
17
  if (widgetFunctionRegistry.has(widgetId)) {
18
18
  // eslint-disable-next-line no-console
19
19
  throw new Error(`Widget functions of "${widgetId}" already registered`);
@@ -28,4 +28,18 @@ function registerWidgetFunctions(widgetId, functions, widgetVersion) {
28
28
  widgetFunctionRegistry.set(widgetId, storyboardFunctions);
29
29
  registerStoryboardFunctions(functions);
30
30
  }
31
+
32
+ // istanbul ignore next
33
+ function registerWidgetFunctionsV2Factory() {
34
+ const v2Kit = (0, _getV2RuntimeFromDll.getV2RuntimeFromDll)();
35
+ if (v2Kit) {
36
+ return function (widgetId, functions, widgetVersion) {
37
+ return v2Kit.getRuntime().registerWidgetFunctions(widgetId, functions, widgetVersion);
38
+ };
39
+ }
40
+ }
41
+
42
+ // istanbul ignore next
43
+ const registerWidgetFunctions = registerWidgetFunctionsV2Factory() || registerWidgetFunctionsV3;
44
+ exports.registerWidgetFunctions = registerWidgetFunctions;
31
45
  //# sourceMappingURL=WidgetFunctions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"WidgetFunctions.js","names":["_StoryboardFunctionRegistry","require","widgetFunctionRegistry","Map","widgetFunctions","Proxy","Object","freeze","get","target","key","exports","registerWidgetFunctions","widgetId","functions","widgetVersion","has","Error","storyboardFunctions","registerStoryboardFunctions","StoryboardFunctionRegistryFactory","set"],"sources":["../../../../src/internal/compute/WidgetFunctions.ts"],"sourcesContent":["import { StoryboardFunction } from \"@next-core/types\";\nimport {\n ReadonlyStoryboardFunctions,\n StoryboardFunctionRegistryFactory,\n} from \"../../StoryboardFunctionRegistry.js\";\n\nconst widgetFunctionRegistry = new Map<string, ReadonlyStoryboardFunctions>();\n\nexport const widgetFunctions = new Proxy(Object.freeze({}), {\n get(target, key: string) {\n return widgetFunctionRegistry.get(key);\n },\n}) as Readonly<Record<string, ReadonlyStoryboardFunctions>>;\n\nexport function registerWidgetFunctions(\n widgetId: string,\n functions: StoryboardFunction[],\n widgetVersion?: string\n): void {\n if (widgetFunctionRegistry.has(widgetId)) {\n // eslint-disable-next-line no-console\n throw new Error(`Widget functions of \"${widgetId}\" already registered`);\n }\n const { storyboardFunctions, registerStoryboardFunctions } =\n StoryboardFunctionRegistryFactory({ widgetId, widgetVersion });\n widgetFunctionRegistry.set(widgetId, storyboardFunctions);\n registerStoryboardFunctions(functions);\n}\n"],"mappings":";;;;;;;AACA,IAAAA,2BAAA,GAAAC,OAAA;AAKA,MAAMC,sBAAsB,GAAG,IAAIC,GAAG,CAAsC,CAAC;AAEtE,MAAMC,eAAe,GAAG,IAAIC,KAAK,CAACC,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE;EAC1DC,GAAGA,CAACC,MAAM,EAAEC,GAAW,EAAE;IACvB,OAAOR,sBAAsB,CAACM,GAAG,CAACE,GAAG,CAAC;EACxC;AACF,CAAC,CAA0D;AAACC,OAAA,CAAAP,eAAA,GAAAA,eAAA;AAErD,SAASQ,uBAAuBA,CACrCC,QAAgB,EAChBC,SAA+B,EAC/BC,aAAsB,EAChB;EACN,IAAIb,sBAAsB,CAACc,GAAG,CAACH,QAAQ,CAAC,EAAE;IACxC;IACA,MAAM,IAAII,KAAK,CAAE,wBAAuBJ,QAAS,sBAAqB,CAAC;EACzE;EACA,MAAM;IAAEK,mBAAmB;IAAEC;EAA4B,CAAC,GACxD,IAAAC,6DAAiC,EAAC;IAAEP,QAAQ;IAAEE;EAAc,CAAC,CAAC;EAChEb,sBAAsB,CAACmB,GAAG,CAACR,QAAQ,EAAEK,mBAAmB,CAAC;EACzDC,2BAA2B,CAACL,SAAS,CAAC;AACxC"}
1
+ {"version":3,"file":"WidgetFunctions.js","names":["_StoryboardFunctionRegistry","require","_getV2RuntimeFromDll","widgetFunctionRegistry","Map","widgetFunctions","Proxy","Object","freeze","get","target","key","exports","registerWidgetFunctionsV3","widgetId","functions","widgetVersion","has","Error","storyboardFunctions","registerStoryboardFunctions","StoryboardFunctionRegistryFactory","set","registerWidgetFunctionsV2Factory","v2Kit","getV2RuntimeFromDll","getRuntime","registerWidgetFunctions"],"sources":["../../../../src/internal/compute/WidgetFunctions.ts"],"sourcesContent":["import { StoryboardFunction } from \"@next-core/types\";\nimport {\n ReadonlyStoryboardFunctions,\n StoryboardFunctionRegistryFactory,\n} from \"../../StoryboardFunctionRegistry.js\";\nimport { getV2RuntimeFromDll } from \"../../getV2RuntimeFromDll.js\";\n\nconst widgetFunctionRegistry = new Map<string, ReadonlyStoryboardFunctions>();\n\nexport const widgetFunctions = new Proxy(Object.freeze({}), {\n get(target, key: string) {\n return widgetFunctionRegistry.get(key);\n },\n}) as Readonly<Record<string, ReadonlyStoryboardFunctions>>;\n\nfunction registerWidgetFunctionsV3(\n widgetId: string,\n functions: StoryboardFunction[],\n widgetVersion?: string\n): void {\n if (widgetFunctionRegistry.has(widgetId)) {\n // eslint-disable-next-line no-console\n throw new Error(`Widget functions of \"${widgetId}\" already registered`);\n }\n const { storyboardFunctions, registerStoryboardFunctions } =\n StoryboardFunctionRegistryFactory({ widgetId, widgetVersion });\n widgetFunctionRegistry.set(widgetId, storyboardFunctions);\n registerStoryboardFunctions(functions);\n}\n\n// istanbul ignore next\nfunction registerWidgetFunctionsV2Factory() {\n const v2Kit = getV2RuntimeFromDll();\n if (v2Kit) {\n return function (\n widgetId: string,\n functions: StoryboardFunction[],\n widgetVersion?: string\n ) {\n return v2Kit\n .getRuntime()\n .registerWidgetFunctions(widgetId, functions, widgetVersion);\n };\n }\n}\n\n// istanbul ignore next\nexport const registerWidgetFunctions =\n registerWidgetFunctionsV2Factory() || registerWidgetFunctionsV3;\n"],"mappings":";;;;;;AACA,IAAAA,2BAAA,GAAAC,OAAA;AAIA,IAAAC,oBAAA,GAAAD,OAAA;AAEA,MAAME,sBAAsB,GAAG,IAAIC,GAAG,CAAsC,CAAC;AAEtE,MAAMC,eAAe,GAAG,IAAIC,KAAK,CAACC,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE;EAC1DC,GAAGA,CAACC,MAAM,EAAEC,GAAW,EAAE;IACvB,OAAOR,sBAAsB,CAACM,GAAG,CAACE,GAAG,CAAC;EACxC;AACF,CAAC,CAA0D;AAACC,OAAA,CAAAP,eAAA,GAAAA,eAAA;AAE5D,SAASQ,yBAAyBA,CAChCC,QAAgB,EAChBC,SAA+B,EAC/BC,aAAsB,EAChB;EACN,IAAIb,sBAAsB,CAACc,GAAG,CAACH,QAAQ,CAAC,EAAE;IACxC;IACA,MAAM,IAAII,KAAK,CAAE,wBAAuBJ,QAAS,sBAAqB,CAAC;EACzE;EACA,MAAM;IAAEK,mBAAmB;IAAEC;EAA4B,CAAC,GACxD,IAAAC,6DAAiC,EAAC;IAAEP,QAAQ;IAAEE;EAAc,CAAC,CAAC;EAChEb,sBAAsB,CAACmB,GAAG,CAACR,QAAQ,EAAEK,mBAAmB,CAAC;EACzDC,2BAA2B,CAACL,SAAS,CAAC;AACxC;;AAEA;AACA,SAASQ,gCAAgCA,CAAA,EAAG;EAC1C,MAAMC,KAAK,GAAG,IAAAC,wCAAmB,EAAC,CAAC;EACnC,IAAID,KAAK,EAAE;IACT,OAAO,UACLV,QAAgB,EAChBC,SAA+B,EAC/BC,aAAsB,EACtB;MACA,OAAOQ,KAAK,CACTE,UAAU,CAAC,CAAC,CACZC,uBAAuB,CAACb,QAAQ,EAAEC,SAAS,EAAEC,aAAa,CAAC;IAChE,CAAC;EACH;AACF;;AAEA;AACO,MAAMW,uBAAuB,GAClCJ,gCAAgC,CAAC,CAAC,IAAIV,yBAAyB;AAACD,OAAA,CAAAe,uBAAA,GAAAA,uBAAA"}
@@ -3,13 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.registerWidgetI18n = registerWidgetI18n;
6
+ exports.registerWidgetI18n = void 0;
7
7
  exports.widgetI18nFactory = widgetI18nFactory;
8
8
  var _i18n = require("@next-core/i18n");
9
9
  var _registerAppI18n = require("../registerAppI18n.js");
10
- // import i18next, { getFixedT, TFunction } from "i18next";
11
-
12
- function registerWidgetI18n(widgetId, i18nData) {
10
+ var _getV2RuntimeFromDll = require("../../getV2RuntimeFromDll.js");
11
+ function registerWidgetI18nV3(widgetId, i18nData) {
13
12
  const ns = (0, _registerAppI18n.getI18nNamespace)("widget", widgetId);
14
13
  Object.entries(i18nData).forEach(([lang, resources]) => {
15
14
  _i18n.i18n.addResourceBundle(lang, ns, resources);
@@ -18,4 +17,18 @@ function registerWidgetI18n(widgetId, i18nData) {
18
17
  function widgetI18nFactory(widgetId) {
19
18
  return _i18n.i18n.getFixedT(null, (0, _registerAppI18n.getI18nNamespace)("widget", widgetId));
20
19
  }
20
+
21
+ // istanbul ignore next
22
+ function registerWidgetI18nV2Factory() {
23
+ const v2Kit = (0, _getV2RuntimeFromDll.getV2RuntimeFromDll)();
24
+ if (v2Kit) {
25
+ return function (widgetId, i18nData) {
26
+ return v2Kit.getRuntime().registerWidgetI18n(widgetId, i18nData);
27
+ };
28
+ }
29
+ }
30
+
31
+ // istanbul ignore next
32
+ const registerWidgetI18n = registerWidgetI18nV2Factory() || registerWidgetI18nV3;
33
+ exports.registerWidgetI18n = registerWidgetI18n;
21
34
  //# sourceMappingURL=WidgetI18n.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"WidgetI18n.js","names":["_i18n","require","_registerAppI18n","registerWidgetI18n","widgetId","i18nData","ns","getI18nNamespace","Object","entries","forEach","lang","resources","i18n","addResourceBundle","widgetI18nFactory","getFixedT"],"sources":["../../../../src/internal/compute/WidgetI18n.ts"],"sourcesContent":["// import i18next, { getFixedT, TFunction } from \"i18next\";\nimport { i18n } from \"@next-core/i18n\";\nimport type { MetaI18n } from \"@next-core/types\";\nimport { getI18nNamespace } from \"../registerAppI18n.js\";\n\nexport function registerWidgetI18n(widgetId: string, i18nData: MetaI18n): void {\n const ns = getI18nNamespace(\"widget\", widgetId);\n Object.entries(i18nData).forEach(([lang, resources]) => {\n i18n.addResourceBundle(lang, ns, resources);\n });\n}\n\nexport function widgetI18nFactory(widgetId: string) {\n return i18n.getFixedT(null, getI18nNamespace(\"widget\", widgetId));\n}\n"],"mappings":";;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,gBAAA,GAAAD,OAAA;AAHA;;AAKO,SAASE,kBAAkBA,CAACC,QAAgB,EAAEC,QAAkB,EAAQ;EAC7E,MAAMC,EAAE,GAAG,IAAAC,iCAAgB,EAAC,QAAQ,EAAEH,QAAQ,CAAC;EAC/CI,MAAM,CAACC,OAAO,CAACJ,QAAQ,CAAC,CAACK,OAAO,CAAC,CAAC,CAACC,IAAI,EAAEC,SAAS,CAAC,KAAK;IACtDC,UAAI,CAACC,iBAAiB,CAACH,IAAI,EAAEL,EAAE,EAAEM,SAAS,CAAC;EAC7C,CAAC,CAAC;AACJ;AAEO,SAASG,iBAAiBA,CAACX,QAAgB,EAAE;EAClD,OAAOS,UAAI,CAACG,SAAS,CAAC,IAAI,EAAE,IAAAT,iCAAgB,EAAC,QAAQ,EAAEH,QAAQ,CAAC,CAAC;AACnE"}
1
+ {"version":3,"file":"WidgetI18n.js","names":["_i18n","require","_registerAppI18n","_getV2RuntimeFromDll","registerWidgetI18nV3","widgetId","i18nData","ns","getI18nNamespace","Object","entries","forEach","lang","resources","i18n","addResourceBundle","widgetI18nFactory","getFixedT","registerWidgetI18nV2Factory","v2Kit","getV2RuntimeFromDll","getRuntime","registerWidgetI18n","exports"],"sources":["../../../../src/internal/compute/WidgetI18n.ts"],"sourcesContent":["import { i18n } from \"@next-core/i18n\";\nimport type { MetaI18n } from \"@next-core/types\";\nimport { getI18nNamespace } from \"../registerAppI18n.js\";\nimport { getV2RuntimeFromDll } from \"../../getV2RuntimeFromDll.js\";\n\nfunction registerWidgetI18nV3(widgetId: string, i18nData: MetaI18n): void {\n const ns = getI18nNamespace(\"widget\", widgetId);\n Object.entries(i18nData).forEach(([lang, resources]) => {\n i18n.addResourceBundle(lang, ns, resources);\n });\n}\n\nexport function widgetI18nFactory(widgetId: string) {\n return i18n.getFixedT(null, getI18nNamespace(\"widget\", widgetId));\n}\n\n// istanbul ignore next\nfunction registerWidgetI18nV2Factory() {\n const v2Kit = getV2RuntimeFromDll();\n if (v2Kit) {\n return function (widgetId: string, i18nData: MetaI18n) {\n return v2Kit.getRuntime().registerWidgetI18n(widgetId, i18nData);\n };\n }\n}\n\n// istanbul ignore next\nexport const registerWidgetI18n =\n registerWidgetI18nV2Factory() || registerWidgetI18nV3;\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,oBAAA,GAAAF,OAAA;AAEA,SAASG,oBAAoBA,CAACC,QAAgB,EAAEC,QAAkB,EAAQ;EACxE,MAAMC,EAAE,GAAG,IAAAC,iCAAgB,EAAC,QAAQ,EAAEH,QAAQ,CAAC;EAC/CI,MAAM,CAACC,OAAO,CAACJ,QAAQ,CAAC,CAACK,OAAO,CAAC,CAAC,CAACC,IAAI,EAAEC,SAAS,CAAC,KAAK;IACtDC,UAAI,CAACC,iBAAiB,CAACH,IAAI,EAAEL,EAAE,EAAEM,SAAS,CAAC;EAC7C,CAAC,CAAC;AACJ;AAEO,SAASG,iBAAiBA,CAACX,QAAgB,EAAE;EAClD,OAAOS,UAAI,CAACG,SAAS,CAAC,IAAI,EAAE,IAAAT,iCAAgB,EAAC,QAAQ,EAAEH,QAAQ,CAAC,CAAC;AACnE;;AAEA;AACA,SAASa,2BAA2BA,CAAA,EAAG;EACrC,MAAMC,KAAK,GAAG,IAAAC,wCAAmB,EAAC,CAAC;EACnC,IAAID,KAAK,EAAE;IACT,OAAO,UAAUd,QAAgB,EAAEC,QAAkB,EAAE;MACrD,OAAOa,KAAK,CAACE,UAAU,CAAC,CAAC,CAACC,kBAAkB,CAACjB,QAAQ,EAAEC,QAAQ,CAAC;IAClE,CAAC;EACH;AACF;;AAEA;AACO,MAAMgB,kBAAkB,GAC7BJ,2BAA2B,CAAC,CAAC,IAAId,oBAAoB;AAACmB,OAAA,CAAAD,kBAAA,GAAAA,kBAAA"}