@chili-publish/studio-sdk 1.44.1 → 1.46.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 (113) hide show
  1. package/_bundles/main.js +2 -2
  2. package/_bundles/main.js.map +1 -1
  3. package/lib/src/controllers/BrandKitController.cjs.js +13 -64
  4. package/lib/src/controllers/BrandKitController.cjs.js.map +1 -1
  5. package/lib/src/controllers/BrandKitController.d.ts +22 -30
  6. package/lib/src/controllers/BrandKitController.es.js +13 -64
  7. package/lib/src/controllers/BrandKitController.es.js.map +1 -1
  8. package/lib/src/controllers/ComponentController.cjs.js +4 -0
  9. package/lib/src/controllers/ComponentController.cjs.js.map +1 -1
  10. package/lib/src/controllers/ComponentController.d.ts +7 -1
  11. package/lib/src/controllers/ComponentController.es.js +4 -0
  12. package/lib/src/controllers/ComponentController.es.js.map +1 -1
  13. package/lib/src/controllers/ConnectorController.cjs.js.map +1 -1
  14. package/lib/src/controllers/ConnectorController.d.ts +5 -5
  15. package/lib/src/controllers/ConnectorController.es.js.map +1 -1
  16. package/lib/src/controllers/SubscriberController.cjs.js +3 -0
  17. package/lib/src/controllers/SubscriberController.cjs.js.map +1 -1
  18. package/lib/src/controllers/SubscriberController.d.ts +7 -0
  19. package/lib/src/controllers/SubscriberController.es.js +3 -0
  20. package/lib/src/controllers/SubscriberController.es.js.map +1 -1
  21. package/lib/src/exceptions/AsyncExceptions.cjs.js.map +1 -1
  22. package/lib/src/exceptions/AsyncExceptions.d.ts +1 -0
  23. package/lib/src/exceptions/AsyncExceptions.es.js.map +1 -1
  24. package/lib/src/exceptions/Helpers.cjs.js.map +1 -1
  25. package/lib/src/exceptions/Helpers.es.js.map +1 -1
  26. package/lib/src/index.cjs.js +3 -2
  27. package/lib/src/index.cjs.js.map +1 -1
  28. package/lib/src/index.d.ts +2 -1
  29. package/lib/src/index.es.js +2 -1
  30. package/lib/src/interactions/Connector.cjs.js +2 -1
  31. package/lib/src/interactions/Connector.cjs.js.map +1 -1
  32. package/lib/src/interactions/Connector.d.ts +1 -0
  33. package/lib/src/interactions/Connector.es.js +2 -1
  34. package/lib/src/interactions/Connector.es.js.map +1 -1
  35. package/lib/src/next/NextInitiator.cjs.js +0 -2
  36. package/lib/src/next/NextInitiator.cjs.js.map +1 -1
  37. package/lib/src/next/NextInitiator.d.ts +0 -2
  38. package/lib/src/next/NextInitiator.es.js +0 -2
  39. package/lib/src/next/NextInitiator.es.js.map +1 -1
  40. package/lib/src/next/index.d.ts +0 -1
  41. package/lib/src/sdk/editor-engine.json.cjs.js +1 -1
  42. package/lib/src/sdk/editor-engine.json.es.js +1 -1
  43. package/lib/src/sdk/package.json.cjs.js +1 -1
  44. package/lib/src/sdk/package.json.es.js +1 -1
  45. package/lib/src/sdk.cjs.js +118 -79
  46. package/lib/src/sdk.cjs.js.map +1 -1
  47. package/lib/src/sdk.d.ts +52 -34
  48. package/lib/src/sdk.es.js +118 -79
  49. package/lib/src/sdk.es.js.map +1 -1
  50. package/lib/src/types/BrandKitTypes.d.ts +70 -108
  51. package/lib/src/types/ColorStyleTypes.cjs.js +10 -0
  52. package/lib/src/types/ColorStyleTypes.cjs.js.map +1 -1
  53. package/lib/src/types/ColorStyleTypes.es.js +10 -0
  54. package/lib/src/types/ColorStyleTypes.es.js.map +1 -1
  55. package/lib/src/types/CommonTypes.cjs.js +1 -0
  56. package/lib/src/types/CommonTypes.cjs.js.map +1 -1
  57. package/lib/src/types/CommonTypes.d.ts +12 -1
  58. package/lib/src/types/CommonTypes.es.js +1 -0
  59. package/lib/src/types/CommonTypes.es.js.map +1 -1
  60. package/lib/src/types/ComponentGridTypes.cjs.js.map +1 -1
  61. package/lib/src/types/ComponentGridTypes.es.js.map +1 -1
  62. package/lib/src/types/ConnectorTypes.cjs.js +6 -2
  63. package/lib/src/types/ConnectorTypes.cjs.js.map +1 -1
  64. package/lib/src/types/ConnectorTypes.d.ts +10 -1
  65. package/lib/src/types/ConnectorTypes.es.js +6 -2
  66. package/lib/src/types/ConnectorTypes.es.js.map +1 -1
  67. package/lib/src/types/FrameTypes.cjs.js.map +1 -1
  68. package/lib/src/types/FrameTypes.d.ts +2 -4
  69. package/lib/src/types/FrameTypes.es.js.map +1 -1
  70. package/lib/src/types/MethodInvocationTypes.d.ts +27 -0
  71. package/lib/src/types/RichTextRuleTypes.cjs.js.map +1 -1
  72. package/lib/src/types/RichTextRuleTypes.es.js.map +1 -1
  73. package/lib/src/types/ShapeTypes.cjs.js +1 -0
  74. package/lib/src/types/ShapeTypes.cjs.js.map +1 -1
  75. package/lib/src/types/ShapeTypes.d.ts +12 -2
  76. package/lib/src/types/ShapeTypes.es.js +1 -0
  77. package/lib/src/types/ShapeTypes.es.js.map +1 -1
  78. package/lib/src/utils/ConfigHelper.cjs.js +4 -0
  79. package/lib/src/utils/ConfigHelper.cjs.js.map +1 -1
  80. package/lib/src/utils/ConfigHelper.es.js +4 -0
  81. package/lib/src/utils/ConfigHelper.es.js.map +1 -1
  82. package/lib/src/utils/EngineEventTrigger.cjs.js +4 -1
  83. package/lib/src/utils/EngineEventTrigger.cjs.js.map +1 -1
  84. package/lib/src/utils/EngineEventTrigger.d.ts +2 -1
  85. package/lib/src/utils/EngineEventTrigger.es.js +5 -2
  86. package/lib/src/utils/EngineEventTrigger.es.js.map +1 -1
  87. package/lib/src/utils/MethodInstrumentation.cjs.js +176 -0
  88. package/lib/src/utils/MethodInstrumentation.cjs.js.map +1 -0
  89. package/lib/src/utils/MethodInstrumentation.d.ts +10 -0
  90. package/lib/src/utils/MethodInstrumentation.es.js +176 -0
  91. package/lib/src/utils/MethodInstrumentation.es.js.map +1 -0
  92. package/lib/src/utils/SdkEvent.cjs.js +29 -0
  93. package/lib/src/utils/SdkEvent.cjs.js.map +1 -0
  94. package/lib/src/utils/SdkEvent.d.ts +13 -0
  95. package/lib/src/utils/SdkEvent.es.js +29 -0
  96. package/lib/src/utils/SdkEvent.es.js.map +1 -0
  97. package/lib/src/utils/SdkEvents.cjs.js +11 -0
  98. package/lib/src/utils/SdkEvents.cjs.js.map +1 -0
  99. package/lib/src/utils/SdkEvents.d.ts +19 -0
  100. package/lib/src/utils/SdkEvents.es.js +11 -0
  101. package/lib/src/utils/SdkEvents.es.js.map +1 -0
  102. package/package.json +1 -1
  103. package/lib/src/next/controllers/BrandKitController.cjs.js +0 -34
  104. package/lib/src/next/controllers/BrandKitController.cjs.js.map +0 -1
  105. package/lib/src/next/controllers/BrandKitController.d.ts +0 -24
  106. package/lib/src/next/controllers/BrandKitController.es.js +0 -34
  107. package/lib/src/next/controllers/BrandKitController.es.js.map +0 -1
  108. package/lib/src/next/types/BrandKitTypes.d.ts +0 -52
  109. package/lib/src/utils/BrandKitAdapter.cjs.js +0 -42
  110. package/lib/src/utils/BrandKitAdapter.cjs.js.map +0 -1
  111. package/lib/src/utils/BrandKitAdapter.d.ts +0 -9
  112. package/lib/src/utils/BrandKitAdapter.es.js +0 -42
  113. package/lib/src/utils/BrandKitAdapter.es.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.es.js","sources":["../../src/sdk.ts"],"sourcesContent":["import { Connection } from 'penpal';\nimport engineInfo from '../editor-engine.json';\nimport packageInfo from '../package.json';\nimport Connect from './interactions/Connector';\nimport { defaultStudioOptions, WellKnownConfigurationKeys } from './types/ConfigurationTypes';\n\nimport type { ConfigType, EditorAPI, RuntimeConfigType } from './types/CommonTypes';\nimport { DocumentType } from './types/DocumentTypes';\n\nimport { ActionController } from './controllers/ActionController';\nimport { AnimationController } from './controllers/AnimationController';\nimport { BarcodeController } from './controllers/BarcodeController';\nimport { BrandKitController } from './controllers/BrandKitController';\nimport { CanvasController } from './controllers/CanvasController';\nimport { CharacterStyleController } from './controllers/CharacterStyleController';\nimport { ClipboardController } from './controllers/ClipboardController';\nimport { ColorConversionController } from './controllers/ColorConversionController';\nimport { ColorStyleController } from './controllers/ColorStyleController';\nimport { ConfigurationController } from './controllers/ConfigurationController';\nimport { ConnectorController } from './controllers/ConnectorController';\nimport { DataConnectorController } from './controllers/DataConnectorController';\nimport { DataSourceController } from './controllers/DataSourceController';\nimport { DebugController } from './controllers/DebugController';\nimport { DocumentController } from './controllers/DocumentController';\nimport { ExperimentController } from './controllers/ExperimentController';\nimport { FontConnectorController } from './controllers/FontConnectorController';\nimport { FontController } from './controllers/FontController';\nimport { FrameController } from './controllers/FrameController';\nimport { InfoController } from './controllers/InfoController';\nimport { LayoutController } from './controllers/LayoutController';\nimport { MediaConnectorController } from './controllers/MediaConnectorController';\nimport { PageController } from './controllers/PageController';\nimport { ParagraphStyleController } from './controllers/ParagraphStyleController';\nimport { ShapeController } from './controllers/ShapeController';\nimport { SubscriberController } from './controllers/SubscriberController';\nimport { TextStyleController } from './controllers/TextStyleController';\nimport { ToolController } from './controllers/ToolController';\nimport { UndoManagerController } from './controllers/UndoManagerController';\nimport { UtilsController } from './controllers/UtilsController';\nimport { VariableController } from './controllers/VariableController';\nimport { NextSubscribers } from './next';\nimport { NextInitiator } from './next/NextInitiator';\nimport { ConfigHelper } from './utils/ConfigHelper';\nimport { DataItemMappingTools } from './utils/DataItemMappingTools';\nimport { LocalConfigurationDecorator } from './utils/LocalConfigurationDecorator';\nimport { GradientStyleController } from './controllers/GradientStyleController';\nimport { ComponentConnectorController } from './controllers/ComponentConnectorController';\nimport { ComponentController } from './controllers/ComponentController';\nimport { ComponentGridController } from './controllers/ComponentGridController';\n\ndeclare const __ENGINE_DOMAIN__: string;\nconst ENGINE_DOMAIN = typeof __ENGINE_DOMAIN__ !== 'undefined' ? __ENGINE_DOMAIN__ : 'studio-cdn.chiligrafx.com';\nconst FIXED_EDITOR_LINK = `https://${ENGINE_DOMAIN}/editor/${engineInfo.current}/web`;\n\nlet connection: Connection;\n\nexport class SDK {\n config: RuntimeConfigType;\n connection: Connection;\n\n /**\n * @ignore\n */\n editorAPI: EditorAPI;\n\n action: ActionController;\n layout: LayoutController;\n frame: FrameController;\n shape: ShapeController;\n barcode: BarcodeController;\n /** @experimental */\n component: ComponentController;\n connector: ConnectorController;\n mediaConnector: MediaConnectorController;\n fontConnector: FontConnectorController;\n /**\n * @experimental This controller is still experimental and might change in future releases.\n */\n componentConnector: ComponentConnectorController;\n dataConnector: DataConnectorController;\n dataSource: DataSourceController;\n animation: AnimationController;\n document: DocumentController;\n configuration: ConfigurationController;\n variable: VariableController;\n utils: UtilsController;\n tool: ToolController;\n page: PageController;\n debug: DebugController;\n undoManager: UndoManagerController;\n textSelection: TextStyleController;\n paragraphStyle: ParagraphStyleController;\n characterStyle: CharacterStyleController;\n colorStyle: ColorStyleController;\n gradientStyle: GradientStyleController;\n font: FontController;\n experiment: ExperimentController;\n canvas: CanvasController;\n colorConversion: ColorConversionController;\n info: InfoController;\n clipboard: ClipboardController;\n brandKit: BrandKitController;\n componentGrid: ComponentGridController;\n next: NextInitiator;\n\n private subscriber: SubscriberController;\n private enabledNextSubscribers: NextSubscribers | undefined;\n private localConfig = new Map<string, string>();\n private dataItemMappingTools = new DataItemMappingTools();\n\n /**\n * The SDK should be configured clientside and it exposes all controllers to work with in other applications\n * @param config The configuration object where the SDK and editor can get configured\n */\n constructor(config: ConfigType) {\n this.config = ConfigHelper.createRuntimeConfig(config);\n\n this.connection = connection;\n this.editorAPI = connection?.promise.then((child) => {\n return child;\n }) as unknown as EditorAPI;\n\n this.action = new ActionController(this.editorAPI);\n this.layout = new LayoutController(this.editorAPI);\n this.frame = new FrameController(this.editorAPI);\n this.shape = new ShapeController(this.editorAPI);\n this.barcode = new BarcodeController(this.editorAPI);\n this.component = new ComponentController(this.editorAPI);\n this.undoManager = new UndoManagerController(this.editorAPI, this);\n this.connector = new ConnectorController(this.editorAPI, this.localConfig);\n this.mediaConnector = new MediaConnectorController(this.editorAPI);\n this.fontConnector = new FontConnectorController(this.editorAPI);\n this.componentConnector = new ComponentConnectorController(this.editorAPI);\n this.dataConnector = new DataConnectorController(this.editorAPI, this.dataItemMappingTools);\n this.dataSource = new DataSourceController(this.editorAPI, this.dataItemMappingTools);\n this.animation = new AnimationController(this.editorAPI);\n this.document = new DocumentController(this.editorAPI);\n\n this.configuration = new LocalConfigurationDecorator(this.editorAPI, this.localConfig);\n this.variable = new VariableController(this.editorAPI, this.dataItemMappingTools);\n this.utils = new UtilsController(this.editorAPI, this.localConfig);\n this.subscriber = new SubscriberController(this.config, this.localConfig);\n this.tool = new ToolController(this.editorAPI);\n this.page = new PageController(this.editorAPI);\n this.debug = new DebugController(this.editorAPI);\n // To be renamed textSelection > textStyle\n this.textSelection = new TextStyleController(this.editorAPI);\n this.colorStyle = new ColorStyleController(this.editorAPI);\n this.gradientStyle = new GradientStyleController(this.editorAPI);\n this.paragraphStyle = new ParagraphStyleController(this.editorAPI);\n this.characterStyle = new CharacterStyleController(this.editorAPI);\n this.font = new FontController(this.editorAPI);\n this.experiment = new ExperimentController(this.editorAPI);\n this.canvas = new CanvasController(this.editorAPI);\n this.colorConversion = new ColorConversionController(this.editorAPI);\n this.info = new InfoController();\n this.clipboard = new ClipboardController(this.editorAPI);\n this.next = new NextInitiator(this.config, this.connection, this.editorAPI);\n this.enabledNextSubscribers = this.config.enableNextSubscribers;\n this.brandKit = new BrandKitController(this.editorAPI, this);\n this.componentGrid = new ComponentGridController(this.editorAPI);\n }\n\n /**\n * This method will initiate the editor, running this will result in the editor restarting\n * It will generate an iframe in the document\n */\n loadEditor = () => {\n Connect(\n this.config.editorLink || FIXED_EDITOR_LINK,\n {\n onActionsChanged: this.subscriber.onActionsChanged,\n onStateChanged: this.subscriber.onStateChanged,\n onAuthExpired: this.subscriber.onAuthExpired,\n onViewportRequested: this.subscriber.onViewportRequested,\n onDocumentLoaded: this.subscriber.onDocumentLoaded,\n onSelectedFramesContentChanged: this.subscriber.onSelectedFramesContentChanged,\n onSelectedFramesLayoutChanged: this.subscriber.onSelectedFramesLayoutChanged,\n onFramesLayoutChanged: this.subscriber.onFramesLayoutChanged,\n onSelectedLayoutPropertiesChanged: this.subscriber.onSelectedLayoutPropertiesChanged,\n onSelectedLayoutUnitChanged: this.subscriber.onSelectedLayoutUnitChanged,\n onPageSelectionChanged: this.subscriber.onPageSelectionChanged,\n onScrubberPositionChanged: this.subscriber.onAnimationPlaybackChanged,\n onFrameAnimationsChanged: this.subscriber.onAnimationChanged,\n onVariableListChanged: (state) => {\n if (this.enabledNextSubscribers?.onVariableListChanged) {\n this.next.subscriber.onVariableListChanged(state);\n } else {\n this.subscriber.onVariableListChanged(state);\n }\n },\n onSelectedToolChanged: this.subscriber.onSelectedToolChanged,\n onUndoStateChanged: this.subscriber.onUndoStateChanged,\n onSelectedLayoutFramesChanged: this.subscriber.onSelectedLayoutFramesChanged,\n onSelectedTextStyleChanged: this.subscriber.onSelectedTextStyleChanged,\n onColorsChanged: this.subscriber.onColorsChanged,\n onParagraphStylesChanged: this.subscriber.onParagraphStylesChanged,\n onCharacterStylesChanged: this.subscriber.onCharacterStylesChanged,\n onFontFamiliesChanged: this.subscriber.onFontFamiliesChanged,\n onSelectedLayoutIdChanged: this.subscriber.onSelectedLayoutIdChanged,\n onLayoutsChanged: this.subscriber.onLayoutsChanged,\n onConnectorEvent: this.subscriber.onConnectorEvent,\n onConnectorsChanged: (state) => {\n if (this.enabledNextSubscribers?.onConnectorsChanged) {\n this.next.subscriber.onConnectorsChanged(state);\n } else {\n this.subscriber.onConnectorsChanged(state);\n }\n },\n onZoomChanged: this.subscriber.onZoomChanged,\n onSelectedPageIdChanged: this.subscriber.onSelectedPageIdChanged,\n onPagesChanged: this.subscriber.onPagesChanged,\n onPageSnapshotInvalidated: this.subscriber.onPageSnapshotInvalidated,\n onPageSizeChanged: (state) => {\n if (this.enabledNextSubscribers?.onPageSizeChanged) {\n this.next.subscriber.onPageSizeChanged(state);\n } else {\n this.subscriber.onPageSizeChanged(state);\n }\n },\n onShapeCornerRadiusChanged: this.subscriber.onShapeCornerRadiusChanged,\n onCropActiveFrameIdChanged: this.subscriber.onCropActiveFrameIdChanged,\n onAsyncError: this.subscriber.onAsyncError,\n onViewModeChanged: this.subscriber.onViewModeChanged,\n onBarcodeValidationChanged: this.subscriber.onBarcodeValidationChanged,\n onDataSourceIdChanged: this.subscriber.onDataSourceIdChanged,\n onInjectedDataChanged: this.subscriber.onInjectedDataChanged,\n onDocumentIssueListChanged: this.subscriber.onDocumentIssueListChanged,\n onCustomUndoDataChanged: this.subscriber.onCustomUndoDataChanged,\n onEngineEditModeChanged: this.subscriber.onEngineEditModeChanged,\n onBrandKitMediaChanged: this.subscriber.onBrandKitMediaChanged,\n },\n this.setConnection,\n this.config.editorId,\n this.config.studioStyling,\n (error) => {\n this.config.onConnectionError?.(error);\n },\n );\n this.editorAPI = connection?.promise.then((editorAPI) => {\n return editorAPI;\n }) as unknown as EditorAPI;\n\n this.action = new ActionController(this.editorAPI);\n this.layout = new LayoutController(this.editorAPI);\n this.frame = new FrameController(this.editorAPI);\n this.barcode = new BarcodeController(this.editorAPI);\n this.component = new ComponentController(this.editorAPI);\n this.animation = new AnimationController(this.editorAPI);\n this.document = new DocumentController(this.editorAPI);\n this.configuration = new LocalConfigurationDecorator(this.editorAPI, this.localConfig);\n this.utils = new UtilsController(this.editorAPI, this.localConfig);\n this.tool = new ToolController(this.editorAPI);\n this.page = new PageController(this.editorAPI);\n this.debug = new DebugController(this.editorAPI);\n this.undoManager = new UndoManagerController(this.editorAPI, this);\n this.textSelection = new TextStyleController(this.editorAPI);\n this.colorStyle = new ColorStyleController(this.editorAPI);\n this.gradientStyle = new GradientStyleController(this.editorAPI);\n this.paragraphStyle = new ParagraphStyleController(this.editorAPI);\n this.characterStyle = new CharacterStyleController(this.editorAPI);\n this.mediaConnector = new MediaConnectorController(this.editorAPI);\n this.fontConnector = new FontConnectorController(this.editorAPI);\n this.componentConnector = new ComponentConnectorController(this.editorAPI);\n this.dataConnector = new DataConnectorController(this.editorAPI, this.dataItemMappingTools);\n this.dataSource = new DataSourceController(this.editorAPI, this.dataItemMappingTools);\n this.connector = new ConnectorController(this.editorAPI, this.localConfig);\n this.variable = new VariableController(this.editorAPI, this.dataItemMappingTools);\n this.font = new FontController(this.editorAPI);\n this.experiment = new ExperimentController(this.editorAPI);\n this.canvas = new CanvasController(this.editorAPI);\n this.shape = new ShapeController(this.editorAPI);\n this.colorConversion = new ColorConversionController(this.editorAPI);\n this.info = new InfoController();\n this.clipboard = new ClipboardController(this.editorAPI);\n this.brandKit = new BrandKitController(this.editorAPI, this);\n this.componentGrid = new ComponentGridController(this.editorAPI);\n this.next = new NextInitiator(this.config, this.connection, this.editorAPI);\n\n // as soon as the editor loads, provide it with the SDK version\n // used to make it start. This enables engine compatibility checks\n // on the Flutter side\n this.configuration.setValue(WellKnownConfigurationKeys.GraFxStudioSdkVersion, packageInfo.version);\n\n // Makes the engine aware which document type it should render, if this call\n // isn't made, the engine will fall back to the type specified in the document.\n //\n // Loading a template JSON and setting the engine to `project` will cause\n // the document JSON structure to be converted to a project on save.\n // Using `getCurrentDocumentState` will also output the converted document.\n this.configuration.setValue(\n WellKnownConfigurationKeys.GraFxStudioDocumentType,\n this.config.documentType || DocumentType.template,\n );\n\n // Update the engine with the specified options from the config or fall back to the defaults.\n this.configuration.updateStudioOptions(this.config.studioOptions || defaultStudioOptions);\n\n // Whether the engine should cache query calls. This is disabled by default.\n this.configuration.setValue(\n WellKnownConfigurationKeys.QueryCallCacheEnabled,\n this.config.enableQueryCallCache?.toString() || 'false',\n );\n };\n\n setConnection = (newConnection: Connection) => {\n connection = newConnection;\n };\n}\n\nexport default SDK;\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,MAAM,gBAA2D;AACjE,MAAM,oBAAoB,WAAW,aAAa,WAAW,WAAW,OAAO;AAE/E,IAAI;AAEG,MAAM,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA,EA0Db,YAAY,QAAoB;AAPhC,SAAQ,kCAAkB,IAAA;AAC1B,SAAQ,uBAAuB,IAAI,qBAAA;AA2DnC,SAAA,aAAa,MAAM;;AACf;AAAA,QACI,KAAK,OAAO,cAAc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AAAA,EACnE;AAmJJ;"}
1
+ {"version":3,"file":"sdk.es.js","sources":["../../src/sdk.ts"],"sourcesContent":["import { Connection } from 'penpal';\nimport engineInfo from '../editor-engine.json';\nimport packageInfo from '../package.json';\nimport Connect from './interactions/Connector';\nimport { defaultStudioOptions, WellKnownConfigurationKeys } from './types/ConfigurationTypes';\n\nimport type { ConfigType, EditorAPI, RuntimeConfigType } from './types/CommonTypes';\nimport { Instrumented } from './types/MethodInvocationTypes';\nimport { DocumentType } from './types/DocumentTypes';\n\nimport { ActionController } from './controllers/ActionController';\nimport { AnimationController } from './controllers/AnimationController';\nimport { BarcodeController } from './controllers/BarcodeController';\nimport { BrandKitController } from './controllers/BrandKitController';\nimport { CanvasController } from './controllers/CanvasController';\nimport { CharacterStyleController } from './controllers/CharacterStyleController';\nimport { ClipboardController } from './controllers/ClipboardController';\nimport { ColorConversionController } from './controllers/ColorConversionController';\nimport { ColorStyleController } from './controllers/ColorStyleController';\nimport { ConfigurationController } from './controllers/ConfigurationController';\nimport { ConnectorController } from './controllers/ConnectorController';\nimport { DataConnectorController } from './controllers/DataConnectorController';\nimport { DataSourceController } from './controllers/DataSourceController';\nimport { DebugController } from './controllers/DebugController';\nimport { DocumentController } from './controllers/DocumentController';\nimport { ExperimentController } from './controllers/ExperimentController';\nimport { FontConnectorController } from './controllers/FontConnectorController';\nimport { FontController } from './controllers/FontController';\nimport { FrameController } from './controllers/FrameController';\nimport { InfoController } from './controllers/InfoController';\nimport { LayoutController } from './controllers/LayoutController';\nimport { MediaConnectorController } from './controllers/MediaConnectorController';\nimport { PageController } from './controllers/PageController';\nimport { ParagraphStyleController } from './controllers/ParagraphStyleController';\nimport { ShapeController } from './controllers/ShapeController';\nimport { SubscriberController } from './controllers/SubscriberController';\nimport { TextStyleController } from './controllers/TextStyleController';\nimport { ToolController } from './controllers/ToolController';\nimport { UndoManagerController } from './controllers/UndoManagerController';\nimport { UtilsController } from './controllers/UtilsController';\nimport { VariableController } from './controllers/VariableController';\nimport { NextSubscribers } from './next';\nimport { NextInitiator } from './next/NextInitiator';\nimport { ConfigHelper } from './utils/ConfigHelper';\nimport { DataItemMappingTools } from './utils/DataItemMappingTools';\nimport { LocalConfigurationDecorator } from './utils/LocalConfigurationDecorator';\nimport { GradientStyleController } from './controllers/GradientStyleController';\nimport { ComponentConnectorController } from './controllers/ComponentConnectorController';\nimport { ComponentController } from './controllers/ComponentController';\nimport { ComponentGridController } from './controllers/ComponentGridController';\nimport { MethodListenerRegistry, wrapWithInvocationObserver } from './utils/MethodInstrumentation';\nimport { SdkEvents } from './utils/SdkEvents';\n\ndeclare const __ENGINE_DOMAIN__: string;\nconst ENGINE_DOMAIN = typeof __ENGINE_DOMAIN__ !== 'undefined' ? __ENGINE_DOMAIN__ : 'studio-cdn.chiligrafx.com';\nconst FIXED_EDITOR_LINK = `https://${ENGINE_DOMAIN}/editor/${engineInfo.current}/web`;\n\nlet connection: Connection;\n\n// Marks a freshly created controller as \"needs instrumentation\" without requiring\n// its property name to be tracked anywhere. `applyMethodInstrumentation` later scans\n// the SDK instance for properties carrying this marker and wraps them automatically,\n// so a controller can never be silently skipped just because a list wasn't updated.\nconst PENDING_INSTRUMENTATION = Symbol('pendingInstrumentation');\n\nconst markForInstrumentation = (controller: object): void => {\n Object.defineProperty(controller, PENDING_INSTRUMENTATION, {\n value: true,\n enumerable: false,\n configurable: true,\n });\n};\n\nconst isPendingInstrumentation = (value: unknown): value is object => {\n return typeof value === 'object' && value !== null && (value as Record<symbol, unknown>)[PENDING_INSTRUMENTATION] === true;\n};\n\nexport class SDK {\n config: RuntimeConfigType;\n connection: Connection;\n\n /**\n * @ignore\n */\n editorAPI: EditorAPI;\n /**\n * SDK method invocation events.\n *\n * Use this to observe which SDK controller method was called and with which parameters/result.\n * These are SDK-level events (SDK -> consumer), separate from engine subscriber events (`config.events`).\n */\n sdkEvents: SdkEvents;\n\n action: Instrumented<ActionController>;\n layout: Instrumented<LayoutController>;\n frame: Instrumented<FrameController>;\n shape: Instrumented<ShapeController>;\n barcode: Instrumented<BarcodeController>;\n /** @experimental */\n component: Instrumented<ComponentController>;\n connector: Instrumented<ConnectorController>;\n mediaConnector: Instrumented<MediaConnectorController>;\n fontConnector: Instrumented<FontConnectorController>;\n /**\n * @experimental This controller is still experimental and might change in future releases.\n */\n componentConnector: Instrumented<ComponentConnectorController>;\n dataConnector: Instrumented<DataConnectorController>;\n dataSource: Instrumented<DataSourceController>;\n animation: Instrumented<AnimationController>;\n document: Instrumented<DocumentController>;\n configuration: Instrumented<ConfigurationController>;\n variable: Instrumented<VariableController>;\n utils: Instrumented<UtilsController>;\n tool: Instrumented<ToolController>;\n page: Instrumented<PageController>;\n debug: Instrumented<DebugController>;\n undoManager: Instrumented<UndoManagerController>;\n textSelection: Instrumented<TextStyleController>;\n paragraphStyle: Instrumented<ParagraphStyleController>;\n characterStyle: Instrumented<CharacterStyleController>;\n colorStyle: Instrumented<ColorStyleController>;\n gradientStyle: Instrumented<GradientStyleController>;\n font: Instrumented<FontController>;\n experiment: Instrumented<ExperimentController>;\n canvas: Instrumented<CanvasController>;\n colorConversion: Instrumented<ColorConversionController>;\n info: Instrumented<InfoController>;\n clipboard: Instrumented<ClipboardController>;\n brandKit: Instrumented<BrandKitController>;\n componentGrid: Instrumented<ComponentGridController>;\n\n next: NextInitiator;\n\n private subscriber: SubscriberController;\n private enabledNextSubscribers: NextSubscribers | undefined;\n private localConfig = new Map<string, string>();\n private dataItemMappingTools = new DataItemMappingTools();\n private methodListeners = new MethodListenerRegistry();\n\n /**\n * The SDK should be configured clientside and it exposes all controllers to work with in other applications\n * @param config The configuration object where the SDK and editor can get configured\n */\n constructor(config: ConfigType) {\n this.config = ConfigHelper.createRuntimeConfig(config);\n this.sdkEvents = new SdkEvents(this.config.logging?.logger);\n\n this.connection = connection;\n this.editorAPI = connection?.promise.then((child: unknown) => {\n return child;\n }) as unknown as EditorAPI;\n\n this.action = this.toInstrumented(new ActionController(this.editorAPI));\n this.layout = this.toInstrumented(new LayoutController(this.editorAPI));\n this.frame = this.toInstrumented(new FrameController(this.editorAPI));\n this.shape = this.toInstrumented(new ShapeController(this.editorAPI));\n this.barcode = this.toInstrumented(new BarcodeController(this.editorAPI));\n this.component = this.toInstrumented(new ComponentController(this.editorAPI));\n this.undoManager = this.toInstrumented(new UndoManagerController(this.editorAPI, this));\n this.connector = this.toInstrumented(new ConnectorController(this.editorAPI, this.localConfig));\n this.mediaConnector = this.toInstrumented(new MediaConnectorController(this.editorAPI));\n this.fontConnector = this.toInstrumented(new FontConnectorController(this.editorAPI));\n this.componentConnector = this.toInstrumented(new ComponentConnectorController(this.editorAPI));\n this.dataConnector = this.toInstrumented(new DataConnectorController(this.editorAPI, this.dataItemMappingTools));\n this.dataSource = this.toInstrumented(new DataSourceController(this.editorAPI, this.dataItemMappingTools));\n this.animation = this.toInstrumented(new AnimationController(this.editorAPI));\n this.document = this.toInstrumented(new DocumentController(this.editorAPI));\n\n this.configuration = this.toInstrumented(new LocalConfigurationDecorator(this.editorAPI, this.localConfig));\n this.variable = this.toInstrumented(new VariableController(this.editorAPI, this.dataItemMappingTools));\n this.utils = this.toInstrumented(new UtilsController(this.editorAPI, this.localConfig));\n this.subscriber = new SubscriberController(this.config, this.localConfig);\n this.tool = this.toInstrumented(new ToolController(this.editorAPI));\n this.page = this.toInstrumented(new PageController(this.editorAPI));\n this.debug = this.toInstrumented(new DebugController(this.editorAPI));\n // To be renamed textSelection > textStyle\n this.textSelection = this.toInstrumented(new TextStyleController(this.editorAPI));\n this.colorStyle = this.toInstrumented(new ColorStyleController(this.editorAPI));\n this.gradientStyle = this.toInstrumented(new GradientStyleController(this.editorAPI));\n this.paragraphStyle = this.toInstrumented(new ParagraphStyleController(this.editorAPI));\n this.characterStyle = this.toInstrumented(new CharacterStyleController(this.editorAPI));\n this.font = this.toInstrumented(new FontController(this.editorAPI));\n this.experiment = this.toInstrumented(new ExperimentController(this.editorAPI));\n this.canvas = this.toInstrumented(new CanvasController(this.editorAPI));\n this.colorConversion = this.toInstrumented(new ColorConversionController(this.editorAPI));\n this.info = this.toInstrumented(new InfoController());\n this.clipboard = this.toInstrumented(new ClipboardController(this.editorAPI));\n this.next = new NextInitiator(this.config, this.connection, this.editorAPI);\n this.enabledNextSubscribers = this.config.enableNextSubscribers;\n this.brandKit = this.toInstrumented(new BrandKitController(this.editorAPI, this));\n this.componentGrid = this.toInstrumented(new ComponentGridController(this.editorAPI));\n\n this.applyMethodInstrumentation();\n }\n\n /**\n * This method will initiate the editor, running this will result in the editor restarting\n * It will generate an iframe in the document\n */\n loadEditor = () => {\n Connect(\n this.config.editorLink || FIXED_EDITOR_LINK,\n {\n onActionsChanged: this.subscriber.onActionsChanged,\n onStateChanged: this.subscriber.onStateChanged,\n onAuthExpired: this.subscriber.onAuthExpired,\n onViewportRequested: this.subscriber.onViewportRequested,\n onDocumentLoaded: this.subscriber.onDocumentLoaded,\n onSelectedFramesContentChanged: this.subscriber.onSelectedFramesContentChanged,\n onSelectedFramesLayoutChanged: this.subscriber.onSelectedFramesLayoutChanged,\n onFramesLayoutChanged: this.subscriber.onFramesLayoutChanged,\n onSelectedLayoutPropertiesChanged: this.subscriber.onSelectedLayoutPropertiesChanged,\n onSelectedLayoutUnitChanged: this.subscriber.onSelectedLayoutUnitChanged,\n onPageSelectionChanged: this.subscriber.onPageSelectionChanged,\n onScrubberPositionChanged: this.subscriber.onAnimationPlaybackChanged,\n onFrameAnimationsChanged: this.subscriber.onAnimationChanged,\n onVariableListChanged: (state) => {\n if (this.enabledNextSubscribers?.onVariableListChanged) {\n this.next.subscriber.onVariableListChanged(state);\n } else {\n this.subscriber.onVariableListChanged(state);\n }\n },\n onSelectedToolChanged: this.subscriber.onSelectedToolChanged,\n onUndoStateChanged: this.subscriber.onUndoStateChanged,\n onSelectedLayoutFramesChanged: this.subscriber.onSelectedLayoutFramesChanged,\n onSelectedTextStyleChanged: this.subscriber.onSelectedTextStyleChanged,\n onColorsChanged: this.subscriber.onColorsChanged,\n onParagraphStylesChanged: this.subscriber.onParagraphStylesChanged,\n onCharacterStylesChanged: this.subscriber.onCharacterStylesChanged,\n onFontFamiliesChanged: this.subscriber.onFontFamiliesChanged,\n onSelectedLayoutIdChanged: this.subscriber.onSelectedLayoutIdChanged,\n onLayoutsChanged: this.subscriber.onLayoutsChanged,\n onConnectorEvent: this.subscriber.onConnectorEvent,\n onConnectorsChanged: (state) => {\n if (this.enabledNextSubscribers?.onConnectorsChanged) {\n this.next.subscriber.onConnectorsChanged(state);\n } else {\n this.subscriber.onConnectorsChanged(state);\n }\n },\n onZoomChanged: this.subscriber.onZoomChanged,\n onSelectedPageIdChanged: this.subscriber.onSelectedPageIdChanged,\n onPagesChanged: this.subscriber.onPagesChanged,\n onPageSnapshotInvalidated: this.subscriber.onPageSnapshotInvalidated,\n onPageSizeChanged: (state) => {\n if (this.enabledNextSubscribers?.onPageSizeChanged) {\n this.next.subscriber.onPageSizeChanged(state);\n } else {\n this.subscriber.onPageSizeChanged(state);\n }\n },\n onShapeCornerRadiusChanged: this.subscriber.onShapeCornerRadiusChanged,\n onCropActiveFrameIdChanged: this.subscriber.onCropActiveFrameIdChanged,\n onAsyncError: this.subscriber.onAsyncError,\n onViewModeChanged: this.subscriber.onViewModeChanged,\n onBarcodeValidationChanged: this.subscriber.onBarcodeValidationChanged,\n onDataSourceIdChanged: this.subscriber.onDataSourceIdChanged,\n onInjectedDataChanged: this.subscriber.onInjectedDataChanged,\n onDocumentIssueListChanged: this.subscriber.onDocumentIssueListChanged,\n onCustomUndoDataChanged: this.subscriber.onCustomUndoDataChanged,\n onEngineEditModeChanged: this.subscriber.onEngineEditModeChanged,\n onBrandKitMediaChanged: this.subscriber.onBrandKitMediaChanged,\n onCanvasFramesManipulated: this.subscriber.onCanvasFramesManipulated,\n },\n this.setConnection,\n this.config.editorId,\n this.config.studioStyling,\n (error) => {\n this.config.onConnectionError?.(error);\n },\n );\n this.editorAPI = connection?.promise.then((editorAPI: unknown) => {\n return editorAPI;\n }) as unknown as EditorAPI;\n\n this.action = this.toInstrumented(new ActionController(this.editorAPI));\n this.layout = this.toInstrumented(new LayoutController(this.editorAPI));\n this.frame = this.toInstrumented(new FrameController(this.editorAPI));\n this.barcode = this.toInstrumented(new BarcodeController(this.editorAPI));\n this.component = this.toInstrumented(new ComponentController(this.editorAPI));\n this.animation = this.toInstrumented(new AnimationController(this.editorAPI));\n this.document = this.toInstrumented(new DocumentController(this.editorAPI));\n this.configuration = this.toInstrumented(new LocalConfigurationDecorator(this.editorAPI, this.localConfig));\n this.utils = this.toInstrumented(new UtilsController(this.editorAPI, this.localConfig));\n this.tool = this.toInstrumented(new ToolController(this.editorAPI));\n this.page = this.toInstrumented(new PageController(this.editorAPI));\n this.debug = this.toInstrumented(new DebugController(this.editorAPI));\n this.undoManager = this.toInstrumented(new UndoManagerController(this.editorAPI, this));\n this.textSelection = this.toInstrumented(new TextStyleController(this.editorAPI));\n this.colorStyle = this.toInstrumented(new ColorStyleController(this.editorAPI));\n this.gradientStyle = this.toInstrumented(new GradientStyleController(this.editorAPI));\n this.paragraphStyle = this.toInstrumented(new ParagraphStyleController(this.editorAPI));\n this.characterStyle = this.toInstrumented(new CharacterStyleController(this.editorAPI));\n this.mediaConnector = this.toInstrumented(new MediaConnectorController(this.editorAPI));\n this.fontConnector = this.toInstrumented(new FontConnectorController(this.editorAPI));\n this.componentConnector = this.toInstrumented(new ComponentConnectorController(this.editorAPI));\n this.dataConnector = this.toInstrumented(new DataConnectorController(this.editorAPI, this.dataItemMappingTools));\n this.dataSource = this.toInstrumented(new DataSourceController(this.editorAPI, this.dataItemMappingTools));\n this.connector = this.toInstrumented(new ConnectorController(this.editorAPI, this.localConfig));\n this.variable = this.toInstrumented(new VariableController(this.editorAPI, this.dataItemMappingTools));\n this.font = this.toInstrumented(new FontController(this.editorAPI));\n this.experiment = this.toInstrumented(new ExperimentController(this.editorAPI));\n this.canvas = this.toInstrumented(new CanvasController(this.editorAPI));\n this.shape = this.toInstrumented(new ShapeController(this.editorAPI));\n this.colorConversion = this.toInstrumented(new ColorConversionController(this.editorAPI));\n this.info = this.toInstrumented(new InfoController());\n this.clipboard = this.toInstrumented(new ClipboardController(this.editorAPI));\n this.brandKit = this.toInstrumented(new BrandKitController(this.editorAPI, this));\n this.componentGrid = this.toInstrumented(new ComponentGridController(this.editorAPI));\n this.next = new NextInitiator(this.config, this.connection, this.editorAPI);\n\n this.applyMethodInstrumentation();\n\n // as soon as the editor loads, provide it with the SDK version\n // used to make it start. This enables engine compatibility checks\n // on the Flutter side\n this.configuration.setValue(WellKnownConfigurationKeys.GraFxStudioSdkVersion, packageInfo.version);\n\n // Makes the engine aware which document type it should render, if this call\n // isn't made, the engine will fall back to the type specified in the document.\n //\n // Loading a template JSON and setting the engine to `project` will cause\n // the document JSON structure to be converted to a project on save.\n // Using `getCurrentDocumentState` will also output the converted document.\n this.configuration.setValue(\n WellKnownConfigurationKeys.GraFxStudioDocumentType,\n this.config.documentType || DocumentType.template,\n );\n\n // Update the engine with the specified options from the config or fall back to the defaults.\n this.configuration.updateStudioOptions(this.config.studioOptions || defaultStudioOptions);\n\n // Whether the engine should cache query calls. This is disabled by default.\n this.configuration.setValue(\n WellKnownConfigurationKeys.QueryCallCacheEnabled,\n this.config.enableQueryCallCache?.toString() || 'false',\n );\n };\n\n setConnection = (newConnection: Connection) => {\n connection = newConnection;\n };\n\n private toInstrumented = <T extends object>(controller: T): Instrumented<T> => {\n markForInstrumentation(controller);\n return controller as unknown as Instrumented<T>;\n };\n\n /**\n * Wraps every controller previously handed to `toInstrumented` with the invocation\n * observer, discovering them by their marker rather than a manually maintained\n * list of property names. Any property assigned via `toInstrumented` is picked up\n * automatically, using its own property key as the controller name.\n */\n private applyMethodInstrumentation = () => {\n const sdkProperties = this as unknown as Record<string, unknown>;\n for (const propertyName of Object.keys(sdkProperties)) {\n const value = sdkProperties[propertyName];\n if (isPendingInstrumentation(value)) {\n sdkProperties[propertyName] = wrapWithInvocationObserver(\n value,\n propertyName,\n this.methodListeners,\n this.sd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,eAAe,IAAI,wBAAwB,KAAK,SAAS,CAAC;AAEpF,SAAK,2BAAA;AAAA,EACT;AAiLJ;"}
@@ -1,7 +1,6 @@
1
1
  import { CharacterStyle } from './CharacterStyleTypes';
2
2
  import { APIColorType, DocumentColor } from './ColorStyleTypes';
3
- import { Id } from './CommonTypes';
4
- import { DocumentCharacterStyle, DocumentParagraphStyle } from './DocumentTypes';
3
+ import { Id, PropertyState } from './CommonTypes';
5
4
  import { DocumentFontFamily } from './FontTypes';
6
5
  import { DocumentGradient } from './GradientStyleTypes';
7
6
  import { ParagraphStyle } from './ParagraphStyleTypes';
@@ -22,82 +21,82 @@ type BaseBrandKitColor = {
22
21
  guid: string;
23
22
  };
24
23
  export type RGBColorValue = BaseBrandKitColor & {
25
- value: RGB;
24
+ value: RGB | null;
26
25
  type: APIColorType.rgb;
27
26
  };
28
27
  export type CMYKColorValue = BaseBrandKitColor & {
29
- value: CMYK;
28
+ value: CMYK | null;
30
29
  type: APIColorType.cmyk;
31
30
  };
32
31
  export type HEXColorValue = BaseBrandKitColor & {
33
- value: string;
32
+ value: string | null;
34
33
  type: APIColorType.hex;
35
34
  };
36
35
  export type SpotRGBColorValue = BaseBrandKitColor & {
37
- displayValue: RGB;
38
- value: string;
36
+ displayValue: RGB | null;
37
+ value: string | null;
39
38
  type: APIColorType.spotRgb;
40
39
  };
41
40
  export type SpotCMYKColorValue = BaseBrandKitColor & {
42
- displayValue: CMYK;
43
- value: string;
41
+ displayValue: CMYK | null;
42
+ value: string | null;
44
43
  type: APIColorType.spotCmyk;
45
44
  };
46
45
  export type SpotHEXColorValue = BaseBrandKitColor & {
47
- displayValue: string;
48
- value: string;
46
+ displayValue: string | null;
47
+ value: string | null;
49
48
  type: APIColorType.spotHex;
50
49
  };
51
- export type BrandKitColor = RGBColorValue | CMYKColorValue | HEXColorValue | SpotRGBColorValue | SpotCMYKColorValue | SpotHEXColorValue;
52
- export type BrandKitFont = {
50
+ export type APIBrandKitColor = RGBColorValue | CMYKColorValue | HEXColorValue | SpotRGBColorValue | SpotCMYKColorValue | SpotHEXColorValue;
51
+ export type APIBrandKitFont = {
53
52
  fontFamilyId: string;
54
- fontFamilyBrandKitGuid: string;
53
+ fontFamilyBrandKitGuid?: string | null;
55
54
  fontConnectorId?: string | null;
56
55
  };
57
- export type BrandKitCharacterStyle = {
56
+ export type APIBrandKitCharacterStyle = {
58
57
  name: string;
59
- brandKitFontFamilyGuid?: string;
60
- fontStyleId?: string;
61
- fontSize?: number;
62
- typographicCase?: Case;
63
- kerningOn?: boolean;
64
- subSuperScript?: Scripting;
65
- trackingLeft?: number;
66
- trackingRight?: number;
67
- textIndent?: string;
68
- baselineShiftValue?: string;
69
- lineHeight?: number;
70
- textOverprint?: boolean;
71
- brandKitColorGuid?: string;
72
- fillColorApplied?: boolean;
58
+ brandKitFontFamilyGuid?: string | null;
59
+ fontStyleId?: string | null;
60
+ fontSize?: number | null;
61
+ typographicCase?: Case | null;
62
+ kerningOn?: boolean | null;
63
+ subSuperScript?: Scripting | null;
64
+ trackingLeft?: number | null;
65
+ trackingRight?: number | null;
66
+ textIndent?: string | null;
67
+ baselineShiftValue?: string | null;
68
+ lineHeight?: number | null;
69
+ textOverprint?: boolean | null;
70
+ brandKitColorGuid?: string | null;
71
+ fillColorApplied?: boolean | null;
73
72
  textStrokeColorGuid?: string | null;
74
73
  textStrokeColorApplied?: boolean | null;
75
74
  textStrokeWidth?: number | null;
76
- underline?: boolean;
77
- lineThrough?: boolean;
75
+ underline?: boolean | null;
76
+ lineThrough?: boolean | null;
78
77
  };
79
- export type BrandKitParagraphStyle = {
78
+ export type APIBrandKitParagraphStyle = {
80
79
  name: string;
81
80
  brandKitFontFamilyGuid: string;
82
81
  fontStyleId: string;
83
82
  fontSize: number;
84
- typographicCase: Case;
85
- kerningOn: boolean;
86
- subSuperScript: Scripting;
87
- trackingLeft: number;
88
- trackingRight: number;
89
- textAlign: Alignment;
90
- textIndent: string;
91
- baselineShiftValue: string;
83
+ typographicCase: Case | null;
84
+ kerningOn?: boolean | null;
85
+ subSuperScript: Scripting | null;
86
+ trackingLeft?: number | null;
87
+ trackingRight?: number | null;
88
+ textAlign?: Alignment | null;
89
+ textIndent?: string | null;
90
+ baselineShiftValue?: string | null;
92
91
  lineHeight: number;
93
- textOverprint: boolean;
92
+ textOverprint?: boolean | null;
94
93
  brandKitColorGuid: string;
95
- fillColorApplied: boolean;
96
- textStrokeColorGuid: string;
97
- textStrokeColorApplied: boolean;
98
- textStrokeWidth: number;
99
- underline: boolean;
100
- lineThrough: boolean;
94
+ fillColorApplied?: boolean | null;
95
+ textStrokeColorGuid?: string | null;
96
+ textStrokeColorApplied?: boolean | null;
97
+ textStrokeWidth?: number | null;
98
+ underline?: boolean | null;
99
+ lineThrough?: boolean | null;
101
100
  };
102
101
  export type BrandKitMedia = {
103
102
  name: string;
@@ -106,80 +105,43 @@ export type BrandKitMedia = {
106
105
  };
107
106
  export type APIBrandKitMedia = {
108
107
  name: string;
109
- mediaConnectorId: Id;
110
- mediaId: Id;
108
+ mediaConnectorId?: Id | null;
109
+ mediaId?: Id | null;
111
110
  };
112
111
  export type APIBrandKitTheme = {
113
112
  id: Id;
114
113
  name: string;
115
- inheritsFrom: string | null;
114
+ inheritedFrom: string | null;
116
115
  dateCreated: string | null;
117
116
  lastModifiedDate: string | null;
118
- colors: BrandKitColor[];
119
- characterStyles: BrandKitCharacterStyle[];
120
- paragraphStyles: BrandKitParagraphStyle[];
121
- media: BrandKitMedia[];
117
+ colors: APIBrandKitColor[];
118
+ characterStyles: APIBrandKitCharacterStyle[];
119
+ paragraphStyles: APIBrandKitParagraphStyle[];
120
+ media: APIBrandKitMedia[];
122
121
  };
123
122
  export type APIBrandKit = {
124
123
  id: Id;
125
- name: string;
124
+ name: string | null;
126
125
  dateCreated: string;
127
126
  lastModifiedDate: string;
128
- fonts: BrandKitFont[];
129
- colors: BrandKitColor[];
130
- characterStyles: BrandKitCharacterStyle[];
131
- paragraphStyles: BrandKitParagraphStyle[];
132
- media: APIBrandKitMedia[];
133
- themes: APIBrandKitTheme[] | BrandKitTheme[];
134
- };
135
- export type BrandKitTheme = {
136
- id: string;
137
- name: string;
138
- inheritsFrom: string | null;
139
- dateCreated: string | null;
140
- lastModifiedDate: string | null;
141
- colors: DocumentColor[];
142
- characterStyles: CharacterStyle[];
143
- paragraphStyles: ParagraphStyle[];
144
- media: BrandKitMedia[];
145
- };
146
- /**
147
- * User-facing brand kit type returned by BrandKitController.get() and accepted by BrandKitController.set().
148
- */
149
- export type StudioBrandKit = {
150
- id: string;
151
- name: string;
152
- fontConnectorId: string;
153
- brandKit: APIBrandKit;
154
- };
155
- /**
156
- * Internal brand kit shape returned by BrandKitController.set() with document-style resources.
157
- */
158
- export type BrandKitInternal = {
159
- id: string;
160
- version: string;
161
- name: string;
162
- colors: DocumentColor[];
163
- gradients: DocumentGradient[];
164
- fonts: DocumentFontFamily[];
165
- characterStyles: DocumentCharacterStyle[];
166
- paragraphStyles: DocumentParagraphStyle[];
167
- media: BrandKitMedia[];
168
- themes: BrandKitTheme[];
169
- };
170
- /**
171
- * Engine response shape from getBrandKit() / setBrandKit(). Used internally to adapt to StudioBrandKit / BrandKitInternal.
172
- */
173
- export type EngineBrandKit = {
127
+ fonts?: APIBrandKitFont[] | null;
128
+ colors?: APIBrandKitColor[] | null;
129
+ characterStyles?: APIBrandKitCharacterStyle[] | null;
130
+ paragraphStyles?: APIBrandKitParagraphStyle[] | null;
131
+ media?: APIBrandKitMedia[] | null;
132
+ themes?: APIBrandKitTheme[] | null;
133
+ };
134
+ export type BrandKit = {
174
135
  id: string | null;
175
136
  version: string | null;
176
137
  name: string | null;
177
- colors: DocumentColor[];
178
- gradients: DocumentGradient[];
179
- fontFamilies: DocumentFontFamily[];
180
- characterStyles: CharacterStyle[];
181
- paragraphStyles: ParagraphStyle[];
182
- media: BrandKitMedia[];
183
- themes: BrandKitTheme[];
138
+ selectedThemeName: string | null;
139
+ colors: PropertyState<DocumentColor>[];
140
+ gradients: PropertyState<DocumentGradient>[];
141
+ fontFamilies: PropertyState<DocumentFontFamily>[];
142
+ characterStyles: PropertyState<CharacterStyle>[];
143
+ paragraphStyles: PropertyState<ParagraphStyle>[];
144
+ media: PropertyState<BrandKitMedia>[];
145
+ isAutoSync: boolean | null;
184
146
  };
185
147
  export {};
@@ -1,5 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ var APIColorType = /* @__PURE__ */ ((APIColorType2) => {
4
+ APIColorType2["rgb"] = "rgb";
5
+ APIColorType2["hex"] = "hex";
6
+ APIColorType2["cmyk"] = "cmyk";
7
+ APIColorType2["spotCmyk"] = "spotCmyk";
8
+ APIColorType2["spotRgb"] = "spotRgb";
9
+ APIColorType2["spotHex"] = "spotHex";
10
+ return APIColorType2;
11
+ })(APIColorType || {});
3
12
  var ColorType = /* @__PURE__ */ ((ColorType2) => {
4
13
  ColorType2["rgb"] = "rgb";
5
14
  ColorType2["hex"] = "hex";
@@ -18,6 +27,7 @@ var ColorUsageType = /* @__PURE__ */ ((ColorUsageType2) => {
18
27
  ColorUsageType2["stylekit"] = "brandKit";
19
28
  return ColorUsageType2;
20
29
  })(ColorUsageType || {});
30
+ exports.APIColorType = APIColorType;
21
31
  exports.ColorType = ColorType;
22
32
  exports.ColorUsageType = ColorUsageType;
23
33
  //# sourceMappingURL=ColorStyleTypes.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColorStyleTypes.cjs.js","sources":["../../../src/types/ColorStyleTypes.ts"],"sourcesContent":["import { Id } from './CommonTypes';\n\nexport enum APIColorType {\n rgb = 'rgb',\n hex = 'hex',\n cmyk = 'cmyk',\n spotCmyk = 'spotCmyk',\n spotRgb = 'spotRgb',\n spotHex = 'spotHex',\n}\nexport enum ColorType {\n rgb = 'rgb',\n hex = 'hex',\n cmyk = 'cmyk',\n gray = 'gray',\n hsl = 'hsl',\n /**\n * @deprecated Use spotCMYK or spotRGB instead\n */\n spot = 'spot',\n spotCMYK = 'spotCMYK',\n spotRGB = 'spotRGB',\n spotHEX = 'spotHEX',\n}\n\nexport type RGBColor = {\n r: number;\n g: number;\n b: number;\n type: ColorType;\n};\n\nexport type CMYKColor = {\n c: number;\n m: number;\n y: number;\n k: number;\n type: ColorType;\n};\n\nexport type HSLColor = {\n h: number;\n s: number;\n l: number;\n type: ColorType;\n};\n\nexport type GrayColor = {\n g: number;\n type: ColorType;\n};\n\n/**\n * @deprecated Use SpotColorCMYK or SpotColorRGB instead\n */\nexport type SpotColor = {\n spotName: string;\n c: number;\n m: number;\n y: number;\n k: number;\n type: ColorType;\n};\n\nexport type SpotColorCMYK = {\n spotName: string;\n c: number;\n m: number;\n y: number;\n k: number;\n type: ColorType;\n};\n\nexport type SpotColorRGB = {\n spotName: string;\n r: number;\n g: number;\n b: number;\n type: ColorType;\n};\n\nexport type SpotColorHEX = {\n spotName: string;\n value: string;\n type: ColorType;\n};\n\nexport type HexColor = {\n value: string;\n type: ColorType;\n};\n\nexport type Color =\n | RGBColor\n | CMYKColor\n | HSLColor\n | GrayColor\n | SpotColor\n | HexColor\n | SpotColorCMYK\n | SpotColorRGB\n | SpotColorHEX;\n\nexport type ColorUpdate = Color;\n\nexport type DocumentColor = {\n id: string;\n name: string;\n color: Color;\n};\n\nexport type ColorUsageUpdate = {\n /**\n * Reference to the brand kit color, can only be used if it is a brand kit color.\n */\n id?: Id;\n /**\n * The local color object, can only be used if it is a local color.\n */\n color?: ColorUpdate;\n type: ColorUsageType;\n /**\n * Opacity of the color (0-100) where 0 = fully transparent.\n */\n opacity?: number;\n /**\n * Indicates if the color will be applied or not.\n */\n isApplied?: boolean;\n};\n\nexport type ColorUsage = {\n /**\n * Reference to the brand kit color, can only be used if it is a brand kit color.\n */\n id?: Id;\n /**\n * The local color object, can only be used if it is a local color.\n */\n color?: Color;\n type: ColorUsageType;\n /**\n * Opacity of the color (0-100) where 0 = fully transparent.\n */\n opacity?: number;\n};\n\nexport enum ColorUsageType {\n /**\n * The color is defined locally on the object\n */\n local = 'local',\n /**\n * The color is referencing a document color\n */\n brandKit = 'brandKit',\n /**\n * @deprecated use brandKit instead\n *\n * The color is referencing a brand kit color\n */\n stylekit = 'brandKit',\n}\n"],"names":["ColorType","ColorUsageType"],"mappings":";;AAUO,IAAK,8BAAAA,eAAL;AACHA,aAAA,KAAA,IAAM;AACNA,aAAA,KAAA,IAAM;AACNA,aAAA,MAAA,IAAO;AACPA,aAAA,MAAA,IAAO;AACPA,aAAA,KAAA,IAAM;AAINA,aAAA,MAAA,IAAO;AACPA,aAAA,UAAA,IAAW;AACXA,aAAA,SAAA,IAAU;AACVA,aAAA,SAAA,IAAU;AAZF,SAAAA;AAAA,GAAA,aAAA,CAAA,CAAA;AAyIL,IAAK,mCAAAC,oBAAL;AAIHA,kBAAA,OAAA,IAAQ;AAIRA,kBAAA,UAAA,IAAW;AAMXA,kBAAA,UAAA,IAAW;AAdH,SAAAA;AAAA,GAAA,kBAAA,CAAA,CAAA;;;"}
1
+ {"version":3,"file":"ColorStyleTypes.cjs.js","sources":["../../../src/types/ColorStyleTypes.ts"],"sourcesContent":["import { Id } from './CommonTypes';\n\nexport enum APIColorType {\n rgb = 'rgb',\n hex = 'hex',\n cmyk = 'cmyk',\n spotCmyk = 'spotCmyk',\n spotRgb = 'spotRgb',\n spotHex = 'spotHex',\n}\nexport enum ColorType {\n rgb = 'rgb',\n hex = 'hex',\n cmyk = 'cmyk',\n gray = 'gray',\n hsl = 'hsl',\n /**\n * @deprecated Use spotCMYK or spotRGB instead\n */\n spot = 'spot',\n spotCMYK = 'spotCMYK',\n spotRGB = 'spotRGB',\n spotHEX = 'spotHEX',\n}\n\nexport type RGBColor = {\n r: number;\n g: number;\n b: number;\n type: ColorType;\n};\n\nexport type CMYKColor = {\n c: number;\n m: number;\n y: number;\n k: number;\n type: ColorType;\n};\n\nexport type HSLColor = {\n h: number;\n s: number;\n l: number;\n type: ColorType;\n};\n\nexport type GrayColor = {\n g: number;\n type: ColorType;\n};\n\n/**\n * @deprecated Use SpotColorCMYK or SpotColorRGB instead\n */\nexport type SpotColor = {\n spotName: string;\n c: number;\n m: number;\n y: number;\n k: number;\n type: ColorType;\n};\n\nexport type SpotColorCMYK = {\n spotName: string;\n c: number;\n m: number;\n y: number;\n k: number;\n type: ColorType;\n};\n\nexport type SpotColorRGB = {\n spotName: string;\n r: number;\n g: number;\n b: number;\n type: ColorType;\n};\n\nexport type SpotColorHEX = {\n spotName: string;\n value: string;\n type: ColorType;\n};\n\nexport type HexColor = {\n value: string;\n type: ColorType;\n};\n\nexport type Color =\n | RGBColor\n | CMYKColor\n | HSLColor\n | GrayColor\n | SpotColor\n | HexColor\n | SpotColorCMYK\n | SpotColorRGB\n | SpotColorHEX;\n\nexport type ColorUpdate = Color;\n\nexport type DocumentColor = {\n id: string;\n name: string;\n color: Color;\n};\n\nexport type ColorUsageUpdate = {\n /**\n * Reference to the brand kit color, can only be used if it is a brand kit color.\n */\n id?: Id;\n /**\n * The local color object, can only be used if it is a local color.\n */\n color?: ColorUpdate;\n type: ColorUsageType;\n /**\n * Opacity of the color (0-100) where 0 = fully transparent.\n */\n opacity?: number;\n /**\n * Indicates if the color will be applied or not.\n */\n isApplied?: boolean;\n};\n\nexport type ColorUsage = {\n /**\n * Reference to the brand kit color, can only be used if it is a brand kit color.\n */\n id?: Id;\n /**\n * The local color object, can only be used if it is a local color.\n */\n color?: Color;\n type: ColorUsageType;\n /**\n * Opacity of the color (0-100) where 0 = fully transparent.\n */\n opacity?: number;\n};\n\nexport enum ColorUsageType {\n /**\n * The color is defined locally on the object\n */\n local = 'local',\n /**\n * The color is referencing a document color\n */\n brandKit = 'brandKit',\n /**\n * @deprecated use brandKit instead\n *\n * The color is referencing a brand kit color\n */\n stylekit = 'brandKit',\n}\n"],"names":["APIColorType","ColorType","ColorUsageType"],"mappings":";;AAEO,IAAK,iCAAAA,kBAAL;AACHA,gBAAA,KAAA,IAAM;AACNA,gBAAA,KAAA,IAAM;AACNA,gBAAA,MAAA,IAAO;AACPA,gBAAA,UAAA,IAAW;AACXA,gBAAA,SAAA,IAAU;AACVA,gBAAA,SAAA,IAAU;AANF,SAAAA;AAAA,GAAA,gBAAA,CAAA,CAAA;AAQL,IAAK,8BAAAC,eAAL;AACHA,aAAA,KAAA,IAAM;AACNA,aAAA,KAAA,IAAM;AACNA,aAAA,MAAA,IAAO;AACPA,aAAA,MAAA,IAAO;AACPA,aAAA,KAAA,IAAM;AAINA,aAAA,MAAA,IAAO;AACPA,aAAA,UAAA,IAAW;AACXA,aAAA,SAAA,IAAU;AACVA,aAAA,SAAA,IAAU;AAZF,SAAAA;AAAA,GAAA,aAAA,CAAA,CAAA;AAyIL,IAAK,mCAAAC,oBAAL;AAIHA,kBAAA,OAAA,IAAQ;AAIRA,kBAAA,UAAA,IAAW;AAMXA,kBAAA,UAAA,IAAW;AAdH,SAAAA;AAAA,GAAA,kBAAA,CAAA,CAAA;;;;"}
@@ -1,3 +1,12 @@
1
+ var APIColorType = /* @__PURE__ */ ((APIColorType2) => {
2
+ APIColorType2["rgb"] = "rgb";
3
+ APIColorType2["hex"] = "hex";
4
+ APIColorType2["cmyk"] = "cmyk";
5
+ APIColorType2["spotCmyk"] = "spotCmyk";
6
+ APIColorType2["spotRgb"] = "spotRgb";
7
+ APIColorType2["spotHex"] = "spotHex";
8
+ return APIColorType2;
9
+ })(APIColorType || {});
1
10
  var ColorType = /* @__PURE__ */ ((ColorType2) => {
2
11
  ColorType2["rgb"] = "rgb";
3
12
  ColorType2["hex"] = "hex";
@@ -17,6 +26,7 @@ var ColorUsageType = /* @__PURE__ */ ((ColorUsageType2) => {
17
26
  return ColorUsageType2;
18
27
  })(ColorUsageType || {});
19
28
  export {
29
+ APIColorType,
20
30
  ColorType,
21
31
  ColorUsageType
22
32
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ColorStyleTypes.es.js","sources":["../../../src/types/ColorStyleTypes.ts"],"sourcesContent":["import { Id } from './CommonTypes';\n\nexport enum APIColorType {\n rgb = 'rgb',\n hex = 'hex',\n cmyk = 'cmyk',\n spotCmyk = 'spotCmyk',\n spotRgb = 'spotRgb',\n spotHex = 'spotHex',\n}\nexport enum ColorType {\n rgb = 'rgb',\n hex = 'hex',\n cmyk = 'cmyk',\n gray = 'gray',\n hsl = 'hsl',\n /**\n * @deprecated Use spotCMYK or spotRGB instead\n */\n spot = 'spot',\n spotCMYK = 'spotCMYK',\n spotRGB = 'spotRGB',\n spotHEX = 'spotHEX',\n}\n\nexport type RGBColor = {\n r: number;\n g: number;\n b: number;\n type: ColorType;\n};\n\nexport type CMYKColor = {\n c: number;\n m: number;\n y: number;\n k: number;\n type: ColorType;\n};\n\nexport type HSLColor = {\n h: number;\n s: number;\n l: number;\n type: ColorType;\n};\n\nexport type GrayColor = {\n g: number;\n type: ColorType;\n};\n\n/**\n * @deprecated Use SpotColorCMYK or SpotColorRGB instead\n */\nexport type SpotColor = {\n spotName: string;\n c: number;\n m: number;\n y: number;\n k: number;\n type: ColorType;\n};\n\nexport type SpotColorCMYK = {\n spotName: string;\n c: number;\n m: number;\n y: number;\n k: number;\n type: ColorType;\n};\n\nexport type SpotColorRGB = {\n spotName: string;\n r: number;\n g: number;\n b: number;\n type: ColorType;\n};\n\nexport type SpotColorHEX = {\n spotName: string;\n value: string;\n type: ColorType;\n};\n\nexport type HexColor = {\n value: string;\n type: ColorType;\n};\n\nexport type Color =\n | RGBColor\n | CMYKColor\n | HSLColor\n | GrayColor\n | SpotColor\n | HexColor\n | SpotColorCMYK\n | SpotColorRGB\n | SpotColorHEX;\n\nexport type ColorUpdate = Color;\n\nexport type DocumentColor = {\n id: string;\n name: string;\n color: Color;\n};\n\nexport type ColorUsageUpdate = {\n /**\n * Reference to the brand kit color, can only be used if it is a brand kit color.\n */\n id?: Id;\n /**\n * The local color object, can only be used if it is a local color.\n */\n color?: ColorUpdate;\n type: ColorUsageType;\n /**\n * Opacity of the color (0-100) where 0 = fully transparent.\n */\n opacity?: number;\n /**\n * Indicates if the color will be applied or not.\n */\n isApplied?: boolean;\n};\n\nexport type ColorUsage = {\n /**\n * Reference to the brand kit color, can only be used if it is a brand kit color.\n */\n id?: Id;\n /**\n * The local color object, can only be used if it is a local color.\n */\n color?: Color;\n type: ColorUsageType;\n /**\n * Opacity of the color (0-100) where 0 = fully transparent.\n */\n opacity?: number;\n};\n\nexport enum ColorUsageType {\n /**\n * The color is defined locally on the object\n */\n local = 'local',\n /**\n * The color is referencing a document color\n */\n brandKit = 'brandKit',\n /**\n * @deprecated use brandKit instead\n *\n * The color is referencing a brand kit color\n */\n stylekit = 'brandKit',\n}\n"],"names":["ColorType","ColorUsageType"],"mappings":"AAUO,IAAK,8BAAAA,eAAL;AACHA,aAAA,KAAA,IAAM;AACNA,aAAA,KAAA,IAAM;AACNA,aAAA,MAAA,IAAO;AACPA,aAAA,MAAA,IAAO;AACPA,aAAA,KAAA,IAAM;AAINA,aAAA,MAAA,IAAO;AACPA,aAAA,UAAA,IAAW;AACXA,aAAA,SAAA,IAAU;AACVA,aAAA,SAAA,IAAU;AAZF,SAAAA;AAAA,GAAA,aAAA,CAAA,CAAA;AAyIL,IAAK,mCAAAC,oBAAL;AAIHA,kBAAA,OAAA,IAAQ;AAIRA,kBAAA,UAAA,IAAW;AAMXA,kBAAA,UAAA,IAAW;AAdH,SAAAA;AAAA,GAAA,kBAAA,CAAA,CAAA;"}
1
+ {"version":3,"file":"ColorStyleTypes.es.js","sources":["../../../src/types/ColorStyleTypes.ts"],"sourcesContent":["import { Id } from './CommonTypes';\n\nexport enum APIColorType {\n rgb = 'rgb',\n hex = 'hex',\n cmyk = 'cmyk',\n spotCmyk = 'spotCmyk',\n spotRgb = 'spotRgb',\n spotHex = 'spotHex',\n}\nexport enum ColorType {\n rgb = 'rgb',\n hex = 'hex',\n cmyk = 'cmyk',\n gray = 'gray',\n hsl = 'hsl',\n /**\n * @deprecated Use spotCMYK or spotRGB instead\n */\n spot = 'spot',\n spotCMYK = 'spotCMYK',\n spotRGB = 'spotRGB',\n spotHEX = 'spotHEX',\n}\n\nexport type RGBColor = {\n r: number;\n g: number;\n b: number;\n type: ColorType;\n};\n\nexport type CMYKColor = {\n c: number;\n m: number;\n y: number;\n k: number;\n type: ColorType;\n};\n\nexport type HSLColor = {\n h: number;\n s: number;\n l: number;\n type: ColorType;\n};\n\nexport type GrayColor = {\n g: number;\n type: ColorType;\n};\n\n/**\n * @deprecated Use SpotColorCMYK or SpotColorRGB instead\n */\nexport type SpotColor = {\n spotName: string;\n c: number;\n m: number;\n y: number;\n k: number;\n type: ColorType;\n};\n\nexport type SpotColorCMYK = {\n spotName: string;\n c: number;\n m: number;\n y: number;\n k: number;\n type: ColorType;\n};\n\nexport type SpotColorRGB = {\n spotName: string;\n r: number;\n g: number;\n b: number;\n type: ColorType;\n};\n\nexport type SpotColorHEX = {\n spotName: string;\n value: string;\n type: ColorType;\n};\n\nexport type HexColor = {\n value: string;\n type: ColorType;\n};\n\nexport type Color =\n | RGBColor\n | CMYKColor\n | HSLColor\n | GrayColor\n | SpotColor\n | HexColor\n | SpotColorCMYK\n | SpotColorRGB\n | SpotColorHEX;\n\nexport type ColorUpdate = Color;\n\nexport type DocumentColor = {\n id: string;\n name: string;\n color: Color;\n};\n\nexport type ColorUsageUpdate = {\n /**\n * Reference to the brand kit color, can only be used if it is a brand kit color.\n */\n id?: Id;\n /**\n * The local color object, can only be used if it is a local color.\n */\n color?: ColorUpdate;\n type: ColorUsageType;\n /**\n * Opacity of the color (0-100) where 0 = fully transparent.\n */\n opacity?: number;\n /**\n * Indicates if the color will be applied or not.\n */\n isApplied?: boolean;\n};\n\nexport type ColorUsage = {\n /**\n * Reference to the brand kit color, can only be used if it is a brand kit color.\n */\n id?: Id;\n /**\n * The local color object, can only be used if it is a local color.\n */\n color?: Color;\n type: ColorUsageType;\n /**\n * Opacity of the color (0-100) where 0 = fully transparent.\n */\n opacity?: number;\n};\n\nexport enum ColorUsageType {\n /**\n * The color is defined locally on the object\n */\n local = 'local',\n /**\n * The color is referencing a document color\n */\n brandKit = 'brandKit',\n /**\n * @deprecated use brandKit instead\n *\n * The color is referencing a brand kit color\n */\n stylekit = 'brandKit',\n}\n"],"names":["APIColorType","ColorType","ColorUsageType"],"mappings":"AAEO,IAAK,iCAAAA,kBAAL;AACHA,gBAAA,KAAA,IAAM;AACNA,gBAAA,KAAA,IAAM;AACNA,gBAAA,MAAA,IAAO;AACPA,gBAAA,UAAA,IAAW;AACXA,gBAAA,SAAA,IAAU;AACVA,gBAAA,SAAA,IAAU;AANF,SAAAA;AAAA,GAAA,gBAAA,CAAA,CAAA;AAQL,IAAK,8BAAAC,eAAL;AACHA,aAAA,KAAA,IAAM;AACNA,aAAA,KAAA,IAAM;AACNA,aAAA,MAAA,IAAO;AACPA,aAAA,MAAA,IAAO;AACPA,aAAA,KAAA,IAAM;AAINA,aAAA,MAAA,IAAO;AACPA,aAAA,UAAA,IAAW;AACXA,aAAA,SAAA,IAAU;AACVA,aAAA,SAAA,IAAU;AAZF,SAAAA;AAAA,GAAA,aAAA,CAAA,CAAA;AAyIL,IAAK,mCAAAC,oBAAL;AAIHA,kBAAA,OAAA,IAAQ;AAIRA,kBAAA,UAAA,IAAW;AAMXA,kBAAA,UAAA,IAAW;AAdH,SAAAA;AAAA,GAAA,kBAAA,CAAA,CAAA;"}
@@ -11,6 +11,7 @@ var LogCategory = /* @__PURE__ */ ((LogCategory2) => {
11
11
  LogCategory2["connector"] = "connector";
12
12
  LogCategory2["event"] = "event";
13
13
  LogCategory2["engine"] = "engine";
14
+ LogCategory2["sdk"] = "sdk";
14
15
  return LogCategory2;
15
16
  })(LogCategory || {});
16
17
  var CallbackErrorBehavior = /* @__PURE__ */ ((CallbackErrorBehavior2) => {
@@ -1 +1 @@
1
- {"version":3,"file":"CommonTypes.cjs.js","sources":["../../../src/types/CommonTypes.ts"],"sourcesContent":["import { CallSender } from 'penpal';\nimport { ConnectorInstance, DocumentAction, DocumentFontFamily, ToolType, ViewMode } from '..';\nimport { EngineCallbackHandler } from '../utils/EngineCallbackHandler';\nimport { EngineEvent } from '../utils/EngineEvent';\nimport { AnimationPlaybackType, FrameAnimationType } from './AnimationTypes';\nimport { BarcodeFrameValidationResult } from './BarcodeTypes';\nimport { CharacterStyle } from './CharacterStyleTypes';\nimport { DocumentColor } from './ColorStyleTypes';\nimport { StudioOptionsDeltaUpdate, StudioStyling } from './ConfigurationTypes';\nimport { AuthCredentials, AuthRefreshRequest, ConnectorEvent } from './ConnectorTypes';\nimport { DocumentIssue, DocumentType, UndoState } from './DocumentTypes';\nimport { EngineEditMode } from './EngineEditModeTypes';\nimport type { FrameType } from './FrameTypes';\nimport { Frame, FrameLayoutType, FrameTypeEnum } from './FrameTypes';\nimport { LayoutListItemType, LayoutPropertiesType, LayoutWithFrameProperties, MeasurementUnit } from './LayoutTypes';\nimport { Page, PageSize } from './PageTypes';\nimport { ParagraphStyle } from './ParagraphStyleTypes';\nimport { CornerRadiusUpdateModel } from './ShapeTypes';\nimport { SelectedTextStyle } from './TextStyleTypes';\nimport { Variable } from './VariableTypes';\nimport { Viewport } from './ViewportTypes';\nimport { BrandKitMedia } from './BrandKitTypes';\nimport { AsyncError } from '../exceptions';\n\nexport type Id = string;\nexport type BaseConfigType = {\n editorLink?: string;\n editorId?: string;\n chiliEnvironmentUrl?: string;\n documentType?: DocumentType;\n studioStyling?: StudioStyling;\n studioOptions?: StudioOptionsDeltaUpdate;\n /**\n * Whether the engine should cache query calls.\n * When enabled it will cache the query calls regardless of the cache control headers.\n */\n enableQueryCallCache?: boolean;\n enableNextSubscribers?: {\n onVariableListChanged: boolean;\n };\n logging?: {\n logLevel?: LogLevel;\n logger?: LoggerFunction;\n };\n /**\n * Callback function that is called when an error occurs during iframe setup or connection.\n * @param error The error that occurred during setup or connection\n */\n onConnectionError?: (error: Error) => void;\n};\n\nexport type LoggerFunction = (logLevel: LogLevel, category: LogCategory, message: string) => void;\n\nexport enum LogLevel {\n info = 'info',\n warn = 'warn',\n error = 'error',\n}\n\nexport enum LogCategory {\n general = 'general',\n connector = 'connector',\n event = 'event',\n engine = 'engine',\n}\n\n/**\n * Defines the behavior when encountering an error in the event / handler callback.\n */\nexport enum CallbackErrorBehavior {\n /**\n * Throws an error when encountering an error in a callback.\n */\n throw = 'throw',\n\n /**\n * Logs the error when encountering an error in a callback.\n */\n log = 'log',\n}\n\nexport type MaybePromise<T> = T | Promise<T>;\n\nexport type ManagedCallbacksConfigType = {\n handlers: {\n onAuthExpired: EngineCallbackHandler<\n (authRefreshRequest: AuthRefreshRequest) => Promise<AuthCredentials | null>\n >;\n onViewportRequested: EngineCallbackHandler<() => Viewport | null>;\n };\n events: {\n onActionsChanged: EngineEvent<(state: DocumentAction[]) => MaybePromise<void>>;\n onStateChanged: EngineEvent<() => MaybePromise<void>>;\n onDocumentLoaded: EngineEvent<() => MaybePromise<void>>;\n onSelectedFramesLayoutChanged: EngineEvent<(states: FrameLayoutType[]) => MaybePromise<void>>;\n onFramesLayoutChanged: EngineEvent<(states: FrameLayoutType[]) => MaybePromise<void>>;\n onSelectedFramesContentChanged: EngineEvent<(state: Frame[]) => MaybePromise<void>>;\n onPageSelectionChanged: EngineEvent<(id: Id) => MaybePromise<void>>;\n onSelectedLayoutPropertiesChanged: EngineEvent<(state: LayoutPropertiesType) => MaybePromise<void>>;\n onSelectedLayoutUnitChanged: EngineEvent<(unit: MeasurementUnit) => MaybePromise<void>>;\n onScrubberPositionChanged: EngineEvent<(state: AnimationPlaybackType) => MaybePromise<void>>;\n onFrameAnimationsChanged: EngineEvent<(animationState: FrameAnimationType[]) => MaybePromise<void>>;\n onVariableListChanged: EngineEvent<(variableList: Variable[]) => MaybePromise<void>>;\n onSelectedToolChanged: EngineEvent<(tool: ToolType) => MaybePromise<void>>;\n onUndoStackStateChanged: EngineEvent<(undoStackState: UndoState) => MaybePromise<void>>;\n onSelectedLayoutFramesChanged: EngineEvent<(frames: SelectedLayoutFrame[]) => MaybePromise<void>>;\n onSelectedTextStyleChanged: EngineEvent<(styles: SelectedTextStyle) => MaybePromise<void>>;\n onColorsChanged: EngineEvent<(colors: DocumentColor[]) => MaybePromise<void>>;\n onParagraphStylesChanged: EngineEvent<(paragraphStyles: ParagraphStyle[]) => MaybePromise<void>>;\n onCharacterStylesChanged: EngineEvent<(characterStyles: CharacterStyle[]) => MaybePromise<void>>;\n onFontFamiliesChanged: EngineEvent<(fontFamilies: DocumentFontFamily[]) => MaybePromise<void>>;\n onSelectedLayoutIdChanged: EngineEvent<(layoutId: string) => MaybePromise<void>>;\n onLayoutsChanged: EngineEvent<(layouts: LayoutListItemType[]) => MaybePromise<void>>;\n onConnectorEvent: EngineEvent<(event: ConnectorEvent) => MaybePromise<void>>;\n onConnectorsChanged: EngineEvent<(connectors: ConnectorInstance[]) => MaybePromise<void>>;\n onZoomChanged: EngineEvent<(scaleFactor: number) => MaybePromise<void>>;\n onSelectedPageIdChanged: EngineEvent<(pageId: Id) => MaybePromise<void>>;\n onPagesChanged: EngineEvent<(pages: Page[]) => MaybePromise<void>>;\n onPageSnapshotInvalidated: EngineEvent<(pageId: Id) => MaybePromise<void>>;\n onPageSizeChanged: EngineEvent<(pageSize: PageSize) => MaybePromise<void>>;\n onShapeCornerRadiusChanged: EngineEvent<(cornerRadius: CornerRadiusUpdateModel) => MaybePromise<void>>;\n onCropActiveFrameIdChanged: EngineEvent<(id?: Id) => MaybePromise<void>>;\n onAsyncError: EngineEvent<(asyncError: AsyncError) => MaybePromise<void>>;\n onViewModeChanged: EngineEvent<(tool: ViewMode) => MaybePromise<void>>;\n onBarcodeValidationChanged: EngineEvent<\n (validationResults: BarcodeFrameValidationResult[]) => MaybePromise<void>\n >;\n onDataSourceIdChanged: EngineEvent<(connectorId?: Id) => MaybePromise<void>>;\n onInjectedDataChanged: EngineEvent<(variableId: Id) => MaybePromise<void>>;\n onDocumentIssueListChanged: EngineEvent<(documentIssues: DocumentIssue[]) => MaybePromise<void>>;\n onCustomUndoDataChanged: EngineEvent<(customData: Record<string, string>) => MaybePromise<void>>;\n onEngineEditModeChanged: EngineEvent<(engineEditMode: EngineEditMode) => MaybePromise<void>>;\n onBrandKitMediaChanged: EngineEvent<(brandKitMedia: BrandKitMedia[]) => MaybePromise<void>>;\n };\n};\n\nexport type InitialCallbacksConfigType = {\n /**\n * @deprecated use `events.onActionsChanged` instead\n */\n onActionsChanged?: (state: DocumentAction[]) => void;\n\n /**\n * @deprecated use `events.onStateChanged` instead\n */\n onStateChanged?: () => void;\n\n /**\n * @deprecated use `events.onAuthExpired` instead\n */\n onAuthExpired?: (authRefreshRequest: AuthRefreshRequest) => Promise<AuthCredentials | null>;\n\n /**\n * @deprecated use `events.onViewportRequested` instead\n */\n onViewportRequested?: () => Viewport | null;\n\n /**\n * @deprecated use `events.onDocumentLoaded` instead\n */\n onDocumentLoaded?: () => void;\n\n /**\n * @deprecated use `onSelectedFramesLayoutChanged` instead\n *\n */\n onSelectedFrameLayoutChanged?: (state: FrameLayoutType) => void;\n\n /**\n * @deprecated use `events.onSelectedFramesLayoutChanged` instead\n */\n onSelectedFramesLayoutChanged?: (states: FrameLayoutType[]) => void;\n\n /**\n * @deprecated use `events.onFramesLayoutChanged` instead\n */\n onFramesLayoutChanged?: (states: FrameLayoutType[]) => void;\n\n /**\n * @deprecated use `onSelectedFramesContentChanged` instead\n */\n onSelectedFrameContentChanged?: (state: Frame | null) => void;\n\n /**\n * @deprecated use `events.onSelectedFramesContentChanged` instead\n */\n onSelectedFramesContentChanged?: (state: Frame[]) => void;\n\n /**\n * @deprecated use `onSelectedPageIdChanged` instead\n */\n onPageSelectionChanged?: (id: Id) => void;\n\n /**\n * @deprecated use `events.onSelectedLayoutPropertiesChanged` instead\n */\n onSelectedLayoutPropertiesChanged?: (state: LayoutPropertiesType) => void;\n\n /**\n * @deprecated use `events.onSelectedLayoutUnitChanged` instead\n */\n onSelectedLayoutUnitChanged?: (unit: MeasurementUnit) => void;\n\n /**\n * @deprecated use `events.onScrubberPositionChanged` instead\n */\n onScrubberPositionChanged?: (state: AnimationPlaybackType) => void;\n\n /**\n * @deprecated use `events.onFrameAnimationsChanged` instead\n */\n onFrameAnimationsChanged?: (animationState: FrameAnimationType[]) => void;\n\n /**\n * @deprecated use `events.onVariableListChanged` instead\n */\n onVariableListChanged?: (variableList: Variable[]) => void;\n\n /**\n * @deprecated use `events.onSelectedToolChanged` instead\n */\n onSelectedToolChanged?: (tool: ToolType) => void;\n\n /**\n * @deprecated use `events.onUndoStackStateChanged` instead\n */\n onUndoStackStateChanged?: (undoStackState: UndoState) => void;\n\n /**\n * @deprecated use `events.onSelectedLayoutFramesChanged` instead\n */\n onSelectedLayoutFramesChanged?: (frames: SelectedLayoutFrame[]) => void;\n\n /**\n * @deprecated use `events.onSelectedTextStyleChanged` instead\n */\n onSelectedTextStyleChanged?: (styles: SelectedTextStyle) => void;\n\n /**\n * @deprecated use `events.onColorsChanged` instead\n */\n onColorsChanged?: (colors: DocumentColor[]) => void;\n\n /**\n * @deprecated use `events.onParagraphStylesChanged` instead\n */\n onParagraphStylesChanged?: (paragraphStyles: ParagraphStyle[]) => void;\n\n /**\n * @deprecated use `events.onCharacterStylesChanged` instead\n */\n onCharacterStylesChanged?: (characterStyles: CharacterStyle[]) => void;\n\n /**\n * @deprecated use `events.onFontFamiliesChanged` instead\n */\n onFontFamiliesChanged?: (fontFamilies: DocumentFontFamily[]) => void;\n\n /**\n * @deprecated use `events.onSelectedLayoutIdChanged` instead\n */\n onSelectedLayoutIdChanged?: (layoutId: string) => void;\n\n /**\n * @deprecated use `events.onLayoutsChanged` instead\n */\n onLayoutsChanged?: (layouts: LayoutListItemType[]) => void;\n\n /**\n * @deprecated use `events.onConnectorEvent` instead\n */\n onConnectorEvent?: (event: ConnectorEvent) => void;\n\n /**\n * @deprecated use `events.onConnectorsChanged` instead\n */\n onConnectorsChanged?: (connectors: ConnectorInstance[]) => void;\n\n /**\n * @deprecated use `events.onZoomChanged` instead\n */\n onZoomChanged?: (scaleFactor: number) => void;\n\n /**\n *\n * @deprecated use `events.onSelectedPageIdChanged` instead\n */\n onSelectedPageIdChanged?: (pageId: Id) => void;\n\n /**\n *\n * @deprecated use `events.onPagesChanged` instead\n */\n onPagesChanged?: (pages: Page[]) => void;\n\n /**\n *\n * @deprecated use `events.onPageSnapshotInvalidated` instead\n */\n onPageSnapshotInvalidated?: (pageId: Id) => void;\n\n /**\n * @deprecated use `events.onPageSizeChanged` instead\n */\n onPageSizeChanged?: (pageSize: PageSize) => void;\n\n /**\n * @deprecated use `events.onShapeCornerRadiusChanged` instead\n */\n onShapeCornerRadiusChanged?: (cornerRadius: CornerRadiusUpdateModel) => void;\n\n /**\n * @deprecated use `events.onCropActiveFrameIdChanged` instead\n */\n onCropActiveFrameIdChanged?: (id?: Id) => void;\n\n /**\n * @deprecated use `events.onAsyncError` instead\n */\n onAsyncError?: (asyncError: AsyncError) => void;\n\n /**\n * @deprecated use `events.onViewModeChanged` instead\n */\n onViewModeChanged?: (tool: ViewMode) => void;\n\n /**\n * @deprecated use `events.onBarcodeValidationChanged` instead\n */\n onBarcodeValidationChanged?: (validationResults: BarcodeFrameValidationResult[]) => void;\n\n /**\n * @deprecated use `events.onDataSourceIdChanged` instead\n */\n onDataSourceIdChanged?: (connectorId?: Id) => void;\n\n /**\n * @deprecated use `events.onInjectedDataChanged` instead\n */\n onInjectedDataChanged?: (variableId: Id) => void;\n\n /**\n * @deprecated use `events.onDocumentIssueListChanged` instead\n */\n onDocumentIssueListChanged?: (documentIssues: DocumentIssue[]) => void;\n\n /**\n * @deprecated use `events.onCustomUndoDataChanged` instead\n */\n onCustomUndoDataChanged?: (customData: Record<string, string>) => void;\n\n /**\n * @deprecated use `events.onEngineEditModeChanged` instead\n */\n onEngineEditModeChanged?: (engineEditMode: EngineEditMode) => void;\n\n /**\n * @deprecated use `events.onBrandKitMediaChanged` instead\n */\n onBrandKitMediaChanged?: (brandKitMedia: BrandKitMedia[]) => void;\n};\n\nexport type ConfigType = InitialCallbacksConfigType & BaseConfigType;\nexport type RuntimeConfigType = ConfigType & ManagedCallbacksConfigType;\n\nexport type EditorResponseError = string;\n\nexport interface EditorResponse<T> {\n success: boolean;\n status: number;\n data?: string | null;\n error?: EditorResponseError | null;\n parsedData: T | null;\n}\n\nexport interface EditorRawAPI extends CallSender {\n [index: string]: <T>(...args: unknown[]) => Promise<T>;\n}\n\nexport interface EditorAPI extends CallSender {\n [index: string]: <T>(...args: unknown[]) => Promise<EditorResponse<T>>;\n}\n\nexport type PageType = {\n id: Id;\n number: number;\n width: number | null;\n height: number | null;\n frames: FrameType[];\n};\n\nexport type InitialStateType = {\n layouts: LayoutWithFrameProperties[];\n selectedLayoutId: Id;\n pages: PageType[];\n variables: Variable[];\n};\n\nexport interface PropertyState<T> {\n value: T;\n isOverride: boolean;\n isReadOnly: boolean;\n}\n\nexport interface HasOverrideState {\n isOverride: boolean;\n isReadOnly: boolean;\n}\n\nexport interface SelectedLayoutFrame {\n id: Id;\n name: string;\n type: FrameTypeEnum;\n isVisible: boolean;\n}\n\nexport type PrivateData = Record<string, string>;\n\nexport class SDKUnauthorizedError extends Error {\n constructor(message: string) {\n super(message);\n }\n}\n"],"names":["LogLevel","LogCategory","CallbackErrorBehavior"],"mappings":";;AAqDO,IAAK,6BAAAA,cAAL;AACHA,YAAA,MAAA,IAAO;AACPA,YAAA,MAAA,IAAO;AACPA,YAAA,OAAA,IAAQ;AAHA,SAAAA;AAAA,GAAA,YAAA,CAAA,CAAA;AAML,IAAK,gCAAAC,iBAAL;AACHA,eAAA,SAAA,IAAU;AACVA,eAAA,WAAA,IAAY;AACZA,eAAA,OAAA,IAAQ;AACRA,eAAA,QAAA,IAAS;AAJD,SAAAA;AAAA,GAAA,eAAA,CAAA,CAAA;AAUL,IAAK,0CAAAC,2BAAL;AAIHA,yBAAA,OAAA,IAAQ;AAKRA,yBAAA,KAAA,IAAM;AATE,SAAAA;AAAA,GAAA,yBAAA,CAAA,CAAA;AA6VL,MAAM,6BAA6B,MAAM;AAAA,EAC5C,YAAY,SAAiB;AACzB,UAAM,OAAO;AAAA,EACjB;AACJ;;;;;"}
1
+ {"version":3,"file":"CommonTypes.cjs.js","sources":["../../../src/types/CommonTypes.ts"],"sourcesContent":["import { CallSender } from 'penpal';\nimport { ConnectorInstance, DocumentAction, DocumentFontFamily, ToolType, ViewMode } from '..';\nimport { EngineCallbackHandler } from '../utils/EngineCallbackHandler';\nimport { EngineEvent } from '../utils/EngineEvent';\nimport { AnimationPlaybackType, FrameAnimationType } from './AnimationTypes';\nimport { BarcodeFrameValidationResult } from './BarcodeTypes';\nimport { CharacterStyle } from './CharacterStyleTypes';\nimport { DocumentColor } from './ColorStyleTypes';\nimport { StudioOptionsDeltaUpdate, StudioStyling } from './ConfigurationTypes';\nimport { AuthCredentials, AuthRefreshRequest, ConnectorEvent } from './ConnectorTypes';\nimport { DocumentIssue, DocumentType, UndoState } from './DocumentTypes';\nimport { EngineEditMode } from './EngineEditModeTypes';\nimport type { FrameType } from './FrameTypes';\nimport { Frame, FrameLayoutType, FrameTypeEnum } from './FrameTypes';\nimport { LayoutListItemType, LayoutPropertiesType, LayoutWithFrameProperties, MeasurementUnit } from './LayoutTypes';\nimport { Page, PageSize } from './PageTypes';\nimport { ParagraphStyle } from './ParagraphStyleTypes';\nimport { CornerRadiusUpdateModel } from './ShapeTypes';\nimport { SelectedTextStyle } from './TextStyleTypes';\nimport { Variable } from './VariableTypes';\nimport { Viewport } from './ViewportTypes';\nimport { BrandKitMedia } from './BrandKitTypes';\nimport { AsyncError } from '../exceptions';\n\nexport type Id = string;\nexport type BaseConfigType = {\n editorLink?: string;\n editorId?: string;\n chiliEnvironmentUrl?: string;\n documentType?: DocumentType;\n studioStyling?: StudioStyling;\n studioOptions?: StudioOptionsDeltaUpdate;\n /**\n * Whether the engine should cache query calls.\n * When enabled it will cache the query calls regardless of the cache control headers.\n */\n enableQueryCallCache?: boolean;\n enableNextSubscribers?: {\n onVariableListChanged: boolean;\n };\n logging?: {\n logLevel?: LogLevel;\n logger?: LoggerFunction;\n };\n /**\n * Callback function that is called when an error occurs during iframe setup or connection.\n * @param error The error that occurred during setup or connection\n */\n onConnectionError?: (error: Error) => void;\n};\n\nexport type LoggerFunction = (logLevel: LogLevel, category: LogCategory, message: string) => void;\n\nexport enum LogLevel {\n info = 'info',\n warn = 'warn',\n error = 'error',\n}\n\nexport enum LogCategory {\n general = 'general',\n connector = 'connector',\n event = 'event',\n engine = 'engine',\n sdk = 'sdk',\n}\n\n/**\n * Defines the behavior when encountering an error in the event / handler callback.\n */\nexport enum CallbackErrorBehavior {\n /**\n * Throws an error when encountering an error in a callback.\n */\n throw = 'throw',\n\n /**\n * Logs the error when encountering an error in a callback.\n */\n log = 'log',\n}\n\nexport type MaybePromise<T> = T | Promise<T>;\n\nexport type ManagedCallbacksConfigType = {\n handlers: {\n onAuthExpired: EngineCallbackHandler<\n (authRefreshRequest: AuthRefreshRequest) => Promise<AuthCredentials | null>\n >;\n onViewportRequested: EngineCallbackHandler<() => Viewport | null>;\n };\n events: {\n onActionsChanged: EngineEvent<(state: DocumentAction[]) => MaybePromise<void>>;\n onStateChanged: EngineEvent<() => MaybePromise<void>>;\n onDocumentLoaded: EngineEvent<() => MaybePromise<void>>;\n onSelectedFramesLayoutChanged: EngineEvent<(states: FrameLayoutType[]) => MaybePromise<void>>;\n onFramesLayoutChanged: EngineEvent<(states: FrameLayoutType[]) => MaybePromise<void>>;\n onSelectedFramesContentChanged: EngineEvent<(state: Frame[]) => MaybePromise<void>>;\n onPageSelectionChanged: EngineEvent<(id: Id) => MaybePromise<void>>;\n onSelectedLayoutPropertiesChanged: EngineEvent<(state: LayoutPropertiesType) => MaybePromise<void>>;\n onSelectedLayoutUnitChanged: EngineEvent<(unit: MeasurementUnit) => MaybePromise<void>>;\n onScrubberPositionChanged: EngineEvent<(state: AnimationPlaybackType) => MaybePromise<void>>;\n onFrameAnimationsChanged: EngineEvent<(animationState: FrameAnimationType[]) => MaybePromise<void>>;\n onVariableListChanged: EngineEvent<(variableList: Variable[]) => MaybePromise<void>>;\n onSelectedToolChanged: EngineEvent<(tool: ToolType) => MaybePromise<void>>;\n onUndoStackStateChanged: EngineEvent<(undoStackState: UndoState) => MaybePromise<void>>;\n onSelectedLayoutFramesChanged: EngineEvent<(frames: SelectedLayoutFrame[]) => MaybePromise<void>>;\n onSelectedTextStyleChanged: EngineEvent<(styles: SelectedTextStyle) => MaybePromise<void>>;\n onColorsChanged: EngineEvent<(colors: DocumentColor[]) => MaybePromise<void>>;\n onParagraphStylesChanged: EngineEvent<(paragraphStyles: ParagraphStyle[]) => MaybePromise<void>>;\n onCharacterStylesChanged: EngineEvent<(characterStyles: CharacterStyle[]) => MaybePromise<void>>;\n onFontFamiliesChanged: EngineEvent<(fontFamilies: DocumentFontFamily[]) => MaybePromise<void>>;\n onSelectedLayoutIdChanged: EngineEvent<(layoutId: string) => MaybePromise<void>>;\n onLayoutsChanged: EngineEvent<(layouts: LayoutListItemType[]) => MaybePromise<void>>;\n onConnectorEvent: EngineEvent<(event: ConnectorEvent) => MaybePromise<void>>;\n onConnectorsChanged: EngineEvent<(connectors: ConnectorInstance[]) => MaybePromise<void>>;\n onZoomChanged: EngineEvent<(scaleFactor: number) => MaybePromise<void>>;\n onSelectedPageIdChanged: EngineEvent<(pageId: Id) => MaybePromise<void>>;\n onPagesChanged: EngineEvent<(pages: Page[]) => MaybePromise<void>>;\n onPageSnapshotInvalidated: EngineEvent<(pageId: Id) => MaybePromise<void>>;\n onPageSizeChanged: EngineEvent<(pageSize: PageSize) => MaybePromise<void>>;\n onShapeCornerRadiusChanged: EngineEvent<(cornerRadius: CornerRadiusUpdateModel) => MaybePromise<void>>;\n onCropActiveFrameIdChanged: EngineEvent<(id?: Id) => MaybePromise<void>>;\n onAsyncError: EngineEvent<(asyncError: AsyncError) => MaybePromise<void>>;\n onViewModeChanged: EngineEvent<(tool: ViewMode) => MaybePromise<void>>;\n onBarcodeValidationChanged: EngineEvent<\n (validationResults: BarcodeFrameValidationResult[]) => MaybePromise<void>\n >;\n onDataSourceIdChanged: EngineEvent<(connectorId?: Id) => MaybePromise<void>>;\n onInjectedDataChanged: EngineEvent<(variableId: Id) => MaybePromise<void>>;\n onDocumentIssueListChanged: EngineEvent<(documentIssues: DocumentIssue[]) => MaybePromise<void>>;\n onCustomUndoDataChanged: EngineEvent<(customData: Record<string, string>) => MaybePromise<void>>;\n onEngineEditModeChanged: EngineEvent<(engineEditMode: EngineEditMode) => MaybePromise<void>>;\n onBrandKitMediaChanged: EngineEvent<(brandKitMedia: BrandKitMedia[]) => MaybePromise<void>>;\n /**\n * Listener that fires when frames are manipulated (e.g. moved, resized, rotated, cropped, text changed) by the user.\n * Note: this event only fires when the manipulation was caused by direct user interaction on the canvas;\n * programmatic changes do not trigger this event.\n */\n onCanvasFramesManipulated: EngineEvent<(frameIds: Id[]) => MaybePromise<void>>;\n };\n};\n\nexport type InitialCallbacksConfigType = {\n /**\n * @deprecated use `events.onActionsChanged` instead\n */\n onActionsChanged?: (state: DocumentAction[]) => void;\n\n /**\n * @deprecated use `events.onStateChanged` instead\n */\n onStateChanged?: () => void;\n\n /**\n * @deprecated use `events.onAuthExpired` instead\n */\n onAuthExpired?: (authRefreshRequest: AuthRefreshRequest) => Promise<AuthCredentials | null>;\n\n /**\n * @deprecated use `events.onViewportRequested` instead\n */\n onViewportRequested?: () => Viewport | null;\n\n /**\n * @deprecated use `events.onDocumentLoaded` instead\n */\n onDocumentLoaded?: () => void;\n\n /**\n * @deprecated use `onSelectedFramesLayoutChanged` instead\n *\n */\n onSelectedFrameLayoutChanged?: (state: FrameLayoutType) => void;\n\n /**\n * @deprecated use `events.onSelectedFramesLayoutChanged` instead\n */\n onSelectedFramesLayoutChanged?: (states: FrameLayoutType[]) => void;\n\n /**\n * @deprecated use `events.onFramesLayoutChanged` instead\n */\n onFramesLayoutChanged?: (states: FrameLayoutType[]) => void;\n\n /**\n * @deprecated use `onSelectedFramesContentChanged` instead\n */\n onSelectedFrameContentChanged?: (state: Frame | null) => void;\n\n /**\n * @deprecated use `events.onSelectedFramesContentChanged` instead\n */\n onSelectedFramesContentChanged?: (state: Frame[]) => void;\n\n /**\n * @deprecated use `onSelectedPageIdChanged` instead\n */\n onPageSelectionChanged?: (id: Id) => void;\n\n /**\n * @deprecated use `events.onSelectedLayoutPropertiesChanged` instead\n */\n onSelectedLayoutPropertiesChanged?: (state: LayoutPropertiesType) => void;\n\n /**\n * @deprecated use `events.onSelectedLayoutUnitChanged` instead\n */\n onSelectedLayoutUnitChanged?: (unit: MeasurementUnit) => void;\n\n /**\n * @deprecated use `events.onScrubberPositionChanged` instead\n */\n onScrubberPositionChanged?: (state: AnimationPlaybackType) => void;\n\n /**\n * @deprecated use `events.onFrameAnimationsChanged` instead\n */\n onFrameAnimationsChanged?: (animationState: FrameAnimationType[]) => void;\n\n /**\n * @deprecated use `events.onVariableListChanged` instead\n */\n onVariableListChanged?: (variableList: Variable[]) => void;\n\n /**\n * @deprecated use `events.onSelectedToolChanged` instead\n */\n onSelectedToolChanged?: (tool: ToolType) => void;\n\n /**\n * @deprecated use `events.onUndoStackStateChanged` instead\n */\n onUndoStackStateChanged?: (undoStackState: UndoState) => void;\n\n /**\n * @deprecated use `events.onSelectedLayoutFramesChanged` instead\n */\n onSelectedLayoutFramesChanged?: (frames: SelectedLayoutFrame[]) => void;\n\n /**\n * @deprecated use `events.onSelectedTextStyleChanged` instead\n */\n onSelectedTextStyleChanged?: (styles: SelectedTextStyle) => void;\n\n /**\n * @deprecated use `events.onColorsChanged` instead\n */\n onColorsChanged?: (colors: DocumentColor[]) => void;\n\n /**\n * @deprecated use `events.onParagraphStylesChanged` instead\n */\n onParagraphStylesChanged?: (paragraphStyles: ParagraphStyle[]) => void;\n\n /**\n * @deprecated use `events.onCharacterStylesChanged` instead\n */\n onCharacterStylesChanged?: (characterStyles: CharacterStyle[]) => void;\n\n /**\n * @deprecated use `events.onFontFamiliesChanged` instead\n */\n onFontFamiliesChanged?: (fontFamilies: DocumentFontFamily[]) => void;\n\n /**\n * @deprecated use `events.onSelectedLayoutIdChanged` instead\n */\n onSelectedLayoutIdChanged?: (layoutId: string) => void;\n\n /**\n * @deprecated use `events.onLayoutsChanged` instead\n */\n onLayoutsChanged?: (layouts: LayoutListItemType[]) => void;\n\n /**\n * @deprecated use `events.onConnectorEvent` instead\n */\n onConnectorEvent?: (event: ConnectorEvent) => void;\n\n /**\n * @deprecated use `events.onConnectorsChanged` instead\n */\n onConnectorsChanged?: (connectors: ConnectorInstance[]) => void;\n\n /**\n * @deprecated use `events.onZoomChanged` instead\n */\n onZoomChanged?: (scaleFactor: number) => void;\n\n /**\n *\n * @deprecated use `events.onSelectedPageIdChanged` instead\n */\n onSelectedPageIdChanged?: (pageId: Id) => void;\n\n /**\n *\n * @deprecated use `events.onPagesChanged` instead\n */\n onPagesChanged?: (pages: Page[]) => void;\n\n /**\n *\n * @deprecated use `events.onPageSnapshotInvalidated` instead\n */\n onPageSnapshotInvalidated?: (pageId: Id) => void;\n\n /**\n * @deprecated use `events.onPageSizeChanged` instead\n */\n onPageSizeChanged?: (pageSize: PageSize) => void;\n\n /**\n * @deprecated use `events.onShapeCornerRadiusChanged` instead\n */\n onShapeCornerRadiusChanged?: (cornerRadius: CornerRadiusUpdateModel) => void;\n\n /**\n * @deprecated use `events.onCropActiveFrameIdChanged` instead\n */\n onCropActiveFrameIdChanged?: (id?: Id) => void;\n\n /**\n * @deprecated use `events.onAsyncError` instead\n */\n onAsyncError?: (asyncError: AsyncError) => void;\n\n /**\n * @deprecated use `events.onViewModeChanged` instead\n */\n onViewModeChanged?: (tool: ViewMode) => void;\n\n /**\n * @deprecated use `events.onBarcodeValidationChanged` instead\n */\n onBarcodeValidationChanged?: (validationResults: BarcodeFrameValidationResult[]) => void;\n\n /**\n * @deprecated use `events.onDataSourceIdChanged` instead\n */\n onDataSourceIdChanged?: (connectorId?: Id) => void;\n\n /**\n * @deprecated use `events.onInjectedDataChanged` instead\n */\n onInjectedDataChanged?: (variableId: Id) => void;\n\n /**\n * @deprecated use `events.onDocumentIssueListChanged` instead\n */\n onDocumentIssueListChanged?: (documentIssues: DocumentIssue[]) => void;\n\n /**\n * @deprecated use `events.onCustomUndoDataChanged` instead\n */\n onCustomUndoDataChanged?: (customData: Record<string, string>) => void;\n\n /**\n * @deprecated use `events.onEngineEditModeChanged` instead\n */\n onEngineEditModeChanged?: (engineEditMode: EngineEditMode) => void;\n\n /**\n * @deprecated use `events.onBrandKitMediaChanged` instead\n */\n onBrandKitMediaChanged?: (brandKitMedia: BrandKitMedia[]) => void;\n\n /**\n * @deprecated use `events.onCanvasFramesManipulated` instead\n */\n onCanvasFramesManipulated?: (frameIds: Id[]) => void;\n};\n\nexport type ConfigType = InitialCallbacksConfigType & BaseConfigType;\nexport type RuntimeConfigType = ConfigType & ManagedCallbacksConfigType;\n\nexport type EditorResponseError = string;\n\nexport interface EditorResponse<T> {\n success: boolean;\n status: number;\n data?: string | null;\n error?: EditorResponseError | null;\n parsedData: T | null;\n}\n\nexport interface EditorRawAPI extends CallSender {\n [index: string]: <T>(...args: unknown[]) => Promise<T>;\n}\n\nexport interface EditorAPI extends CallSender {\n [index: string]: <T>(...args: unknown[]) => Promise<EditorResponse<T>>;\n}\n\nexport type PageType = {\n id: Id;\n number: number;\n width: number | null;\n height: number | null;\n frames: FrameType[];\n};\n\nexport type InitialStateType = {\n layouts: LayoutWithFrameProperties[];\n selectedLayoutId: Id;\n pages: PageType[];\n variables: Variable[];\n};\n\nexport interface PropertyState<T> {\n value: T;\n isOverride: boolean;\n isReadOnly: boolean;\n}\n\nexport interface HasOverrideState {\n isOverride: boolean;\n isReadOnly: boolean;\n}\n\nexport interface SelectedLayoutFrame {\n id: Id;\n name: string;\n type: FrameTypeEnum;\n isVisible: boolean;\n}\n\nexport type PrivateData = Record<string, string>;\n\nexport class SDKUnauthorizedError extends Error {\n constructor(message: string) {\n super(message);\n }\n}\n"],"names":["LogLevel","LogCategory","CallbackErrorBehavior"],"mappings":";;AAqDO,IAAK,6BAAAA,cAAL;AACHA,YAAA,MAAA,IAAO;AACPA,YAAA,MAAA,IAAO;AACPA,YAAA,OAAA,IAAQ;AAHA,SAAAA;AAAA,GAAA,YAAA,CAAA,CAAA;AAML,IAAK,gCAAAC,iBAAL;AACHA,eAAA,SAAA,IAAU;AACVA,eAAA,WAAA,IAAY;AACZA,eAAA,OAAA,IAAQ;AACRA,eAAA,QAAA,IAAS;AACTA,eAAA,KAAA,IAAM;AALE,SAAAA;AAAA,GAAA,eAAA,CAAA,CAAA;AAWL,IAAK,0CAAAC,2BAAL;AAIHA,yBAAA,OAAA,IAAQ;AAKRA,yBAAA,KAAA,IAAM;AATE,SAAAA;AAAA,GAAA,yBAAA,CAAA,CAAA;AAwWL,MAAM,6BAA6B,MAAM;AAAA,EAC5C,YAAY,SAAiB;AACzB,UAAM,OAAO;AAAA,EACjB;AACJ;;;;;"}
@@ -56,7 +56,8 @@ export declare enum LogCategory {
56
56
  general = "general",
57
57
  connector = "connector",
58
58
  event = "event",
59
- engine = "engine"
59
+ engine = "engine",
60
+ sdk = "sdk"
60
61
  }
61
62
  /**
62
63
  * Defines the behavior when encountering an error in the event / handler callback.
@@ -118,6 +119,12 @@ export type ManagedCallbacksConfigType = {
118
119
  onCustomUndoDataChanged: EngineEvent<(customData: Record<string, string>) => MaybePromise<void>>;
119
120
  onEngineEditModeChanged: EngineEvent<(engineEditMode: EngineEditMode) => MaybePromise<void>>;
120
121
  onBrandKitMediaChanged: EngineEvent<(brandKitMedia: BrandKitMedia[]) => MaybePromise<void>>;
122
+ /**
123
+ * Listener that fires when frames are manipulated (e.g. moved, resized, rotated, cropped, text changed) by the user.
124
+ * Note: this event only fires when the manipulation was caused by direct user interaction on the canvas;
125
+ * programmatic changes do not trigger this event.
126
+ */
127
+ onCanvasFramesManipulated: EngineEvent<(frameIds: Id[]) => MaybePromise<void>>;
121
128
  };
122
129
  };
123
130
  export type InitialCallbacksConfigType = {
@@ -301,6 +308,10 @@ export type InitialCallbacksConfigType = {
301
308
  * @deprecated use `events.onBrandKitMediaChanged` instead
302
309
  */
303
310
  onBrandKitMediaChanged?: (brandKitMedia: BrandKitMedia[]) => void;
311
+ /**
312
+ * @deprecated use `events.onCanvasFramesManipulated` instead
313
+ */
314
+ onCanvasFramesManipulated?: (frameIds: Id[]) => void;
304
315
  };
305
316
  export type ConfigType = InitialCallbacksConfigType & BaseConfigType;
306
317
  export type RuntimeConfigType = ConfigType & ManagedCallbacksConfigType;
@@ -9,6 +9,7 @@ var LogCategory = /* @__PURE__ */ ((LogCategory2) => {
9
9
  LogCategory2["connector"] = "connector";
10
10
  LogCategory2["event"] = "event";
11
11
  LogCategory2["engine"] = "engine";
12
+ LogCategory2["sdk"] = "sdk";
12
13
  return LogCategory2;
13
14
  })(LogCategory || {});
14
15
  var CallbackErrorBehavior = /* @__PURE__ */ ((CallbackErrorBehavior2) => {