@cratis/scene.engine 3.2.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/cjs/PackageSelection.js.map +1 -1
  2. package/dist/cjs/aggregateContributions.js.map +1 -1
  3. package/dist/cjs/buildStarterProfile.js.map +1 -1
  4. package/dist/cjs/computeSizeClass.js.map +1 -1
  5. package/dist/cjs/elementKind.js.map +1 -1
  6. package/dist/cjs/evaluateFlowArrangement.js.map +1 -1
  7. package/dist/cjs/evaluateFreeformArrangement.js.map +1 -1
  8. package/dist/cjs/evaluateFreeformSlotArrangement.js.map +1 -1
  9. package/dist/cjs/flowNodeKind.js.map +1 -1
  10. package/dist/cjs/incompatibleStarterThemes.js.map +1 -1
  11. package/dist/cjs/packageCatalog.js.map +1 -1
  12. package/dist/cjs/packageVersionRange.js.map +1 -1
  13. package/dist/cjs/panelKind.js.map +1 -1
  14. package/dist/cjs/renderElement.js.map +1 -1
  15. package/dist/cjs/resolveComponentName.js.map +1 -1
  16. package/dist/cjs/resolvePackageDependencies.js.map +1 -1
  17. package/dist/cjs/resolveScreenTemplates.js.map +1 -1
  18. package/dist/cjs/themeCompatibility.js.map +1 -1
  19. package/dist/esm/PackageSelection.js.map +1 -1
  20. package/dist/esm/aggregateContributions.js.map +1 -1
  21. package/dist/esm/buildStarterProfile.js.map +1 -1
  22. package/dist/esm/computeSizeClass.js.map +1 -1
  23. package/dist/esm/elementKind.js.map +1 -1
  24. package/dist/esm/evaluateFlowArrangement.js.map +1 -1
  25. package/dist/esm/evaluateFreeformArrangement.js.map +1 -1
  26. package/dist/esm/evaluateFreeformSlotArrangement.js.map +1 -1
  27. package/dist/esm/flowNodeKind.js.map +1 -1
  28. package/dist/esm/incompatibleStarterThemes.js.map +1 -1
  29. package/dist/esm/packageCatalog.js.map +1 -1
  30. package/dist/esm/packageVersionRange.js.map +1 -1
  31. package/dist/esm/panelKind.js.map +1 -1
  32. package/dist/esm/renderElement.js.map +1 -1
  33. package/dist/esm/resolveComponentName.js.map +1 -1
  34. package/dist/esm/resolvePackageDependencies.js.map +1 -1
  35. package/dist/esm/resolveScreenTemplates.js.map +1 -1
  36. package/dist/esm/themeCompatibility.js.map +1 -1
  37. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  38. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"incompatibleStarterThemes.js","sources":["../../incompatibleStarterThemes.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Theme, UiProfile, UiStarter } from '@cratis/scene.model';\nimport { incompatiblePackages } from './themeCompatibility';\n\n/**\n * Finds the {@link UiStarter.themes} that are not compatible with the starter's own {@link UiStarter.packages} -\n * part of Cratis/Scene#6. A starter is versioned per package combination it targets, so a theme it ships\n * as a choice that turns out incompatible with the starter's own packages is exactly the gap\n * `themeCompatibility` already surfaces for a {@link UiProfile}; this reuses that rule rather than\n * reimplementing it for starters.\n *\n * @param starter The {@link UiStarter} to check.\n * @param themes Every known {@link Theme}, keyed by name.\n * @returns The names in `starter.themes` that are either unknown to `themes` or incompatible with `starter.packages`.\n */\nexport function incompatibleStarterThemes(starter: UiStarter, themes: Record<string, Theme>): string[] {\n const profile: UiProfile = { name: starter.name, targetPlatform: '', packages: starter.packages };\n return starter.themes.filter(name => {\n const theme = themes[name];\n return !theme || incompatiblePackages(theme, profile).length > 0;\n });\n}\n"],"names":["incompatibleStarterThemes","starter","themes","profile","name","packages","filter","theme","incompatiblePackages","length"],"mappings":";;AAAA;AACA;AAKA;;;;;;;;;;AAUC,IACM,SAASA,yBAAAA,CAA0BC,OAAkB,EAAEC,MAA6B,EAAA;AACvF,IAAA,MAAMC,OAAAA,GAAqB;AAAEC,QAAAA,IAAAA,EAAMH,QAAQG,IAAI;QAAsBC,QAAAA,EAAUJ,QAAQI;AAAS,KAAA;AAChG,IAAA,OAAOJ,OAAAA,CAAQC,MAAM,CAACI,MAAM,CAACF,CAAAA,IAAAA,GAAAA;QACzB,MAAMG,KAAAA,GAAQL,MAAM,CAACE,IAAAA,CAAK;AAC1B,QAAA,OAAO,CAACG,KAAAA,IAASC,oBAAAA,CAAqBD,KAAAA,EAAOJ,OAAAA,CAAAA,CAASM,MAAM,GAAG,CAAA;AACnE,IAAA,CAAA,CAAA;AACJ;;;;"}
1
+ {"version":3,"file":"incompatibleStarterThemes.js","sources":["../../incompatibleStarterThemes.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Theme, UiProfile, UiStarter } from '@cratis/scene.model';\nimport { incompatiblePackages } from './themeCompatibility';\n\n/**\n * Finds the {@link UiStarter.themes} that are not compatible with the starter's own {@link UiStarter.packages} -\n * part of Cratis/Scene#6. A starter is versioned per package combination it targets, so a theme it ships\n * as a choice that turns out incompatible with the starter's own packages is exactly the gap\n * `themeCompatibility` already surfaces for a {@link UiProfile}; this reuses that rule rather than\n * reimplementing it for starters.\n *\n * @param starter The {@link UiStarter} to check.\n * @param themes Every known {@link Theme}, keyed by name.\n * @returns The names in `starter.themes` that are either unknown to `themes` or incompatible with `starter.packages`.\n */\nexport function incompatibleStarterThemes(starter: UiStarter, themes: Record<string, Theme>): string[] {\n const profile: UiProfile = { name: starter.name, targetPlatform: '', packages: starter.packages };\n return starter.themes.filter(name => {\n const theme = themes[name];\n return !theme || incompatiblePackages(theme, profile).length > 0;\n });\n}\n"],"names":["incompatibleStarterThemes","starter","themes","profile","name","packages","filter","theme","incompatiblePackages","length"],"mappings":";;AAAA;AACA;AAKA;;;;;;;;;;AAUC,IACM,SAASA,yBAAAA,CAA0BC,OAAkB,EAAEC,MAA6B,EAAA;AACvF,IAAA,MAAMC,OAAAA,GAAqB;AAAEC,QAAAA,IAAAA,EAAMH,QAAQG,IAAI;QAAsBC,QAAAA,EAAUJ,QAAQI;AAAS,KAAA;AAChG,IAAA,OAAOJ,OAAAA,CAAQC,MAAM,CAACI,MAAM,CAACF,CAAAA,IAAAA,GAAAA;QACzB,MAAMG,KAAAA,GAAQL,MAAM,CAACE,IAAAA,CAAK;AAC1B,QAAA,OAAO,CAACG,KAAAA,IAASC,oBAAAA,CAAqBD,KAAAA,EAAOJ,OAAAA,CAAAA,CAASM,MAAM,GAAG,CAAA;AACnE,IAAA,CAAA,CAAA;AACJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"packageCatalog.js","sources":["../../packageCatalog.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { PackageKind, ScenePackage } from '@cratis/scene.model';\n\n/**\n * The packages of a given kind.\n */\nexport function packagesOfKind(catalog: ScenePackage[], kind: PackageKind): ScenePackage[] {\n return catalog.filter((scenePackage) => scenePackage.kind === kind);\n}\n\n/**\n * The component libraries a profile can be founded on — the ones that do not themselves layer on another\n * component library.\n *\n * \"Base\" is not a declared property; it falls out of the dependency graph. PrimeReact depends on a\n * styling package but on no other component library, so it is a base. `@cratis/components` depends on\n * PrimeReact, so it is not — it is something you add on top of a base you already picked. Deriving it\n * this way means a third party shipping their own library gets classified correctly without having to\n * declare anything extra.\n */\nexport function baseComponentLibraries(catalog: ScenePackage[]): ScenePackage[] {\n const libraries = packagesOfKind(catalog, PackageKind.ComponentLibrary);\n const names = new Set(libraries.map((scenePackage) => scenePackage.name));\n return libraries.filter((scenePackage) => !scenePackage.dependencies.some((dependency) => names.has(dependency.name)));\n}\n\n/**\n * The packages that can be added to a selection without pulling anything else in — every dependency they\n * declare is already selected.\n *\n * This is the \"what else works with what I have picked\" list: choose PrimeReact and Tailwind, and\n * `@cratis/components` becomes available because both of its dependencies are now met. It is\n * deliberately stricter than {@link resolvePackageDependencies}, which will happily add the missing\n * dependencies for you — a picker wants to show what fits, not what would drag more in.\n */\nexport function availablePackagesFor(catalog: ScenePackage[], selected: string[]): ScenePackage[] {\n const chosen = new Set(selected);\n return catalog.filter(\n (scenePackage) => !chosen.has(scenePackage.name) && scenePackage.dependencies.every((dependency) => chosen.has(dependency.name))\n );\n}\n\n/**\n * Every component name the selected packages declare between them, without duplicates, sorted so a\n * component picker has a stable list to show.\n */\nexport function componentsForPackages(catalog: ScenePackage[], selected: string[]): string[] {\n const chosen = new Set(selected);\n const components = catalog.filter((scenePackage) => chosen.has(scenePackage.name)).flatMap((scenePackage) => scenePackage.components);\n return [...new Set(components)].sort();\n}\n\n/**\n * Builds the component-name catalog `resolveComponentName` resolves against.\n */\nexport function toComponentCatalog(catalog: ScenePackage[]): Record<string, string[]> {\n const components: Record<string, string[]> = {};\n for (const scenePackage of catalog) {\n components[scenePackage.name] = scenePackage.components;\n }\n\n return components;\n}\n"],"names":["packagesOfKind","catalog","kind","filter","scenePackage","baseComponentLibraries","libraries","PackageKind","ComponentLibrary","names","Set","map","name","dependencies","some","dependency","has","availablePackagesFor","selected","chosen","every","componentsForPackages","components","flatMap","sort","toComponentCatalog"],"mappings":";;AAAA;AACA;AAIA;;AAEC,IACM,SAASA,cAAAA,CAAeC,OAAuB,EAAEC,IAAiB,EAAA;AACrE,IAAA,OAAOD,QAAQE,MAAM,CAAC,CAACC,YAAAA,GAAiBA,YAAAA,CAAaF,IAAI,KAAKA,IAAAA,CAAAA;AAClE;AAEA;;;;;;;;;IAUO,SAASG,sBAAAA,CAAuBJ,OAAuB,EAAA;AAC1D,IAAA,MAAMK,SAAAA,GAAYN,cAAAA,CAAeC,OAAAA,EAASM,WAAAA,CAAYC,gBAAgB,CAAA;IACtE,MAAMC,KAAAA,GAAQ,IAAIC,GAAAA,CAAIJ,SAAAA,CAAUK,GAAG,CAAC,CAACP,YAAAA,GAAiBA,YAAAA,CAAaQ,IAAI,CAAA,CAAA;AACvE,IAAA,OAAON,UAAUH,MAAM,CAAC,CAACC,YAAAA,GAAiB,CAACA,YAAAA,CAAaS,YAAY,CAACC,IAAI,CAAC,CAACC,UAAAA,GAAeN,MAAMO,GAAG,CAACD,WAAWH,IAAI,CAAA,CAAA,CAAA;AACvH;AAEA;;;;;;;;AAQC,IACM,SAASK,oBAAAA,CAAqBhB,OAAuB,EAAEiB,QAAkB,EAAA;IAC5E,MAAMC,MAAAA,GAAS,IAAIT,GAAAA,CAAIQ,QAAAA,CAAAA;IACvB,OAAOjB,OAAAA,CAAQE,MAAM,CACjB,CAACC,eAAiB,CAACe,MAAAA,CAAOH,GAAG,CAACZ,YAAAA,CAAaQ,IAAI,KAAKR,YAAAA,CAAaS,YAAY,CAACO,KAAK,CAAC,CAACL,aAAeI,MAAAA,CAAOH,GAAG,CAACD,UAAAA,CAAWH,IAAI,CAAA,CAAA,CAAA;AAEtI;AAEA;;;AAGC,IACM,SAASS,qBAAAA,CAAsBpB,OAAuB,EAAEiB,QAAkB,EAAA;IAC7E,MAAMC,MAAAA,GAAS,IAAIT,GAAAA,CAAIQ,QAAAA,CAAAA;AACvB,IAAA,MAAMI,aAAarB,OAAAA,CAAQE,MAAM,CAAC,CAACC,eAAiBe,MAAAA,CAAOH,GAAG,CAACZ,YAAAA,CAAaQ,IAAI,CAAA,CAAA,CAAGW,OAAO,CAAC,CAACnB,YAAAA,GAAiBA,aAAakB,UAAU,CAAA;IACpI,OAAO;AAAI,QAAA,GAAA,IAAIZ,GAAAA,CAAIY,UAAAA;AAAY,KAAA,CAACE,IAAI,EAAA;AACxC;AAEA;;IAGO,SAASC,kBAAAA,CAAmBxB,OAAuB,EAAA;AACtD,IAAA,MAAMqB,aAAuC,EAAC;IAC9C,KAAK,MAAMlB,gBAAgBH,OAAAA,CAAS;AAChCqB,QAAAA,UAAU,CAAClB,YAAAA,CAAaQ,IAAI,CAAC,GAAGR,aAAakB,UAAU;AAC3D,IAAA;IAEA,OAAOA,UAAAA;AACX;;;;"}
1
+ {"version":3,"file":"packageCatalog.js","sources":["../../packageCatalog.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { PackageKind, ScenePackage } from '@cratis/scene.model';\n\n/**\n * The packages of a given kind.\n */\nexport function packagesOfKind(catalog: ScenePackage[], kind: PackageKind): ScenePackage[] {\n return catalog.filter((scenePackage) => scenePackage.kind === kind);\n}\n\n/**\n * The component libraries a profile can be founded on — the ones that do not themselves layer on another\n * component library.\n *\n * \"Base\" is not a declared property; it falls out of the dependency graph. PrimeReact depends on a\n * styling package but on no other component library, so it is a base. `@cratis/components` depends on\n * PrimeReact, so it is not — it is something you add on top of a base you already picked. Deriving it\n * this way means a third party shipping their own library gets classified correctly without having to\n * declare anything extra.\n */\nexport function baseComponentLibraries(catalog: ScenePackage[]): ScenePackage[] {\n const libraries = packagesOfKind(catalog, PackageKind.ComponentLibrary);\n const names = new Set(libraries.map((scenePackage) => scenePackage.name));\n return libraries.filter((scenePackage) => !scenePackage.dependencies.some((dependency) => names.has(dependency.name)));\n}\n\n/**\n * The packages that can be added to a selection without pulling anything else in — every dependency they\n * declare is already selected.\n *\n * This is the \"what else works with what I have picked\" list: choose PrimeReact and Tailwind, and\n * `@cratis/components` becomes available because both of its dependencies are now met. It is\n * deliberately stricter than {@link resolvePackageDependencies}, which will happily add the missing\n * dependencies for you — a picker wants to show what fits, not what would drag more in.\n */\nexport function availablePackagesFor(catalog: ScenePackage[], selected: string[]): ScenePackage[] {\n const chosen = new Set(selected);\n return catalog.filter(\n (scenePackage) => !chosen.has(scenePackage.name) && scenePackage.dependencies.every((dependency) => chosen.has(dependency.name))\n );\n}\n\n/**\n * Every component name the selected packages declare between them, without duplicates, sorted so a\n * component picker has a stable list to show.\n */\nexport function componentsForPackages(catalog: ScenePackage[], selected: string[]): string[] {\n const chosen = new Set(selected);\n const components = catalog.filter((scenePackage) => chosen.has(scenePackage.name)).flatMap((scenePackage) => scenePackage.components);\n return [...new Set(components)].sort();\n}\n\n/**\n * Builds the component-name catalog `resolveComponentName` resolves against.\n */\nexport function toComponentCatalog(catalog: ScenePackage[]): Record<string, string[]> {\n const components: Record<string, string[]> = {};\n for (const scenePackage of catalog) {\n components[scenePackage.name] = scenePackage.components;\n }\n\n return components;\n}\n"],"names":["packagesOfKind","catalog","kind","filter","scenePackage","baseComponentLibraries","libraries","PackageKind","ComponentLibrary","names","Set","map","name","dependencies","some","dependency","has","availablePackagesFor","selected","chosen","every","componentsForPackages","components","flatMap","sort","toComponentCatalog"],"mappings":";;AAAA;AACA;AAIA;;AAEC,IACM,SAASA,cAAAA,CAAeC,OAAuB,EAAEC,IAAiB,EAAA;AACrE,IAAA,OAAOD,QAAQE,MAAM,CAAC,CAACC,YAAAA,GAAiBA,YAAAA,CAAaF,IAAI,KAAKA,IAAAA,CAAAA;AAClE;AAEA;;;;;;;;;IAUO,SAASG,sBAAAA,CAAuBJ,OAAuB,EAAA;AAC1D,IAAA,MAAMK,SAAAA,GAAYN,cAAAA,CAAeC,OAAAA,EAASM,WAAAA,CAAYC,gBAAgB,CAAA;IACtE,MAAMC,KAAAA,GAAQ,IAAIC,GAAAA,CAAIJ,SAAAA,CAAUK,GAAG,CAAC,CAACP,YAAAA,GAAiBA,YAAAA,CAAaQ,IAAI,CAAA,CAAA;AACvE,IAAA,OAAON,UAAUH,MAAM,CAAC,CAACC,YAAAA,GAAiB,CAACA,YAAAA,CAAaS,YAAY,CAACC,IAAI,CAAC,CAACC,UAAAA,GAAeN,MAAMO,GAAG,CAACD,WAAWH,IAAI,CAAA,CAAA,CAAA;AACvH;AAEA;;;;;;;;AAQC,IACM,SAASK,oBAAAA,CAAqBhB,OAAuB,EAAEiB,QAAkB,EAAA;IAC5E,MAAMC,MAAAA,GAAS,IAAIT,GAAAA,CAAIQ,QAAAA,CAAAA;IACvB,OAAOjB,OAAAA,CAAQE,MAAM,CACjB,CAACC,eAAiB,CAACe,MAAAA,CAAOH,GAAG,CAACZ,YAAAA,CAAaQ,IAAI,KAAKR,YAAAA,CAAaS,YAAY,CAACO,KAAK,CAAC,CAACL,aAAeI,MAAAA,CAAOH,GAAG,CAACD,UAAAA,CAAWH,IAAI,CAAA,CAAA,CAAA;AAEtI;AAEA;;;AAGC,IACM,SAASS,qBAAAA,CAAsBpB,OAAuB,EAAEiB,QAAkB,EAAA;IAC7E,MAAMC,MAAAA,GAAS,IAAIT,GAAAA,CAAIQ,QAAAA,CAAAA;AACvB,IAAA,MAAMI,aAAarB,OAAAA,CAAQE,MAAM,CAAC,CAACC,eAAiBe,MAAAA,CAAOH,GAAG,CAACZ,YAAAA,CAAaQ,IAAI,CAAA,CAAA,CAAGW,OAAO,CAAC,CAACnB,YAAAA,GAAiBA,aAAakB,UAAU,CAAA;IACpI,OAAO;AAAI,QAAA,GAAA,IAAIZ,GAAAA,CAAIY,UAAAA;AAAY,KAAA,CAACE,IAAI,EAAA;AACxC;AAEA;;IAGO,SAASC,kBAAAA,CAAmBxB,OAAuB,EAAA;AACtD,IAAA,MAAMqB,aAAuC,EAAC;IAC9C,KAAK,MAAMlB,gBAAgBH,OAAAA,CAAS;AAChCqB,QAAAA,UAAU,CAAClB,YAAAA,CAAaQ,IAAI,CAAC,GAAGR,aAAakB,UAAU;AAC3D,IAAA;IAEA,OAAOA,UAAAA;AACX;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersionRange.js","sources":["../../packageVersionRange.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/**\n * Checks a {@link PackageDependency.versionRange} against a package's actual version. A deliberately\n * small subset of semver — enough to express what a package declaration realistically needs, and small\n * enough that the C# twin in `Cratis.Scene.Engine` can match it exactly rather than approximately. Both\n * sides are asserted against the same shared fixture corpus.\n *\n * Supported: an empty range or `*` (anything), a bare or `=`-prefixed exact version, `^` (npm caret —\n * compatible within the leftmost non-zero component), `~` (patch-level changes), and the comparisons\n * `>=`, `>`, `<=`, `<`. Versions are read as `major.minor.patch` with any pre-release or build metadata\n * suffix ignored. Anything the parser does not recognize is treated as unsatisfiable rather than as\n * \"anything\", so a typo surfaces as a conflict instead of silently passing.\n */\nexport function isVersionSatisfiedBy(version: string, range: string | undefined): boolean {\n const trimmed = range?.trim();\n if (!trimmed || trimmed === '*') return true;\n\n const actual = parseVersion(version);\n if (!actual) return false;\n\n const [operator, literal] = splitRange(trimmed);\n const required = parseVersion(literal);\n if (!required) return false;\n\n switch (operator) {\n case '^':\n return compare(actual, required) >= 0 && compare(actual, caretUpperBound(required)) < 0;\n case '~':\n return compare(actual, required) >= 0 && compare(actual, [required[0], required[1] + 1, 0]) < 0;\n case '>=':\n return compare(actual, required) >= 0;\n case '>':\n return compare(actual, required) > 0;\n case '<=':\n return compare(actual, required) <= 0;\n case '<':\n return compare(actual, required) < 0;\n default:\n return compare(actual, required) === 0;\n }\n}\n\ntype Version = [number, number, number];\n\nfunction splitRange(range: string): [string, string] {\n for (const operator of ['>=', '<=', '^', '~', '>', '<', '=']) {\n if (range.startsWith(operator)) {\n return [operator === '=' ? '' : operator, range.substring(operator.length).trim()];\n }\n }\n\n return ['', range];\n}\n\n/**\n * npm's caret rule: compatibility is bounded by the leftmost non-zero component, so `^1.2.3` allows\n * anything below `2.0.0`, `^0.2.3` anything below `0.3.0`, and `^0.0.3` only `0.0.3` itself.\n */\nfunction caretUpperBound(version: Version): Version {\n if (version[0] > 0) return [version[0] + 1, 0, 0];\n if (version[1] > 0) return [0, version[1] + 1, 0];\n return [0, 0, version[2] + 1];\n}\n\nfunction compare(left: Version, right: Version): number {\n if (left[0] !== right[0]) return left[0] - right[0];\n if (left[1] !== right[1]) return left[1] - right[1];\n return left[2] - right[2];\n}\n\nfunction parseVersion(value: string): Version | undefined {\n let numeric = value.trim();\n const suffix = numeric.search(/[-+]/);\n if (suffix >= 0) {\n numeric = numeric.substring(0, suffix);\n }\n\n const parts = numeric.split('.');\n if (parts.length === 0 || parts.length > 3) return undefined;\n\n const components: Version = [0, 0, 0];\n for (let index = 0; index < parts.length; index++) {\n if (!/^\\d+$/.test(parts[index])) return undefined;\n components[index] = parseInt(parts[index], 10);\n }\n\n return components;\n}\n"],"names":["isVersionSatisfiedBy","version","range","trimmed","trim","actual","parseVersion","operator","literal","splitRange","required","compare","caretUpperBound","startsWith","substring","length","left","right","value","numeric","suffix","search","parts","split","undefined","components","index","test","parseInt"],"mappings":"AAAA;AACA;AAEA;;;;;;;;;;;AAWC,IACM,SAASA,oBAAAA,CAAqBC,OAAe,EAAEC,KAAyB,EAAA;AAC3E,IAAA,MAAMC,UAAUD,KAAAA,EAAOE,IAAAA,EAAAA;AACvB,IAAA,IAAI,CAACD,OAAAA,IAAWA,OAAAA,KAAY,GAAA,EAAK,OAAO,IAAA;AAExC,IAAA,MAAME,SAASC,YAAAA,CAAaL,OAAAA,CAAAA;IAC5B,IAAI,CAACI,QAAQ,OAAO,KAAA;AAEpB,IAAA,MAAM,CAACE,QAAAA,EAAUC,OAAAA,CAAQ,GAAGC,UAAAA,CAAWN,OAAAA,CAAAA;AACvC,IAAA,MAAMO,WAAWJ,YAAAA,CAAaE,OAAAA,CAAAA;IAC9B,IAAI,CAACE,UAAU,OAAO,KAAA;IAEtB,OAAQH,QAAAA;QACJ,KAAK,GAAA;AACD,YAAA,OAAOI,QAAQN,MAAAA,EAAQK,QAAAA,CAAAA,IAAa,KAAKC,OAAAA,CAAQN,MAAAA,EAAQO,gBAAgBF,QAAAA,CAAAA,CAAAA,GAAa,CAAA;QAC1F,KAAK,GAAA;AACD,YAAA,OAAOC,OAAAA,CAAQN,MAAAA,EAAQK,QAAAA,CAAAA,IAAa,CAAA,IAAKC,QAAQN,MAAAA,EAAQ;AAACK,gBAAAA,QAAQ,CAAC,CAAA,CAAE;gBAAEA,QAAQ,CAAC,EAAE,GAAG,CAAA;AAAG,gBAAA;aAAE,CAAA,GAAI,CAAA;QAClG,KAAK,IAAA;YACD,OAAOC,OAAAA,CAAQN,QAAQK,QAAAA,CAAAA,IAAa,CAAA;QACxC,KAAK,GAAA;YACD,OAAOC,OAAAA,CAAQN,QAAQK,QAAAA,CAAAA,GAAY,CAAA;QACvC,KAAK,IAAA;YACD,OAA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sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/**\n * Checks a {@link PackageDependency.versionRange} against a package's actual version. A deliberately\n * small subset of semver — enough to express what a package declaration realistically needs, and small\n * enough that the C# twin in `Cratis.Scene.Engine` can match it exactly rather than approximately. Both\n * sides are asserted against the same shared fixture corpus.\n *\n * Supported: an empty range or `*` (anything), a bare or `=`-prefixed exact version, `^` (npm caret —\n * compatible within the leftmost non-zero component), `~` (patch-level changes), and the comparisons\n * `>=`, `>`, `<=`, `<`. Versions are read as `major.minor.patch` with any pre-release or build metadata\n * suffix ignored. Anything the parser does not recognize is treated as unsatisfiable rather than as\n * \"anything\", so a typo surfaces as a conflict instead of silently passing.\n */\nexport function isVersionSatisfiedBy(version: string, range: string | undefined): boolean {\n const trimmed = range?.trim();\n if (!trimmed || trimmed === '*') return true;\n\n const actual = parseVersion(version);\n if (!actual) return false;\n\n const [operator, literal] = splitRange(trimmed);\n const required = parseVersion(literal);\n if (!required) return false;\n\n switch (operator) {\n case '^':\n return compare(actual, required) >= 0 && compare(actual, caretUpperBound(required)) < 0;\n case '~':\n return compare(actual, required) >= 0 && compare(actual, [required[0], required[1] + 1, 0]) < 0;\n case '>=':\n return compare(actual, required) >= 0;\n case '>':\n return compare(actual, required) > 0;\n case '<=':\n return compare(actual, required) <= 0;\n case '<':\n return compare(actual, required) < 0;\n default:\n return compare(actual, required) === 0;\n }\n}\n\ntype Version = [number, number, number];\n\nfunction splitRange(range: string): [string, string] {\n for (const operator of ['>=', '<=', '^', '~', '>', '<', '=']) {\n if (range.startsWith(operator)) {\n return [operator === '=' ? '' : operator, range.substring(operator.length).trim()];\n }\n }\n\n return ['', range];\n}\n\n/**\n * npm's caret rule: compatibility is bounded by the leftmost non-zero component, so `^1.2.3` allows\n * anything below `2.0.0`, `^0.2.3` anything below `0.3.0`, and `^0.0.3` only `0.0.3` itself.\n */\nfunction caretUpperBound(version: Version): Version {\n if (version[0] > 0) return [version[0] + 1, 0, 0];\n if (version[1] > 0) return [0, version[1] + 1, 0];\n return [0, 0, version[2] + 1];\n}\n\nfunction compare(left: Version, right: Version): number {\n if (left[0] !== right[0]) return left[0] - right[0];\n if (left[1] !== right[1]) return left[1] - right[1];\n return left[2] - right[2];\n}\n\nfunction parseVersion(value: string): Version | undefined {\n let numeric = value.trim();\n const suffix = numeric.search(/[-+]/);\n if (suffix >= 0) {\n numeric = numeric.substring(0, suffix);\n }\n\n const parts = numeric.split('.');\n if (parts.length === 0 || parts.length > 3) return undefined;\n\n const components: Version = [0, 0, 0];\n for (let index = 0; index < parts.length; index++) {\n if (!/^\\d+$/.test(parts[index])) return undefined;\n components[index] = parseInt(parts[index], 10);\n }\n\n return components;\n}\n"],"names":["isVersionSatisfiedBy","version","range","trimmed","trim","actual","parseVersion","operator","literal","splitRange","required","compare","caretUpperBound","startsWith","substring","length","left","right","value","numeric","suffix","search","parts","split","undefined","components","index","test","parseInt"],"mappings":"AAAA;AACA;AAEA;;;;;;;;;;;AAWC,IACM,SAASA,oBAAAA,CAAqBC,OAAe,EAAEC,KAAyB,EAAA;AAC3E,IAAA,MAAMC,UAAUD,KAAAA,EAAOE,IAAAA,EAAAA;AACvB,IAAA,IAAI,CAACD,OAAAA,IAAWA,OAAAA,KAAY,GAAA,EAAK,OAAO,IAAA;AAExC,IAAA,MAAME,SAASC,YAAAA,CAAaL,OAAAA,CAAAA;IAC5B,IAAI,CAACI,QAAQ,OAAO,KAAA;AAEpB,IAAA,MAAM,CAACE,QAAAA,EAAUC,OAAAA,CAAQ,GAAGC,UAAAA,CAAWN,OAAAA,CAAAA;AACvC,IAAA,MAAMO,WAAWJ,YAAAA,CAAaE,OAAAA,CAAAA;IAC9B,IAAI,CAACE,UAAU,OAAO,KAAA;IAEtB,OAAQH,QAAAA;QACJ,KAAK,GAAA;AACD,YAAA,OAAOI,QAAQN,MAAAA,EAAQK,QAAAA,CAAAA,IAAa,KAAKC,OAAAA,CAAQN,MAAAA,EA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,IAAA,MAAMC,UAAAA,GAAsB;AAAC,QAAA,CAAA;AAAG,QAAA,CAAA;AAAG,QAAA;AAAE,KAAA;AACrC,IAAA,IAAK,IAAIC,KAAAA,GAAQ,CAAA,EAAGA,QAAQJ,KAAAA,CAAMP,MAAM,EAAEW,KAAAA,EAAAA,CAAS;QAC/C,IAAI,CAAC,QAAQC,IAAI,CAACL,KAAK,CAACI,KAAAA,CAAM,GAAG,OAAOF,SAAAA;AACxCC,QAAAA,UAAU,CAACC,KAAAA,CAAM,GAAGE,SAASN,KAAK,CAACI,MAAM,EAAE,EAAA,CAAA;AAC/C,IAAA;IAEA,OAAOD,UAAAA;AACX;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"panelKind.js","sources":["../../panelKind.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Canvas, DockPanel, Grid, Panel, StackPanel, WrapPanel } from '@cratis/scene.model';\n\n/**\n * Type guards telling the concrete panels apart, by the property each one alone declares - the same way\n * {@link isPanel} and its siblings tell the element kinds apart. The model carries no discriminator, so a\n * panel is recognized by its own shape rather than by a tag it was serialized with.\n *\n * A plain {@link Panel} matches none of these. That is a real case rather than an oversight: a panel that\n * says nothing about how it arranges its children is a grouping, and a renderer is free to lay it out in\n * whatever way its platform considers neutral.\n */\n\nexport function isCanvas(panel: Panel): panel is Canvas {\n return 'extent' in panel;\n}\n\nexport function isGrid(panel: Panel): panel is Grid {\n return 'rows' in panel && 'columns' in panel;\n}\n\nexport function isDockPanel(panel: Panel): panel is DockPanel {\n return 'lastChildFill' in panel;\n}\n\nexport function isStackPanel(panel: Panel): panel is StackPanel {\n return 'spacing' in panel && 'orientation' in panel;\n}\n\nexport function isWrapPanel(panel: Panel): panel is WrapPanel {\n // A wrap panel and a stack panel both orient their line; only the stack panel spaces its children,\n // and only the wrap panel sizes them. Checking for the absence of `spacing` is what separates a wrap\n // panel that happens to size neither of its axes from a stack panel.\n return 'orientation' in panel && !('spacing' in panel);\n}\n"],"names":["isCanvas","panel","isGrid","isDockPanel","isStackPanel","isWrapPanel"],"mappings":"AAAA;AACA;AAIA;;;;;;;;IAUO,SAASA,QAAAA,CAASC,KAAY,EAAA;AACjC,IAAA,OAAO,QAAA,IAAYA,KAAAA;AACvB;AAEO,SAASC,OAAOD,KAAY,EAAA;IAC/B,OAAO,MAAA,IAAUA,SAAS,SAAA,IAAaA,KAAAA;AAC3C;AAEO,SAASE,YAAYF,KAAY,EAAA;AACpC,IAAA,OAAO,eAAA,IAAmBA,KAAAA;AAC9B;AAEO,SAASG,aAAaH,KAAY,EAAA;IACrC,OAAO,SAAA,IAAaA,SAAS,aAAA,IAAiBA,KAAAA;AAClD;AAEO,SAASI,YAAYJ,KAAY,EAAA;;;;AAIpC,IAAA,OAAO,aAAA,IAAiBA,KAAAA,IAAS,EAAE,aAAaA,KAAI,CAAA;AACxD;;;;"}
1
+ {"version":3,"file":"panelKind.js","sources":["../../panelKind.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Canvas, DockPanel, Grid, Panel, StackPanel, WrapPanel } from '@cratis/scene.model';\n\n/**\n * Type guards telling the concrete panels apart, by the property each one alone declares - the same way\n * {@link isPanel} and its siblings tell the element kinds apart. The model carries no discriminator, so a\n * panel is recognized by its own shape rather than by a tag it was serialized with.\n *\n * A plain {@link Panel} matches none of these. That is a real case rather than an oversight: a panel that\n * says nothing about how it arranges its children is a grouping, and a renderer is free to lay it out in\n * whatever way its platform considers neutral.\n */\n\nexport function isCanvas(panel: Panel): panel is Canvas {\n return 'extent' in panel;\n}\n\nexport function isGrid(panel: Panel): panel is Grid {\n return 'rows' in panel && 'columns' in panel;\n}\n\nexport function isDockPanel(panel: Panel): panel is DockPanel {\n return 'lastChildFill' in panel;\n}\n\nexport function isStackPanel(panel: Panel): panel is StackPanel {\n return 'spacing' in panel && 'orientation' in panel;\n}\n\nexport function isWrapPanel(panel: Panel): panel is WrapPanel {\n // A wrap panel and a stack panel both orient their line; only the stack panel spaces its children,\n // and only the wrap panel sizes them. Checking for the absence of `spacing` is what separates a wrap\n // panel that happens to size neither of its axes from a stack panel.\n return 'orientation' in panel && !('spacing' in panel);\n}\n"],"names":["isCanvas","panel","isGrid","isDockPanel","isStackPanel","isWrapPanel"],"mappings":"AAAA;AACA;AAIA;;;;;;;;IAUO,SAASA,QAAAA,CAASC,KAAY,EAAA;AACjC,IAAA,OAAO,QAAA,IAAYA,KAAAA;AACvB;AAEO,SAASC,OAAOD,KAAY,EAAA;IAC/B,OAAO,MAAA,IAAUA,SAAS,SAAA,IAAaA,KAAAA;AAC3C;AAEO,SAASE,YAAYF,KAAY,EAAA;AACpC,IAAA,OAAO,eAAA,IAAmBA,KAAAA;AAC9B;AAEO,SAASG,aAAaH,KAAY,EAAA;IACrC,OAAO,SAAA,IAAaA,SAAS,aAAA,IAAiBA,KAAAA;AAClD;AAEO,SAASI,YAAYJ,KAAY,EAAA;;;;AAIpC,IAAA,OAAO,aAAA,IAAiBA,KAAAA,IAAS,EAAE,aAAaA,KAAI,CAAA;AACxD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"renderElement.js","sources":["../../renderElement.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { SceneElement } from '@cratis/scene.model';\nimport { Renderer } from './Renderer';\nimport { BindingResolver } from './BindingResolver';\nimport { isContentControl, isItemsControl, isExternalComponent, isPanel } from './elementKind';\n\n/**\n * Walks a Scene element tree, rendering each node's children before the node itself, and hands the\n * result to the supplied {@link Renderer}. This is a structural tree walk only - resolving a `ui\n * profile`'s package list, aggregating contribution points, and computing layout arrangement are the\n * jobs of the profile resolution, contribution runtime and layout engines (Scene#3, Scene#2, Scene#4),\n * layered on top of this walk rather than folded into it.\n */\nexport function renderElement<TOutput>(element: SceneElement, renderer: Renderer<TOutput>, resolveBinding: BindingResolver): TOutput {\n if (isContentControl(element)) {\n return renderer.renderContentControl(element, renderElement(element.content, renderer, resolveBinding));\n }\n\n if (isItemsControl(element)) {\n const items = resolveBinding(element.itemsSource);\n const itemCount = Array.isArray(items) ? items.length : 0;\n const rendered = Array.from({ length: itemCount }, () => renderElement(element.itemTemplate, renderer, resolveBinding));\n return renderer.renderItemsControl(element, rendered);\n }\n\n if (isExternalComponent(element)) {\n const slots = Object.fromEntries(\n Object.entries(element.slots).map(([name, children]) => [name, children.map(child => renderElement(child, renderer, resolveBinding))]),\n );\n return renderer.renderExternalComponent(element, slots);\n }\n\n if (isPanel(element)) {\n return renderer.renderPanel(element, element.children.map(child => renderElement(child, renderer, resolveBinding)));\n }\n\n throw new Error(`Scene element '${element.id}' is not a recognized concrete kind (ContentControl, ItemsControl, ExternalComponent or Panel).`);\n}\n"],"names":["renderElement","element","renderer","resolveBinding","isContentControl","renderContentControl","content","isItemsControl","items","itemsSource","itemCount","Array","isArray","length","rendered","from","itemTemplate","renderItemsControl","isExternalComponent","slots","Object","fromEntries","entries","map","name","children","child","renderExternalComponent","isPanel","renderPanel","Error","id"],"mappings":";;AAAA;AACA;AAOA;;;;;;AAMC,IACM,SAASA,aAAAA,CAAuBC,OAAqB,EAAEC,QAA2B,EAAEC,cAA+B,EAAA;AACtH,IAAA,IAAIC,iBAAiBH,OAAAA,CAAAA,EAAU;QAC3B,OAAOC,QAAAA,CAASG,oBAAoB,CAACJ,OAAAA,EAASD,cAAcC,OAAAA,CAAQK,OAAO,EAAEJ,QAAAA,EAAUC,cAAAA,CAAAA,CAAAA;AAC3F,IAAA;AAEA,IAAA,IAAII,eAAeN,OAAAA,CAAAA,EAAU;QACzB,MAAMO,KAAAA,GAAQL,cAAAA,CAAeF,OAAAA,CAAQQ,WAAW,CAAA;AAChD,QAAA,MAAMC,YAAYC,KAAAA,CAAMC,OAAO,CAACJ,KAAAA,CAAAA,GAASA,KAAAA,CAAMK,MAAM,GAAG,CAAA;QACxD,MAAMC,QAAAA,GAAWH,KAAAA,CAAMI,IAAI,CAAC;YAAEF,MAAAA,EAAQH;AAAU,SAAA,EAAG,IAAMV,aAAAA,CAAcC,OAAAA,CAAQe,YAAY,EAAEd,QAAAA,EAAUC,cAAAA,CAAAA,CAAAA;QACvG,OAAOD,QAAAA,CAASe,kBAAkB,CAAChB,OAAAA,EAASa,QAAAA,CAAAA;AAChD,IAAA;AAEA,IAAA,IAAII,oBAAoBjB,OAAAA,CAAAA,EAAU;AAC9B,QAAA,MAAMkB,QAAQC,MAAAA,CAAOC,WAAW,CAC5BD,MAAAA,CAAOE,OAAO,CAACrB,OAAAA,CAAQkB,KAAK,CAAA,CAAEI,GAAG,CAAC,CAAC,CAACC,IAAAA,EAAMC,SAAS,GAAK;AAACD,gBAAAA,IAAAA;AAAMC,gBAAAA,QAAAA,CAASF,GAAG,CAACG,CAAAA,KAAAA,GAAS1B,aAAAA,CAAc0B,OAAOxB,QAAAA,EAAUC,cAAAA,CAAAA;AAAiB,aAAA,CAAA,CAAA;QAEzI,OAAOD,QAAAA,CAASyB,uBAAuB,CAAC1B,OAAAA,EAASkB,KAAAA,CAAAA;AACrD,IAAA;AAEA,IAAA,IAAIS,QAAQ3B,OAAAA,CAAAA,EAAU;AAClB,QAAA,OAAOC,QAAAA,CAAS2B,WAAW,CAAC5B,OAAAA,EAASA,OAAAA,CAAQwB,QAAQ,CAACF,GAAG,CAACG,CAAAA,KAAAA,GAAS1B,aAAAA,CAAc0B,OAAOxB,QAAAA,EAAUC,cAAAA,CAAAA,CAAAA,CAAAA;AACtG,IAAA;IAEA,MAAM,IAAI2B,MAAM,CAAC,eAAe,EAAE7B,OAAAA,CAAQ8B,EAAE,CAAC,+FAA+F,CAAC,CAAA;AACjJ;;;;"}
1
+ {"version":3,"file":"renderElement.js","sources":["../../renderElement.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { SceneElement } from '@cratis/scene.model';\nimport { Renderer } from './Renderer';\nimport { BindingResolver } from './BindingResolver';\nimport { isContentControl, isItemsControl, isExternalComponent, isPanel } from './elementKind';\n\n/**\n * Walks a Scene element tree, rendering each node's children before the node itself, and hands the\n * result to the supplied {@link Renderer}. This is a structural tree walk only - resolving a `ui\n * profile`'s package list, aggregating contribution points, and computing layout arrangement are the\n * jobs of the profile resolution, contribution runtime and layout engines (Scene#3, Scene#2, Scene#4),\n * layered on top of this walk rather than folded into it.\n */\nexport function renderElement<TOutput>(element: SceneElement, renderer: Renderer<TOutput>, resolveBinding: BindingResolver): TOutput {\n if (isContentControl(element)) {\n return renderer.renderContentControl(element, renderElement(element.content, renderer, resolveBinding));\n }\n\n if (isItemsControl(element)) {\n const items = resolveBinding(element.itemsSource);\n const itemCount = Array.isArray(items) ? items.length : 0;\n const rendered = Array.from({ length: itemCount }, () => renderElement(element.itemTemplate, renderer, resolveBinding));\n return renderer.renderItemsControl(element, rendered);\n }\n\n if (isExternalComponent(element)) {\n const slots = Object.fromEntries(\n Object.entries(element.slots).map(([name, children]) => [name, children.map(child => renderElement(child, renderer, resolveBinding))]),\n );\n return renderer.renderExternalComponent(element, slots);\n }\n\n if (isPanel(element)) {\n return renderer.renderPanel(element, element.children.map(child => renderElement(child, renderer, resolveBinding)));\n }\n\n throw new Error(`Scene element '${element.id}' is not a recognized concrete kind (ContentControl, ItemsControl, ExternalComponent or Panel).`);\n}\n"],"names":["renderElement","element","renderer","resolveBinding","isContentControl","renderContentControl","content","isItemsControl","items","itemsSource","itemCount","Array","isArray","length","rendered","from","itemTemplate","renderItemsControl","isExternalComponent","slots","Object","fromEntries","entries","map","name","children","child","renderExternalComponent","isPanel","renderPanel","Error","id"],"mappings":";;AAAA;AACA;AAOA;;;;;;AAMC,IACM,SAASA,aAAAA,CAAuBC,OAAqB,EAAEC,QAA2B,EAAEC,cAA+B,EAAA;AACtH,IAAA,IAAIC,iBAAiBH,OAAAA,CAAAA,EAAU;QAC3B,OAAOC,QAAAA,CAASG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AAA,GAAS1B,aAAAA,CAAc0B,OAAOxB,QAAAA,EAAUC,cAAAA,CAAAA,CAAAA,CAAAA;AACtG,IAAA;IAEA,MAAM,IAAI2B,MAAM,CAAC,eAAe,EAAE7B,OAAAA,CAAQ8B,EAAE,CAAC,+FAA+F,CAAC,CAAA;AACjJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"resolveComponentName.js","sources":["../../resolveComponentName.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { UiProfile } from '@cratis/scene.model';\nimport { ComponentResolution } from './ComponentResolution';\n\n/** The name of the package that is always present as the final fallback, regardless of what a {@link UiProfile} lists in its own `packages`. */\nexport const corePackage = 'core';\n\n/** Every active package's declared component names, keyed by package name. */\nexport type PackageCatalog = Record<string, string[]>;\n\n/**\n * Computes a {@link UiProfile}'s effective package priority order - its own declared packages, with\n * {@link corePackage} prepended as the final fallback when not already present. {@link corePackage} is\n * the lowest-priority fallback, so it belongs at the front of the ascending-priority order, not the\n * back - prepending it (rather than appending) is what makes every explicitly listed package outrank it.\n *\n * @returns The packages in ascending priority order - the last entry wins when more than one declares the same name.\n */\nexport function effectivePackages(profile: UiProfile): string[] {\n return profile.packages.includes(corePackage) ? profile.packages : [corePackage, ...profile.packages];\n}\n\n/**\n * Resolves a component name against a {@link UiProfile} - the runtime half of Cratis/Scene#3, run\n * whenever a profile is applied. Studio's design-time tooling and Stage's build-time resolution use the\n * C# twin of this algorithm in `Cratis.Scene.Engine`; both sides are asserted against the same shared\n * fixture corpus so they cannot drift apart.\n *\n * A name containing a `.` is package-qualified - everything before the last `.` is the package,\n * everything after is the bare name - and resolves directly against that one package, bypassing shadow\n * tracking and the profile's priority order entirely (an author naming the package explicitly has\n * already disambiguated). A name with no `.` is bare and resolves by walking {@link effectivePackages}\n * from highest to lowest priority; every other active package that also declares the name is recorded in\n * the result's `shadows`, not discarded, so a caller can explain the pick rather than only report it.\n *\n * @param requestedName The name as written on a screen - bare (`button`) or package-qualified (`Internal.Widgets.TrendChart`).\n * @param profile The {@link UiProfile} whose package list to resolve against.\n * @param catalog Every active package's declared component names, keyed by package name.\n * @returns The {@link ComponentResolution}, or `undefined` when nothing in scope declares the name.\n */\nexport function resolveComponentName(requestedName: string, profile: UiProfile, catalog: PackageCatalog): ComponentResolution | undefined {\n const lastDot = requestedName.lastIndexOf('.');\n if (lastDot >= 0) {\n const qualifiedPackage = requestedName.slice(0, lastDot);\n const qualifiedName = requestedName.slice(lastDot + 1);\n return declares(catalog, qualifiedPackage, qualifiedName)\n ? { name: qualifiedName, package: qualifiedPackage, shadows: [] }\n : undefined;\n }\n\n const priority = effectivePackages(profile);\n const matches: string[] = [];\n for (let index = priority.length - 1; index >= 0; index--) {\n if (declares(catalog, priority[index], requestedName)) {\n matches.push(priority[index]);\n }\n }\n\n return matches.length === 0 ? undefined : { name: requestedName, package: matches[0], shadows: matches.slice(1) };\n}\n\nfunction declares(catalog: PackageCatalog, packageName: string, name: string): boolean {\n return catalog[packageName]?.includes(name) ?? false;\n}\n"],"names":["corePackage","effectivePackages","profile","packages","includes","resolveComponentName","requestedName","catalog","lastDot","lastIndexOf","qualifiedPackage","slice","qualifiedName","declares","name","package","shadows","undefined","priority","matches","index","length","push","packageName"],"mappings":"AAAA;AACA;AAKA,iJACO,MAAMA,WAAAA,GAAc;AAK3B;;;;;;;IAQO,SAASC,iBAAAA,CAAkBC,OAAkB,EAAA;IAChD,OAAOA,OAAAA,CAAQC,QAAQ,CAACC,QAAQ,CAACJ,WAAAA,CAAAA,GAAeE,OAAAA,CAAQC,QAAQ,GAAG;AAACH,QAAAA,WAAAA;AAAgBE,QAAAA,GAAAA,OAAAA,CAAQC;AAAS,KAAA;AACzG;AAEA;;;;;;;;;;;;;;;;;AAiBC,IACM,SAASE,oBAAAA,CAAqBC,aAAqB,EAAEJ,OAAkB,EAAEK,OAAuB,EAAA;IACnG,MAAMC,OAAAA,GAAUF,aAAAA,CAAcG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ponentName.js","sources":["../../resolveComponentName.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { UiProfile } from '@cratis/scene.model';\nimport { ComponentResolution } from './ComponentResolution';\n\n/** The name of the package that is always present as the final fallback, regardless of what a {@link UiProfile} lists in its own `packages`. */\nexport const corePackage = 'core';\n\n/** Every active package's declared component names, keyed by package name. */\nexport type PackageCatalog = Record<string, string[]>;\n\n/**\n * Computes a {@link UiProfile}'s effective package priority order - its own declared packages, with\n * {@link corePackage} prepended as the final fallback when not already present. {@link corePackage} is\n * the lowest-priority fallback, so it belongs at the front of the ascending-priority order, not the\n * back - prepending it (rather than appending) is what makes every explicitly listed package outrank it.\n *\n * @returns The packages in ascending priority order - the last entry wins when more than one declares the same name.\n */\nexport function effectivePackages(profile: UiProfile): string[] {\n return profile.packages.includes(corePackage) ? profile.packages : [corePackage, ...profile.packages];\n}\n\n/**\n * Resolves a component name against a {@link UiProfile} - the runtime half of Cratis/Scene#3, run\n * whenever a profile is applied. Studio's design-time tooling and Stage's build-time resolution use the\n * C# twin of this algorithm in `Cratis.Scene.Engine`; both sides are asserted against the same shared\n * fixture corpus so they cannot drift apart.\n *\n * A name containing a `.` is package-qualified - everything before the last `.` is the package,\n * everything after is the bare name - and resolves directly against that one package, bypassing shadow\n * tracking and the profile's priority order entirely (an author naming the package explicitly has\n * already disambiguated). A name with no `.` is bare and resolves by walking {@link effectivePackages}\n * from highest to lowest priority; every other active package that also declares the name is recorded in\n * the result's `shadows`, not discarded, so a caller can explain the pick rather than only report it.\n *\n * @param requestedName The name as written on a screen - bare (`button`) or package-qualified (`Internal.Widgets.TrendChart`).\n * @param profile The {@link UiProfile} whose package list to resolve against.\n * @param catalog Every active package's declared component names, keyed by package name.\n * @returns The {@link ComponentResolution}, or `undefined` when nothing in scope declares the name.\n */\nexport function resolveComponentName(requestedName: string, profile: UiProfile, catalog: PackageCatalog): ComponentResolution | undefined {\n const lastDot = requestedName.lastIndexOf('.');\n if (lastDot >= 0) {\n const qualifiedPackage = requestedName.slice(0, lastDot);\n const qualifiedName = requestedName.slice(lastDot + 1);\n return declares(catalog, qualifiedPackage, qualifiedName)\n ? { name: qualifiedName, package: qualifiedPackage, shadows: [] }\n : undefined;\n }\n\n const priority = effectivePackages(profile);\n const matches: string[] = [];\n for (let index = priority.length - 1; index >= 0; index--) {\n if (declares(catalog, priority[index], requestedName)) {\n matches.push(priority[index]);\n }\n }\n\n return matches.length === 0 ? undefined : { name: requestedName, package: matches[0], shadows: matches.slice(1) };\n}\n\nfunction declares(catalog: PackageCatalog, packageName: string, name: string): boolean {\n return catalog[packageName]?.includes(name) ?? false;\n}\n"],"names":["corePackage","effectivePackages","profile","packages","includes","resolveComponentName","requestedName","catalog","lastDot","lastIndexOf","qualifiedPackage","slice","qualifiedName","declares","name","package","shadows","undefined","priority","matches","index","length","push","packageName"],"mappings":"AAAA;AACA;AAKA,iJACO,MAAMA,WAAAA,GAAc;AAK3B;;;;;;;IAQO,SAASC,iBAAAA,CAAkBC,OAAkB,EAAA;IAChD,OAAOA,OAAAA,CAAQC,QAAQ,CAACC,QAAQ,CAACJ,WAAAA,CAAAA,GAAeE,OAAAA,CAAQC,QAAQ,GAAG;AAACH,QAAAA,WAAAA;AAAgBE,QAAAA,GAAAA,OAAAA,CAAQC;AAAS,KAAA;AACzG;AAEA;;;;;;;;;;;;;;;;;AAiBC,IACM,SAASE,oBAAAA,CAAqBC,aAAqB,EAAEJ,OAAkB,EAAEK,OAAuB,EAAA;IACnG,MAAMC,OAAAA,GAAUF,aAAAA,CAAcG,WAAW,CAAC,GAAA,CAAA;AAC1C,IAAA,IAAID,WAAW,CAAA,EAAG;AACd,QAAA,MAAME,gBAAAA,GAAmBJ,aAAAA,CAAcK,KAAK,CAAC,CAAA,EAAGH,OAAAA,CAAAA;AAChD,QAAA,MAAMI,aAAAA,GAAgBN,aAAAA,CAAcK,KAAK,CAACH,OAAAA,GAAU,CAAA,CAAA;QACpD,OAAOK,QAAAA,CAASN,OAAAA,EAASG,gBAAAA,EAAkBE,aAAAA,CAAAA,GACrC;YAAEE,IAAAA,EAAMF,aAAAA;YAAeG,OAAAA,EAASL,gBAAAA;AAAkBM,YAAAA,OAAAA,EAAS;SAAG,GAC9DC,SAAAA;AACV,IAAA;AAEA,IAAA,MAAMC,WAAWjB,iBAAAA,CAAkBC,OAAAA,CAAAA;AACnC,IAAA,MAAMiB,UAAoB,EAAE;IAC5B,IAAK,IAAIC,QAAQF,QAAAA,CAASG,MAAM,GAAG,CAAA,EAAGD,KAAAA,IAAS,GAAGA,KAAAA,EAAAA,CAAS;AACvD,QAAA,IAAIP,SAASN,OAAAA,EAASW,QAAQ,CAACE,KAAAA,CAAM,EAAEd,aAAAA,CAAAA,EAAgB;AACnDa,YAAAA,OAAAA,CAAQG,IAAI,CAACJ,QAAQ,CAACE,KAAAA,CAAM,CAAA;AAChC,QAAA;AACJ,IAAA;AAEA,IAAA,OAAOD,OAAAA,CAAQE,MAAM,KAAK,CAAA,GAAIJ,SAAAA,GAAY;QAAEH,IAAAA,EAAMR,aAAAA;QAAeS,OAAAA,EAASI,OAAO,CAAC,CAAA,CAAE;QAAEH,OAAAA,EAASG,OAAAA,CAAQR,KAAK,CAAC,CAAA;AAAG,KAAA;AACpH;AAEA,SAASE,QAAAA,CAASN,OAAuB,EAAEgB,WAAmB,EAAET,IAAY,EAAA;AACxE,IAAA,OAAOP,OAAO,CAACgB,WAAAA,CAAY,EAAEnB,SAASU,IAAAA,CAAAA,IAAS,KAAA;AACnD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"resolvePackageDependencies.js","sources":["../../resolvePackageDependencies.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ScenePackage } from '@cratis/scene.model';\nimport { MissingPackageDependency, PackageSelection, PackageVersionConflict } from './PackageSelection';\nimport { isVersionSatisfiedBy } from './packageVersionRange';\n\n/**\n * Expands a chosen set of package names into the complete, correctly ordered list a {@link UiProfile}\n * needs — the runtime half. The C# twin in `Cratis.Scene.Engine` implements the same algorithm for\n * Studio's package picker and Stage's build; both are asserted against the same shared fixture corpus so\n * they cannot drift apart.\n *\n * This is a different concern from `resolveComponentName`, which resolves one component *name* against\n * an already-decided package list. This decides what that list is.\n *\n * Ordering is a stable topological sort: among packages whose dependencies are equally satisfied, the one\n * the caller named first comes first, and packages pulled in transitively follow in the order they were\n * discovered. When a cycle makes ordering impossible, the packages involved are reported in `cycles` and\n * appended in discovery order rather than dropped.\n */\nexport function resolvePackageDependencies(selected: string[], catalog: ScenePackage[]): PackageSelection {\n const index = new Map(catalog.map((scenePackage) => [scenePackage.name, scenePackage]));\n const discovered: string[] = [];\n const seen = new Set<string>(selected);\n const missing: MissingPackageDependency[] = [];\n const versionConflicts: PackageVersionConflict[] = [];\n\n const pending = [...selected];\n while (pending.length > 0) {\n const name = pending.shift()!;\n discovered.push(name);\n\n const scenePackage = index.get(name);\n if (!scenePackage) continue;\n\n for (const dependency of scenePackage.dependencies) {\n const dependedOn = index.get(dependency.name);\n if (!dependedOn) {\n missing.push({ package: scenePackage.name, dependsOn: dependency.name });\n continue;\n }\n\n if (!isVersionSatisfiedBy(dependedOn.version, dependency.versionRange)) {\n versionConflicts.push({\n package: scenePackage.name,\n dependsOn: dependency.name,\n requiredRange: dependency.versionRange!,\n actualVersion: dependedOn.version,\n });\n }\n\n if (!seen.has(dependency.name)) {\n seen.add(dependency.name);\n pending.push(dependency.name);\n }\n }\n }\n\n const cycles = findCycles(discovered, index);\n const packages = topologicallyOrder(discovered, index);\n const chosen = new Set(selected);\n\n return {\n packages,\n added: packages.filter((name) => !chosen.has(name)),\n missing,\n versionConflicts,\n cycles,\n };\n}\n\nfunction dependenciesWithin(name: string, index: Map<string, ScenePackage>, within: Set<string>): string[] {\n const scenePackage = index.get(name);\n if (!scenePackage) return [];\n const names = scenePackage.dependencies.map((dependency) => dependency.name).filter((dependency) => within.has(dependency));\n return [...new Set(names)];\n}\n\n/**\n * Orders an already-closed set of package names so each follows the packages it depends on.\n */\nfunction topologicallyOrder(names: string[], index: Map<string, ScenePackage>): string[] {\n const within = new Set(names);\n const remaining = new Map(names.map((name) => [name, dependenciesWithin(name, index, within).length]));\n\n const ordered: string[] = [];\n const placed = new Set<string>();\n let progressed = true;\n while (progressed) {\n progressed = false;\n for (const name of names) {\n if (placed.has(name) || remaining.get(name) !== 0) continue;\n\n ordered.push(name);\n placed.add(name);\n progressed = true;\n\n for (const other of names) {\n if (placed.has(other)) continue;\n if (dependenciesWithin(other, index, within).includes(name)) {\n remaining.set(other, remaining.get(other)! - 1);\n }\n }\n }\n }\n\n // Anything left is inside a cycle, or downstream of one. It is reported through `cycles`; keeping it\n // in the list means a package picker never silently loses a package it was told about.\n ordered.push(...names.filter((name) => !placed.has(name)));\n return ordered;\n}\n\n/**\n * Finds every dependency cycle, walking depth-first from each package in discovery order so the result\n * is deterministic. A cycle is recorded once, keyed by the set of packages in it.\n */\nfunction findCycles(names: string[], index: Map<string, ScenePackage>): string[][] {\n const within = new Set(names);\n const cycles: string[][] = [];\n const recorded = new Set<string>();\n const path: string[] = [];\n const onPath = new Set<string>();\n const explored = new Set<string>();\n\n const walk = (name: string) => {\n if (onPath.has(name)) {\n const cycle = path.slice(path.indexOf(name));\n const key = [...cycle].sort().join(' ');\n if (!recorded.has(key)) {\n recorded.add(key);\n cycles.push(cycle);\n }\n\n return;\n }\n\n if (explored.has(name)) return;\n explored.add(name);\n\n path.push(name);\n onPath.add(name);\n for (const dependency of dependenciesWithin(name, index, within)) {\n walk(dependency);\n }\n\n onPath.delete(name);\n path.pop();\n };\n\n for (const name of names) {\n walk(name);\n }\n\n return cycles;\n}\n"],"names":["resolvePackageDependencies","selected","catalog","index","Map","map","scenePackage","name","discovered","seen","Set","missing","versionConflicts","pending","length","shift","push","get","dependency","dependencies","dependedOn","package","dependsOn","isVersionSatisfiedBy","version","versionRange","requiredRange","actualVersion","has","add","cycles","findCycles","packages","topologicallyOrder","chosen","added","filter","dependenciesWithin","within","names","remaining","ordered","placed","progressed","other","includes","set","recorded","path","onPath","explored","walk","cycle","slice","indexOf","key","sort","join","delete","pop"],"mappings":";;AAAA;AACA;AAMA;;;;;;;;;;;;;AAaC,IACM,SAASA,0BAAAA,CAA2BC,QAAkB,EAAEC,OAAuB,EAAA;AAClF,IAAA,MAAMC,QAAQ,IAAIC,GAAAA,CAAIF,QAAQG,GAAG,CAAC,CAACC,YAAAA,GAAiB;AAACA,YAAAA,YAAAA,CAAaC,IAAI;AAAED,YAAAA;AAAa,SAAA,CAAA,CAAA;AACrF,IAAA,MAAME,aAAuB,EAAE;IAC/B,MAAMC,IAAAA,GAAO,IAAIC,GAAAA,CAAYT,QAAAA,CAAAA;AAC7B,IAAA,MAAMU,UAAsC,EAAE;AAC9C,IAAA,MAAMC,mBAA6C,EAAE;AAErD,IAAA,MAAMC,OAAAA,GAAU;AAAIZ,QAAAA,GAAAA;AAAS,KAAA;IAC7B,MAAOY,OAAAA,CAAQC,MAAM,GAAG,CAAA,CAAG;QACvB,MAAMP,IAAAA,GAAOM,QAAQE,KAAK,EAAA;AAC1BP,QAAAA,UAAAA,CAAWQ,IAAI,CAACT,IAAAA,CAAAA;QAEhB,MAAMD,YAAAA,GAAeH,KAAAA,CAAMc,GAAG,CAACV,IAAAA,CAAAA;AAC/B,QAAA,IAAI,CAACD,YAAAA,EAAc;AAEnB,QAAA,KAAK,MAAMY,UAAAA,IAAcZ,YAAAA,CAAaa,YAAY,CAAE;AAChD,YAAA,MAAMC,UAAAA,GAAajB,KAAAA,CAAMc,GAAG,CAACC,WAAWX,IAAI,CAAA;AAC5C,YAAA,IAAI,CAACa,UAAAA,EAAY;AACbT,gBAAAA,OAAAA,CAAQK,IAAI,CAAC;AAAEK,oBAAAA,OAAAA,EAASf,aAAaC,IAAI;AAAEe,oBAAAA,SAAAA,EAAWJ,WAAWX;AAAK,iBAAA,CAAA;AACtE,gBAAA;A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CAAAA;AACbzB,gBAAAA,MAAAA,CAAOd,IAAI,CAACoC,KAAAA,CAAAA;AAChB,YAAA;AAEA,YAAA;AACJ,QAAA;QAEA,IAAIF,QAAAA,CAAStB,GAAG,CAACrB,IAAAA,CAAAA,EAAO;AACxB2C,QAAAA,QAAAA,CAASrB,GAAG,CAACtB,IAAAA,CAAAA;AAEbyC,QAAAA,IAAAA,CAAKhC,IAAI,CAACT,IAAAA,CAAAA;AACV0C,QAAAA,MAAAA,CAAOpB,GAAG,CAACtB,IAAAA,CAAAA;AACX,QAAA,KAAK,MAAMW,UAAAA,IAAcmB,kBAAAA,CAAmB9B,IAAAA,EAAMJ,OAAOmC,MAAAA,CAAAA,CAAS;YAC9Da,IAAAA,CAAKjC,UAAAA,CAAAA;AACT,QAAA;AAEA+B,QAAAA,MAAAA,CAAOS,MAAM,CAACnD,IAAAA,CAAAA;AACdyC,QAAAA,IAAAA,CAAKW,GAAG,EAAA;AACZ,IAAA,CAAA;IAEA,KAAK,MAAMpD,QAAQgC,KAAAA,CAAO;QACtBY,IAAAA,CAAK5C,IAAAA,CAAAA;AACT,IAAA;IAEA,OAAOuB,MAAAA;AACX;;;;"}
1
+ {"version":3,"file":"resolvePackageDependencies.js","sources":["../../resolvePackageDependencies.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ScenePackage } from '@cratis/scene.model';\nimport { MissingPackageDependency, PackageSelection, PackageVersionConflict } from './PackageSelection';\nimport { isVersionSatisfiedBy } from './packageVersionRange';\n\n/**\n * Expands a chosen set of package names into the complete, correctly ordered list a {@link UiProfile}\n * needs — the runtime half. The C# twin in `Cratis.Scene.Engine` implements the same algorithm for\n * Studio's package picker and Stage's build; both are asserted against the same shared fixture corpus so\n * they cannot drift apart.\n *\n * This is a different concern from `resolveComponentName`, which resolves one component *name* against\n * an already-decided package list. This decides what that list is.\n *\n * Ordering is a stable topological sort: among packages whose dependencies are equally satisfied, the one\n * the caller named first comes first, and packages pulled in transitively follow in the order they were\n * discovered. When a cycle makes ordering impossible, the packages involved are reported in `cycles` and\n * appended in discovery order rather than dropped.\n */\nexport function resolvePackageDependencies(selected: string[], catalog: ScenePackage[]): PackageSelection {\n const index = new Map(catalog.map((scenePackage) => [scenePackage.name, scenePackage]));\n const discovered: string[] = [];\n const seen = new Set<string>(selected);\n const missing: MissingPackageDependency[] = [];\n const versionConflicts: PackageVersionConflict[] = [];\n\n const pending = [...selected];\n while (pending.length > 0) {\n const name = pending.shift()!;\n discovered.push(name);\n\n const scenePackage = index.get(name);\n if (!scenePackage) continue;\n\n for (const dependency of scenePackage.dependencies) {\n const dependedOn = index.get(dependency.name);\n if (!dependedOn) {\n missing.push({ package: scenePackage.name, dependsOn: dependency.name });\n continue;\n }\n\n if (!isVersionSatisfiedBy(dependedOn.version, dependency.versionRange)) {\n versionConflicts.push({\n package: scenePackage.name,\n dependsOn: dependency.name,\n requiredRange: dependency.versionRange!,\n actualVersion: dependedOn.version,\n });\n }\n\n if (!seen.has(dependency.name)) {\n seen.add(dependency.name);\n pending.push(dependency.name);\n }\n }\n }\n\n const cycles = findCycles(discovered, index);\n const packages = topologicallyOrder(discovered, index);\n const chosen = new Set(selected);\n\n return {\n packages,\n added: packages.filter((name) => !chosen.has(name)),\n missing,\n versionConflicts,\n cycles,\n };\n}\n\nfunction dependenciesWithin(name: string, index: Map<string, ScenePackage>, within: Set<string>): string[] {\n const scenePackage = index.get(name);\n if (!scenePackage) return [];\n const names = scenePackage.dependencies.map((dependency) => dependency.name).filter((dependency) => within.has(dependency));\n return [...new Set(names)];\n}\n\n/**\n * Orders an already-closed set of package names so each follows the packages it depends on.\n */\nfunction topologicallyOrder(names: string[], index: Map<string, ScenePackage>): string[] {\n const within = new Set(names);\n const remaining = new Map(names.map((name) => [name, dependenciesWithin(name, index, within).length]));\n\n const ordered: string[] = [];\n const placed = new Set<string>();\n let progressed = true;\n while (progressed) {\n progressed = false;\n for (const name of names) {\n if (placed.has(name) || remaining.get(name) !== 0) continue;\n\n ordered.push(name);\n placed.add(name);\n progressed = true;\n\n for (const other of names) {\n if (placed.has(other)) continue;\n if (dependenciesWithin(other, index, within).includes(name)) {\n remaining.set(other, remaining.get(other)! - 1);\n }\n }\n }\n }\n\n // Anything left is inside a cycle, or downstream of one. It is reported through `cycles`; keeping it\n // in the list means a package picker never silently loses a package it was told about.\n ordered.push(...names.filter((name) => !placed.has(name)));\n return ordered;\n}\n\n/**\n * Finds every dependency cycle, walking depth-first from each package in discovery order so the result\n * is deterministic. A cycle is recorded once, keyed by the set of packages in it.\n */\nfunction findCycles(names: string[], index: Map<string, ScenePackage>): string[][] {\n const within = new Set(names);\n const cycles: string[][] = [];\n const recorded = new Set<string>();\n const path: string[] = [];\n const onPath = new Set<string>();\n const explored = new Set<string>();\n\n const walk = (name: string) => {\n if (onPath.has(name)) {\n const cycle = path.slice(path.indexOf(name));\n const key = [...cycle].sort().join(' ');\n if (!recorded.has(key)) {\n recorded.add(key);\n cycles.push(cycle);\n }\n\n return;\n }\n\n if (explored.has(name)) return;\n explored.add(name);\n\n path.push(name);\n onPath.add(name);\n for (const dependency of dependenciesWithin(name, index, within)) {\n walk(dependency);\n }\n\n onPath.delete(name);\n path.pop();\n };\n\n for (const name of names) {\n walk(name);\n }\n\n return cycles;\n}\n"],"names":["resolvePackageDependencies","selected","catalog","index","Map","map","scenePackage","name","discovered","seen","Set","missing","versionConflicts","pending","length","shift","push","get","dependency","dependencies","dependedOn","package","dependsOn","isVersionSatisfiedBy","version","versionRange","requiredRange","actualVersion","has","add","cycles","findCycles","packages","topologicallyOrder","chosen","added","filter","dependenciesWithin","within","names","remaining","ordered","placed","progressed","other","includes","set","recorded","path","onPath","explored","walk","cycle","slice","indexOf","key","sort","join","delete","pop"],"mappings":";;AAAA;AACA;AAMA;;;;;;;;;;;;;AAaC,IACM,SAASA,0BAAAA,CAA2BC,QAAkB,EAAEC,OAAuB,EAAA;AAClF,IAAA,MAAMC,QAA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CAACT,IAAAA,CAAAA;AACV0C,QAAAA,MAAAA,CAAOpB,GAAG,CAACtB,IAAAA,CAAAA;AACX,QAAA,KAAK,MAAMW,UAAAA,IAAcmB,kBAAAA,CAAmB9B,IAAAA,EAAMJ,OAAOmC,MAAAA,CAAAA,CAAS;YAC9Da,IAAAA,CAAKjC,UAAAA,CAAAA;AACT,QAAA;AAEA+B,QAAAA,MAAAA,CAAOS,MAAM,CAACnD,IAAAA,CAAAA;AACdyC,QAAAA,IAAAA,CAAKW,GAAG,EAAA;AACZ,IAAA,CAAA;IAEA,KAAK,MAAMpD,QAAQgC,KAAAA,CAAO;QACtBY,IAAAA,CAAK5C,IAAAA,CAAAA;AACT,IAAA;IAEA,OAAOuB,MAAAA;AACX;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"resolveScreenTemplates.js","sources":["../../resolveScreenTemplates.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Layout, ScreenTemplate } from '@cratis/scene.model';\n\n/**\n * Where one {@link ScreenTemplate} ended up: the slot it declared, and the layout or template that turned\n * out to declare that slot.\n */\nexport interface ScreenTemplatePlacement {\n /** The template being placed. */\n template: string;\n /** The slot name the template declared it fits. */\n slot: string;\n /** The name of the {@link Layout} or {@link ScreenTemplate} declaring that slot. */\n container: string;\n /** How far below the layout the template sits — 1 directly inside the layout, 2 inside a template that is. */\n depth: number;\n}\n\n/**\n * A template that names a slot, where the set of containers in scope does not agree on exactly one home for\n * it.\n */\nexport interface UnplacedScreenTemplate {\n /** The template that could not be placed. */\n template: string;\n /** The slot name it declared it fits. */\n slot: string;\n /**\n * The containers declaring a slot of that name. Empty when nothing declares it; more than one when the\n * name is ambiguous. Never exactly one — that case is a {@link ScreenTemplatePlacement} instead.\n */\n candidates: string[];\n}\n\n/**\n * The outcome of working out how a blueprint's templates nest inside its layout.\n */\nexport interface ScreenTemplateResolution {\n /** Every template that found exactly one home, ordered shallowest first so a caller can build the tree top-down. */\n placements: ScreenTemplatePlacement[];\n /**\n * Templates that found none or several. Reported rather than guessed: placing a template in the wrong\n * parent renders content in the wrong region, which is far harder to diagnose than being told the slot\n * name is ambiguous.\n */\n unplaced: UnplacedScreenTemplate[];\n /** Template nesting cycles — a template that transitively contains itself. */\n cycles: string[][];\n}\n\n/**\n * Whether every template found exactly one home and nothing nests inside itself.\n */\nexport function isScreenTemplateResolutionValid(resolution: ScreenTemplateResolution): boolean {\n return resolution.unplaced.length === 0 && resolution.cycles.length === 0;\n}\n\n/**\n * Works out how a blueprint's {@link ScreenTemplate}s nest inside its {@link Layout}.\n *\n * A template declares only the *name* of the slot it fits, never which container owns that slot. That is\n * what makes templates reusable — a feature's template says \"I go in the module content area\", not \"I go\n * inside this specific module\". Resolution is the step that turns those names into a tree, by finding which\n * layout or template declares each name.\n *\n * The same rule applies at every level, so nesting has no depth limit and no separate mechanism per level.\n * The C# twin in `Cratis.Scene.Engine` implements the same algorithm; both are asserted against the same\n * shared fixture corpus so they cannot drift apart.\n */\nexport function resolveScreenTemplates(layout: Layout, templates: ScreenTemplate[]): ScreenTemplateResolution {\n const containersBySlot = buildSlotIndex(layout, templates);\n const parents = new Map<string, string>();\n const slots = new Map<string, string>();\n const unplaced: UnplacedScreenTemplate[] = [];\n\n for (const template of templates) {\n if (template.fitsSlot === undefined) continue;\n\n const [qualifier, slot] = splitQualifiedSlot(template.fitsSlot);\n\n const candidates = (containersBySlot.get(slot) ?? []).filter(\n (container) => container !== template.name && (qualifier === undefined || container === qualifier)\n );\n\n if (candidates.length === 1) {\n parents.set(template.name, candidates[0]);\n slots.set(template.name, slot);\n } else {\n unplaced.push({ template: template.name, slot: template.fitsSlot, candidates });\n }\n }\n\n const cycles = findCycles(parents);\n const inCycle = new Set(cycles.flat());\n\n const placements: ScreenTemplatePlacement[] = [];\n for (const template of templates) {\n const container = parents.get(template.name);\n if (container === undefined || inCycle.has(template.name)) continue;\n\n placements.push({\n template: template.name,\n slot: slots.get(template.name)!,\n container,\n depth: depthOf(template.name, parents, layout.name),\n });\n }\n\n placements.sort((left, right) => left.depth - right.depth || left.template.localeCompare(right.template));\n\n return { placements, unplaced, cycles };\n}\n\n/**\n * Splits a `fitsSlot` into the container it names and the slot within it.\n *\n * The same rule component names use: a bare name searches, a qualified one goes straight to what it names.\n * A slot called `body` is a good name at every level of a nesting chain, so several templates legitimately\n * declare one — and a bare `body` then has no single answer. Qualifying it says which, without forcing\n * every slot in an application to carry a unique name.\n */\nfunction splitQualifiedSlot(fitsSlot: string): [string | undefined, string] {\n const lastDot = fitsSlot.lastIndexOf('.');\n return lastDot < 0 ? [undefined, fitsSlot] : [fitsSlot.substring(0, lastDot), fitsSlot.substring(lastDot + 1)];\n}\n\nfunction buildSlotIndex(layout: Layout, templates: ScreenTemplate[]): Map<string, string[]> {\n const index = new Map<string, string[]>();\n\n const declare = (slot: string, container: string) => {\n const containers = index.get(slot) ?? [];\n if (!containers.includes(container)) containers.push(container);\n index.set(slot, containers);\n };\n\n for (const slot of layout.slots) declare(slot.name, layout.name);\n for (const template of templates) {\n for (const slot of template.slots) declare(slot.name, template.name);\n }\n\n return index;\n}\n\nfunction findCycles(parents: Map<string, string>): string[][] {\n const cycles: string[][] = [];\n const recorded = new Set<string>();\n\n for (const start of [...parents.keys()].sort()) {\n const path: string[] = [];\n const onPath = new Set<string>();\n let current = start;\n\n for (;;) {\n const parent = parents.get(current);\n if (parent === undefined) break;\n\n path.push(current);\n onPath.add(current);\n if (onPath.has(parent)) {\n const cycle = path.slice(path.indexOf(parent));\n const key = [...cycle].sort().join(' ');\n if (!recorded.has(key)) {\n recorded.add(key);\n cycles.push(cycle);\n }\n\n break;\n }\n\n onPath.add(parent);\n current = parent;\n }\n }\n\n return cycles;\n}\n\nfunction depthOf(template: string, parents: Map<string, string>, layoutName: string): number {\n let depth = 0;\n let current = template;\n while (parents.has(current) && depth <= parents.size) {\n depth++;\n const parent = parents.get(current)!;\n if (parent === layoutName) break;\n current = parent;\n }\n\n return depth;\n}\n"],"names":["isScreenTemplateResolutionValid","resolution","unplaced","length","cycles","resolveScreenTemplates","layout","templates","containersBySlot","buildSlotIndex","parents","Map","slots","template","fitsSlot","undefined","qualifier","slot","splitQualifiedSlot","candidates","get","filter","container","name","set","push","findCycles","inCycle","Set","flat","placements","has","depth","depthOf","sort","left","right","localeCompare","lastDot","lastIndexOf","substring","index","declare","containers","includes","recorded","start","keys","path","onPath","current","parent","add","cycle","slice","indexOf","key","join","layoutName","size"],"mappings":"AAAA;AACA;AAmDA;;IAGO,SAASA,+BAAAA,CAAgCC,UAAoC,EAAA;IAChF,OAAOA,UAAAA,CAAWC,QAAQ,CAACC,MAAM,KAAK,KAAKF,UAAAA,CAAWG,MAAM,CAACD,MAAM,KAAK,CAAA;AAC5E;AAEA;;;;;;;;;;;AAWC,IACM,SAASE,sBAAAA,CAAuBC,MAAc,EAAEC,SAA2B,EAAA;IAC9E,MAAMC,gBAAAA,GAAmBC,eAAeH,MAAAA,EAAQC,SAAAA,CAAAA;AAChD,IAAA,MAAMG,UAAU,IAAIC,GAAAA,EAAAA;AACpB,IAAA,MAAMC,QAAQ,IAAID,GAAAA,EAAAA;AAClB,IAAA,MAAMT,WAAqC,EAAE;IAE7C,KAAK,MAAMW,YAAYN,SAAAA,CAAW;QAC9B,IAAIM,QAAAA,CAASC,QAAQ,KAAKC,SAAAA,EAAW;AAErC,QAAA,MAAM,CAACC,SAAAA,EAAWC,IAAAA,CAAK,GAAGC,kBAAAA,CAAmBL,SAASC,QAAQ,CAAA;QAE9D,MAAMK,UAAAA,GAAa,CAACX,gBAAAA,CAAiBY,GAAG,CAACH,IAAAA,CAAAA,IAAS,EAAC,EAAGI,MAAM,CACxD,CAACC,SAAAA,GAAcA,cAAcT,QAAAA,CAASU,IAAI,KAAKP,SAAAA,KAAcD,SAAAA,IAAaO,SAAAA,KAAcN,SAAQ,CAAA,CAAA;QAGpG,IAAIG,UAAAA,CAAWhB,MAAM,KAAK,CAAA,EAAG;AAC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ACd,QAAA;AACJ,IAAA;IAEA,OAAO/C,MAAAA;AACX;AAEA,SAAS6B,OAAAA,CAAQpB,QAAgB,EAAEH,OAA4B,EAAEgD,UAAkB,EAAA;AAC/E,IAAA,IAAI1B,KAAAA,GAAQ,CAAA;AACZ,IAAA,IAAIkB,OAAAA,GAAUrC,QAAAA;AACd,IAAA,MAAOH,QAAQqB,GAAG,CAACmB,YAAYlB,KAAAA,IAAStB,OAAAA,CAAQiD,IAAI,CAAE;AAClD3B,QAAAA,KAAAA,EAAAA;QACA,MAAMmB,MAAAA,GAASzC,OAAAA,CAAQU,GAAG,CAAC8B,OAAAA,CAAAA;AAC3B,QAAA,IAAIC,WAAWO,UAAAA,EAAY;QAC3BR,OAAAA,GAAUC,MAAAA;AACd,IAAA;IAEA,OAAOnB,KAAAA;AACX;;;;"}
1
+ {"version":3,"file":"resolveScreenTemplates.js","sources":["../../resolveScreenTemplates.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Layout, ScreenTemplate } from '@cratis/scene.model';\n\n/**\n * Where one {@link ScreenTemplate} ended up: the slot it declared, and the layout or template that turned\n * out to declare that slot.\n */\nexport interface ScreenTemplatePlacement {\n /** The template being placed. */\n template: string;\n /** The slot name the template declared it fits. */\n slot: string;\n /** The name of the {@link Layout} or {@link ScreenTemplate} declaring that slot. */\n container: string;\n /** How far below the layout the template sits — 1 directly inside the layout, 2 inside a template that is. */\n depth: number;\n}\n\n/**\n * A template that names a slot, where the set of containers in scope does not agree on exactly one home for\n * it.\n */\nexport interface UnplacedScreenTemplate {\n /** The template that could not be placed. */\n template: string;\n /** The slot name it declared it fits. */\n slot: string;\n /**\n * The containers declaring a slot of that name. Empty when nothing declares it; more than one when the\n * name is ambiguous. Never exactly one — that case is a {@link ScreenTemplatePlacement} instead.\n */\n candidates: string[];\n}\n\n/**\n * The outcome of working out how a blueprint's templates nest inside its layout.\n */\nexport interface ScreenTemplateResolution {\n /** Every template that found exactly one home, ordered shallowest first so a caller can build the tree top-down. */\n placements: ScreenTemplatePlacement[];\n /**\n * Templates that found none or several. Reported rather than guessed: placing a template in the wrong\n * parent renders content in the wrong region, which is far harder to diagnose than being told the slot\n * name is ambiguous.\n */\n unplaced: UnplacedScreenTemplate[];\n /** Template nesting cycles — a template that transitively contains itself. */\n cycles: string[][];\n}\n\n/**\n * Whether every template found exactly one home and nothing nests inside itself.\n */\nexport function isScreenTemplateResolutionValid(resolution: ScreenTemplateResolution): boolean {\n return resolution.unplaced.length === 0 && resolution.cycles.length === 0;\n}\n\n/**\n * Works out how a blueprint's {@link ScreenTemplate}s nest inside its {@link Layout}.\n *\n * A template declares only the *name* of the slot it fits, never which container owns that slot. That is\n * what makes templates reusable — a feature's template says \"I go in the module content area\", not \"I go\n * inside this specific module\". Resolution is the step that turns those names into a tree, by finding which\n * layout or template declares each name.\n *\n * The same rule applies at every level, so nesting has no depth limit and no separate mechanism per level.\n * The C# twin in `Cratis.Scene.Engine` implements the same algorithm; both are asserted against the same\n * shared fixture corpus so they cannot drift apart.\n */\nexport function resolveScreenTemplates(layout: Layout, templates: ScreenTemplate[]): ScreenTemplateResolution {\n const containersBySlot = buildSlotIndex(layout, templates);\n const parents = new Map<string, string>();\n const slots = new Map<string, string>();\n const unplaced: UnplacedScreenTemplate[] = [];\n\n for (const template of templates) {\n if (template.fitsSlot === undefined) continue;\n\n const [qualifier, slot] = splitQualifiedSlot(template.fitsSlot);\n\n const candidates = (containersBySlot.get(slot) ?? []).filter(\n (container) => container !== template.name && (qualifier === undefined || container === qualifier)\n );\n\n if (candidates.length === 1) {\n parents.set(template.name, candidates[0]);\n slots.set(template.name, slot);\n } else {\n unplaced.push({ template: template.name, slot: template.fitsSlot, candidates });\n }\n }\n\n const cycles = findCycles(parents);\n const inCycle = new Set(cycles.flat());\n\n const placements: ScreenTemplatePlacement[] = [];\n for (const template of templates) {\n const container = parents.get(template.name);\n if (container === undefined || inCycle.has(template.name)) continue;\n\n placements.push({\n template: template.name,\n slot: slots.get(template.name)!,\n container,\n depth: depthOf(template.name, parents, layout.name),\n });\n }\n\n placements.sort((left, right) => left.depth - right.depth || left.template.localeCompare(right.template));\n\n return { placements, unplaced, cycles };\n}\n\n/**\n * Splits a `fitsSlot` into the container it names and the slot within it.\n *\n * The same rule component names use: a bare name searches, a qualified one goes straight to what it names.\n * A slot called `body` is a good name at every level of a nesting chain, so several templates legitimately\n * declare one — and a bare `body` then has no single answer. Qualifying it says which, without forcing\n * every slot in an application to carry a unique name.\n */\nfunction splitQualifiedSlot(fitsSlot: string): [string | undefined, string] {\n const lastDot = fitsSlot.lastIndexOf('.');\n return lastDot < 0 ? [undefined, fitsSlot] : [fitsSlot.substring(0, lastDot), fitsSlot.substring(lastDot + 1)];\n}\n\nfunction buildSlotIndex(layout: Layout, templates: ScreenTemplate[]): Map<string, string[]> {\n const index = new Map<string, string[]>();\n\n const declare = (slot: string, container: string) => {\n const containers = index.get(slot) ?? [];\n if (!containers.includes(container)) containers.push(container);\n index.set(slot, containers);\n };\n\n for (const slot of layout.slots) declare(slot.name, layout.name);\n for (const template of templates) {\n for (const slot of template.slots) declare(slot.name, template.name);\n }\n\n return index;\n}\n\nfunction findCycles(parents: Map<string, string>): string[][] {\n const cycles: string[][] = [];\n const recorded = new Set<string>();\n\n for (const start of [...parents.keys()].sort()) {\n const path: string[] = [];\n const onPath = new Set<string>();\n let current = start;\n\n for (;;) {\n const parent = parents.get(current);\n if (parent === undefined) break;\n\n path.push(current);\n onPath.add(current);\n if (onPath.has(parent)) {\n const cycle = path.slice(path.indexOf(parent));\n const key = [...cycle].sort().join(' ');\n if (!recorded.has(key)) {\n recorded.add(key);\n cycles.push(cycle);\n }\n\n break;\n }\n\n onPath.add(parent);\n current = parent;\n }\n }\n\n return cycles;\n}\n\nfunction depthOf(template: string, parents: Map<string, string>, layoutName: string): number {\n let depth = 0;\n let current = template;\n while (parents.has(current) && depth <= parents.size) {\n depth++;\n const parent = parents.get(current)!;\n if (parent === layoutName) break;\n current = parent;\n }\n\n return depth;\n}\n"],"names":["isScreenTemplateResolutionValid","resolution","unplaced","length","cycles","resolveScreenTemplates","layout","templates","containersBySlot","buildSlotIndex","parents","Map","slots","template","fitsSlot","undefined","qualifier","slot","splitQualifiedSlot","candidates","get","filter","container","name","set","push","findCycles","inCycle","Set","flat","placements","has","depth","depthOf","sort","left","right","localeCompare","lastDot","lastIndexOf","substring","index","declare","containers","includes","recorded","start","keys","path","onPath","current","parent","add","cycle","slice","indexOf","key","join","layoutName","size"],"mappings":"AAAA;AACA;AAmDA;;IAGO,SAASA,+BAAAA,CAAgCC,UAAoC,EAAA;IAChF,OAAOA,UAAAA,CAAWC,QAAQ,CAACC,MAAM,KAAK,KAAKF,UAAAA,CAAWG,MAAM,CAACD,MAAM,KAAK,CAAA;AAC5E;AAEA;;;;;;;;;;;AAWC,IACM,SAASE,sBAAAA,CAAuBC,MAAc,EAAEC,SAA2B,EAAA;IAC9E,MAAMC,gBAAAA,GAAmBC,eAAeH,MAAAA,EAAQC,SAAAA,CAAAA;AAChD,IAAA,MAAMG,UAAU,IAAIC,GAAAA,EAAAA;AACpB,IAAA,MAAMC,QAAQ,IAAID,GAAAA,EAAAA;AAClB,IAAA,MAAMT,WAAqC,EAAE;IAE7C,KAAK,MAAMW,YAAYN,SAAAA,CAAW;QAC9B,IAAIM,QAAAA,CAASC,QAAQ,KAAKC,SAAAA,EAAW;AAErC,QAAA,MAAM,CAACC,SAAAA,EAAWC,IAAAA,CAAK,GAAGC,kBAAAA,CAAmBL,SAASC,QAAQ,CAAA;QAE9D,MAAMK,UAAAA,GAAa,CAACX,gBAAAA,CAAiBY,GAAG,CAACH,IAAAA,CAAAA,IAAS,EAAC,EAAGI,MAAM,CACxD,CAACC,SAAAA,GAAcA,cAAcT,QAAAA,CAASU,IAAI,KAAKP,SAAAA,KAAcD,SAAAA,IAAaO,SAAAA,KAAcN,SAAQ,CAAA,CAAA;QAGpG,IAAIG,UAAAA,CA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AA;YACXD,OAAAA,GAAUC,MAAAA;AACd,QAAA;AACJ,IAAA;IAEA,OAAO/C,MAAAA;AACX;AAEA,SAAS6B,OAAAA,CAAQpB,QAAgB,EAAEH,OAA4B,EAAEgD,UAAkB,EAAA;AAC/E,IAAA,IAAI1B,KAAAA,GAAQ,CAAA;AACZ,IAAA,IAAIkB,OAAAA,GAAUrC,QAAAA;AACd,IAAA,MAAOH,QAAQqB,GAAG,CAACmB,YAAYlB,KAAAA,IAAStB,OAAAA,CAAQiD,IAAI,CAAE;AAClD3B,QAAAA,KAAAA,EAAAA;QACA,MAAMmB,MAAAA,GAASzC,OAAAA,CAAQU,GAAG,CAAC8B,OAAAA,CAAAA;AAC3B,QAAA,IAAIC,WAAWO,UAAAA,EAAY;QAC3BR,OAAAA,GAAUC,MAAAA;AACd,IAAA;IAEA,OAAOnB,KAAAA;AACX;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"themeCompatibility.js","sources":["../../themeCompatibility.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Theme, UiProfile } from '@cratis/scene.model';\n\n/**\n * Finds the packages a {@link UiProfile} declares that a {@link Theme} is not declared compatible with -\n * part of Cratis/Scene#5, the same rule Screenplay's compiler already applies to warn on an incompatible\n * `ui profile`/`theme` pairing, reused here so `Scene.React` knows which packages to actually apply a\n * theme's tokens to, and so Studio's design-time tooling and Stage's build-time checks don't each\n * reimplement it. There is deliberately no implicit exemption for `core`: a theme wanting broad\n * applicability declares `compatible with core` itself, exactly like the profile/package resolver has no\n * implicit special case for it either.\n *\n * @param theme The {@link Theme} to check.\n * @param profile The {@link UiProfile} whose packages to check against.\n * @returns The packages in `profile.packages` that `theme` does not declare compatibility with.\n */\nexport function incompatiblePackages(theme: Theme, profile: UiProfile): string[] {\n return profile.packages.filter(package_ => !theme.compatibleWith.includes(package_));\n}\n\n/**\n * Whether a {@link Theme} is compatible with every package a {@link UiProfile} declares.\n *\n * @param theme The {@link Theme} to check.\n * @param profile The {@link UiProfile} whose packages to check against.\n * @returns `true` when `theme` declares compatibility with every package `profile` lists.\n */\nexport function isThemeCompatible(theme: Theme, profile: UiProfile): boolean {\n return incompatiblePackages(theme, profile).length === 0;\n}\n\n/**\n * Finds the packages a {@link Theme}'s tokens actually apply to for a given {@link UiProfile} - the\n * packages the profile activates that the theme also declares compatibility with. This is what a\n * renderer scopes token application to, rather than applying a theme's tokens globally - and is\n * recomputed on every theme switch for the live re-resolution Cratis/Scene#5 requires (no reload).\n *\n * @param theme The {@link Theme} to apply.\n * @param profile The active {@link UiProfile}.\n * @returns The packages both active in `profile` and declared compatible by `theme`.\n */\nexport function applicableThemePackages(theme: Theme, profile: UiProfile): string[] {\n return profile.packages.filter(package_ => theme.compatibleWith.includes(package_));\n}\n"],"names":["incompatiblePackages","theme","profile","packages","filter","package_","compatibleWith","includes","isThemeCompatible","length","applicableThemePackages"],"mappings":"AAAA;AACA;AAIA;;;;;;;;;;;;AAYC,IACM,SAASA,oBAAAA,CAAqBC,KAAY,EAAEC,OAAkB,EAAA;AACjE,IAAA,OAAOA,OAAAA,CAAQC,QAAQ,CAACC,MAAM,CAACC,CAAAA,QAAAA,GAAY,CAACJ,KAAAA,CAAMK,cAAc,CAACC,QAAQ,CAACF,QAAAA,CAAAA,CAAAA;AAC9E;AAEA;;;;;;AAMC,IACM,SAASG,iBAAAA,CAAkBP,KAAY,EAAEC,OAAkB,EAAA;AAC9D,IAAA,OAAOF,oBAAAA,CAAqBC,KAAAA,EAAOC,OAAAA,CAAAA,CAASO,MAAM,KAAK,CAAA;AAC3D;AAEA;;;;;;;;;AASC,IACM,SAASC,uBAAAA,CAAwBT,KAAY,EAAEC,OAAkB,EAAA;IACpE,OAAOA,OAAAA,CAAQC,QAAQ,CAACC,MAAM,CAACC,CAAAA,QAAAA,GAAYJ,KAAAA,CAAMK,cAAc,CAACC,QAAQ,CAACF,QAAAA,CAAAA,CAAAA;AAC7E;;;;"}
1
+ {"version":3,"file":"themeCompatibility.js","sources":["../../themeCompatibility.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Theme, UiProfile } from '@cratis/scene.model';\n\n/**\n * Finds the packages a {@link UiProfile} declares that a {@link Theme} is not declared compatible with -\n * part of Cratis/Scene#5, the same rule Screenplay's compiler already applies to warn on an incompatible\n * `ui profile`/`theme` pairing, reused here so `Scene.React` knows which packages to actually apply a\n * theme's tokens to, and so Studio's design-time tooling and Stage's build-time checks don't each\n * reimplement it. There is deliberately no implicit exemption for `core`: a theme wanting broad\n * applicability declares `compatible with core` itself, exactly like the profile/package resolver has no\n * implicit special case for it either.\n *\n * @param theme The {@link Theme} to check.\n * @param profile The {@link UiProfile} whose packages to check against.\n * @returns The packages in `profile.packages` that `theme` does not declare compatibility with.\n */\nexport function incompatiblePackages(theme: Theme, profile: UiProfile): string[] {\n return profile.packages.filter(package_ => !theme.compatibleWith.includes(package_));\n}\n\n/**\n * Whether a {@link Theme} is compatible with every package a {@link UiProfile} declares.\n *\n * @param theme The {@link Theme} to check.\n * @param profile The {@link UiProfile} whose packages to check against.\n * @returns `true` when `theme` declares compatibility with every package `profile` lists.\n */\nexport function isThemeCompatible(theme: Theme, profile: UiProfile): boolean {\n return incompatiblePackages(theme, profile).length === 0;\n}\n\n/**\n * Finds the packages a {@link Theme}'s tokens actually apply to for a given {@link UiProfile} - the\n * packages the profile activates that the theme also declares compatibility with. This is what a\n * renderer scopes token application to, rather than applying a theme's tokens globally - and is\n * recomputed on every theme switch for the live re-resolution Cratis/Scene#5 requires (no reload).\n *\n * @param theme The {@link Theme} to apply.\n * @param profile The active {@link UiProfile}.\n * @returns The packages both active in `profile` and declared compatible by `theme`.\n */\nexport function applicableThemePackages(theme: Theme, profile: UiProfile): string[] {\n return profile.packages.filter(package_ => theme.compatibleWith.includes(package_));\n}\n"],"names":["incompatiblePackages","theme","profile","packages","filter","package_","compatibleWith","includes","isThemeCompatible","length","applicableThemePackages"],"mappings":"AAAA;AACA;AAIA;;;;;;;;;;;;AAYC,IACM,SAASA,oBAAAA,CAAqBC,KAAY,EAAEC,OAAkB,EAAA;AACjE,IAAA,OAAOA,OAAAA,CAAQC,QAAQ,CAACC,MAAM,CAACC,CAAAA,QAAAA,GAAY,CAACJ,KAAAA,CAAMK,cAAc,CAACC,QAAQ,CAACF,QAAAA,CAAAA,CAAAA;AAC9E;AAEA;;;;;;AAMC,IACM,SAASG,iBAAAA,CAAkBP,KAAY,EAAEC,OAAkB,EAAA;AAC9D,IAAA,OAAOF,oBAAAA,CAAqBC,KAAAA,EAAOC,OAAAA,CAAAA,CAASO,MAAM,KAAK,CAAA;AAC3D;AAEA;;;;;;;;;AASC,IACM,SAASC,uBAAAA,CAAwBT,KAAY,EAAEC,OAAkB,EAAA;IACpE,OAAOA,OAAAA,CAAQC,QAAQ,CAACC,MAAM,CAACC,CAAAA,QAAAA,GAAYJ,KAAAA,CAAMK,cAAc,CAACC,QAAQ,CAACF,QAAAA,CAAAA,CAAAA;AAC7E;;"}