Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
package.dist.prod.asset-registries.Illustrations.js.map Maven / Gradle / Ivy
{
"version": 3,
"sources": ["../../../src/asset-registries/Illustrations.ts"],
"sourcesContent": ["import getSharedResource from \"../getSharedResource.js\";\nimport type { I18nText } from \"../i18nBundle.js\";\nimport { getTheme } from \"../config/Theme.js\";\n\ntype IllustrationLoader = (illustrationName: string) => Promise;\n\ntype IllustrationProperties = {\n\tdialogSvg: string,\n\tsceneSvg: string,\n\tspotSvg: string,\n\tdotSvg: string,\n\ttitle: I18nText,\n\tsubtitle: I18nText,\n};\n\ntype IllustrationData = IllustrationProperties & {\n\tset: string,\n\tcollection: string,\n};\n\nconst IllustrationCollections = new Map([\n\t[\"sap_horizon\", \"V5\"],\n\t[\"sap_horizon_dark\", \"V5\"],\n\t[\"sap_horizon_hcb\", \"V5/HC\"],\n\t[\"sap_horizon_hcw\", \"V5/HC\"],\n]);\n\nconst FALLBACK_COLLECTION = \"V4\";\n\nconst loaders = new Map();\nconst registry = getSharedResource>(\"SVGIllustration.registry\", new Map());\nconst illustrationPromises = getSharedResource>>(\"SVGIllustration.promises\", new Map());\n\nconst getCollection = () => {\n\tconst theme = getTheme();\n\n\tif (IllustrationCollections.has(theme)) {\n\t\treturn IllustrationCollections.get(theme);\n\t}\n\n\treturn FALLBACK_COLLECTION;\n};\n\n/**\n * Processes the name of the illustration\n * The name is used to generate the registry key and the loader key\n * The registry key is used to store and get the illustration data from the registry\n * The loader key is used to store and get the illustration loader from the loaders map\n * The function generates the correct registry key and loader key based on whether an loader exists for the illustration\n * If there is no loader registered for the collection, it falls back to the default collection\n */\nconst processName = (name: string) => {\n\tlet collection = getCollection();\n\tconst [set, illustrationName] = name.split(\"/\");\n\tlet registryKey = `${set}/${collection}/${illustrationName}`;\n\n\tif (!loaders.has(registryKey) && collection !== FALLBACK_COLLECTION) {\n\t\tcollection = FALLBACK_COLLECTION;\n\t\tregistryKey = `${set}/${collection}/${illustrationName}`;\n\t}\n\n\treturn {\n\t\tregistryKey,\n\t\tcollection,\n\t};\n};\n\nconst registerIllustration = (name: string, data: IllustrationData) => {\n\tconst collection = data.collection || FALLBACK_COLLECTION;\n\tregistry.set(`${data.set}/${collection}/${name}`, {\n\t\tdialogSvg: data.dialogSvg,\n\t\tsceneSvg: data.sceneSvg,\n\t\tspotSvg: data.spotSvg,\n\t\tdotSvg: data.dotSvg,\n\t\ttitle: data.title,\n\t\tsubtitle: data.subtitle,\n\t});\n};\n\nconst registerIllustrationLoader = (illustrationName: string, loader: IllustrationLoader) => {\n\tloaders.set(illustrationName, loader);\n};\n\nconst _loadIllustrationOnce = (illustrationName: string) => {\n\tconst { registryKey } = processName(illustrationName);\n\tif (!illustrationPromises.has(registryKey)) {\n\t\tif (!loaders.has(registryKey)) {\n\t\t\tconst illustrationPath = illustrationName.startsWith(\"fiori/\") ? illustrationName.replace(\"fiori/\", \"\") : illustrationName;\n\t\t\tthrow new Error(`No loader registered for the ${illustrationName} illustration. Probably you forgot to import the \"@ui5/webcomponents-fiori/dist/illustrations/${illustrationPath}.js\" module. Or you can import the \"@ui5/webcomponents-fiori/dist/illustrations/AllIllustrations.js\" module that will make all illustrations available, but fetch only the ones used.`);\n\t\t}\n\n\t\tconst loadIllustrations = loaders.get(registryKey)!;\n\t\tillustrationPromises.set(registryKey, loadIllustrations(registryKey));\n\t}\n\treturn illustrationPromises.get(registryKey);\n};\n\nconst getIllustrationDataSync = (illustrationName: string) => {\n\tconst { registryKey } = processName(illustrationName);\n\treturn registry.get(registryKey);\n};\n\nconst getIllustrationData = async (illustrationName: string) => {\n\tconst { registryKey } = processName(illustrationName);\n\n\tawait _loadIllustrationOnce(illustrationName);\n\treturn registry.get(registryKey);\n};\n\nexport {\n\tgetIllustrationDataSync,\n\tregisterIllustration,\n\tregisterIllustrationLoader,\n\tgetIllustrationData,\n};\n"],
"mappings": "aAAA,OAAOA,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AG,CAC3C,GAAI,CAACV,EAAQ,IAAIU,CAAW,EAAG,CAC9B,MAAMM,EAAmBP,EAAiB,WAAW,QAAQ,EAAIA,EAAiB,QAAQ,SAAU,EAAE,EAAIA,EAC1G,MAAM,IAAI,MAAM,gCAAgCA,CAAgB,iGAAiGO,CAAgB,uLAAuL,CACzW,CAEA,MAAMC,EAAoBjB,EAAQ,IAAIU,CAAW,EACjDR,EAAqB,IAAIQ,EAAaO,EAAkBP,CAAW,CAAC,CACrE,CACA,OAAOR,EAAqB,IAAIQ,CAAW,CAC5C,EAEMQ,EAA2BT,GAA6B,CAC7D,KAAM,CAAE,YAAAC,CAAY,EAAIL,EAAYI,CAAgB,EACpD,OAAOR,EAAS,IAAIS,CAAW,CAChC,EAEMS,EAAsB,MAAOV,GAA6B,CAC/D,KAAM,CAAE,YAAAC,CAAY,EAAIL,EAAYI,CAAgB,EAEpD,aAAMM,EAAsBN,CAAgB,EACrCR,EAAS,IAAIS,CAAW,CAChC,EAEA,OACCQ,KAAA,wBACAP,KAAA,qBACAE,KAAA,2BACAM,KAAA",
"names": ["getSharedResource", "getTheme", "IllustrationCollections", "FALLBACK_COLLECTION", "loaders", "registry", "illustrationPromises", "getCollection", "theme", "processName", "name", "collection", "set", "illustrationName", "registryKey", "registerIllustration", "data", "registerIllustrationLoader", "loader", "_loadIllustrationOnce", "illustrationPath", "loadIllustrations", "getIllustrationDataSync", "getIllustrationData"]
}