@ultrst-armada/floks 1.2.7 → 1.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultrst-armada/floks",
3
- "version": "1.2.7",
3
+ "version": "1.2.8",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -504,4 +504,21 @@ declare const FLOKS_CANONICAL_CONTRACT: {
504
504
  validateCompatibility: (themePack: ThemePack) => ThemeValidationResult;
505
505
  };
506
506
 
507
- export { type ComponentThemeContract, ComponentThemeContractSchema, type ContractDiffResult, FLOKS_CANONICAL_CONTRACT, FLOKS_COMPONENT_REGISTRY, FLOKS_PUBLIC_SYMBOLS, type FloksContractSnapshot, FloksContractSnapshotSchema, type ThemePack, ThemePackSchema, type ThemePackSlotBinding, ThemePackSlotBindingSchema, type ThemePackStateMapping, ThemePackStateMappingSchema, type ThemeTarget, ThemeTargetSchema, type ThemeValidationResult, type VisualParameter, VisualParameterSchema, type VisualSlot, VisualSlotSchema, type VisualState, VisualStateSchema, createFloksSnapshot, diffContractSnapshots, getComponentContract, listComponentContracts, loadThemePack, validateThemePackAgainstContract };
507
+ interface FrnlThemeState {
508
+ visualParameters: Record<string, string | number | boolean>;
509
+ }
510
+ interface FrnlThemeDefinition {
511
+ themeId: string;
512
+ name: string;
513
+ target: {
514
+ componentId: string;
515
+ componentVersion: string;
516
+ contractVersion: string;
517
+ };
518
+ states: Record<string, FrnlThemeState>;
519
+ baseVisualParameters: Record<string, string | number | boolean>;
520
+ }
521
+ /** Convert a validated Floks ThemePack to FrnlTS component/state visual parameters. */
522
+ declare function themePackToFrnlTheme(themePack: ThemePack): FrnlThemeDefinition;
523
+
524
+ export { type ComponentThemeContract, ComponentThemeContractSchema, type ContractDiffResult, FLOKS_CANONICAL_CONTRACT, FLOKS_COMPONENT_REGISTRY, FLOKS_PUBLIC_SYMBOLS, type FloksContractSnapshot, FloksContractSnapshotSchema, type FrnlThemeDefinition, type FrnlThemeState, type ThemePack, ThemePackSchema, type ThemePackSlotBinding, ThemePackSlotBindingSchema, type ThemePackStateMapping, ThemePackStateMappingSchema, type ThemeTarget, ThemeTargetSchema, type ThemeValidationResult, type VisualParameter, VisualParameterSchema, type VisualSlot, VisualSlotSchema, type VisualState, VisualStateSchema, createFloksSnapshot, diffContractSnapshots, getComponentContract, listComponentContracts, loadThemePack, themePackToFrnlTheme, validateThemePackAgainstContract };
@@ -466,6 +466,30 @@ var FLOKS_CANONICAL_CONTRACT = {
466
466
  getSnapshot: () => createFloksSnapshot("1.1.1"),
467
467
  validateCompatibility: (themePack) => validateThemePackAgainstContract(themePack)
468
468
  };
469
+
470
+ // src/frnlThemeAdapter.ts
471
+ function themePackToFrnlTheme(themePack) {
472
+ const states = {};
473
+ for (const mapping of themePack.states) {
474
+ states[mapping.stateId] = {
475
+ visualParameters: {
476
+ ...themePack.parameters,
477
+ ...mapping.parameterOverrides
478
+ }
479
+ };
480
+ }
481
+ return {
482
+ themeId: themePack.themeId,
483
+ name: themePack.name,
484
+ target: {
485
+ componentId: themePack.target.componentId,
486
+ componentVersion: themePack.target.componentVersion,
487
+ contractVersion: themePack.target.contractVersion
488
+ },
489
+ states,
490
+ baseVisualParameters: { ...themePack.parameters }
491
+ };
492
+ }
469
493
  export {
470
494
  ComponentThemeContractSchema,
471
495
  FLOKS_CANONICAL_CONTRACT,
@@ -484,5 +508,6 @@ export {
484
508
  getComponentContract,
485
509
  listComponentContracts,
486
510
  loadThemePack,
511
+ themePackToFrnlTheme,
487
512
  validateThemePackAgainstContract
488
513
  };