@supernova-studio/supernova-sdk-beta 1.6.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +144 -0
- package/build/sdk-typescript/src/browser-bundle.d.ts +1 -0
- package/build/sdk-typescript/src/core/SDKBrand.d.ts +80 -0
- package/build/sdk-typescript/src/core/SDKBrandWriter.d.ts +29 -0
- package/build/sdk-typescript/src/core/SDKDesignSystem.d.ts +62 -0
- package/build/sdk-typescript/src/core/SDKDesignSystemVersion.d.ts +99 -0
- package/build/sdk-typescript/src/core/SDKDocumentation.d.ts +55 -0
- package/build/sdk-typescript/src/core/SDKSupernova.d.ts +46 -0
- package/build/sdk-typescript/src/core/SDKWorkspace.d.ts +26 -0
- package/build/sdk-typescript/src/core/data/SDKConfiguration.d.ts +6 -0
- package/build/sdk-typescript/src/core/data/SDKDataBridge.d.ts +50 -0
- package/build/sdk-typescript/src/core/data/SDKDataCore.d.ts +141 -0
- package/build/sdk-typescript/src/core/errors/SDKSupernovaError.d.ts +24 -0
- package/build/sdk-typescript/src/core/resolvers/SDKAssetGroupResolver.d.ts +14 -0
- package/build/sdk-typescript/src/core/resolvers/SDKComponentResolver.d.ts +8 -0
- package/build/sdk-typescript/src/core/resolvers/SDKDesignComponentGroupResolver.d.ts +13 -0
- package/build/sdk-typescript/src/core/resolvers/SDKDocumentationItemResolver.d.ts +32 -0
- package/build/sdk-typescript/src/core/resolvers/SDKTokenGroupResolver.d.ts +11 -0
- package/build/sdk-typescript/src/core/resolvers/SDKTokenResolver.d.ts +76 -0
- package/build/sdk-typescript/src/exports.d.ts +117 -0
- package/build/sdk-typescript/src/index.d.ts +1 -0
- package/build/sdk-typescript/src/model/assets/SDKAsset.d.ts +16 -0
- package/build/sdk-typescript/src/model/assets/SDKRenderedAsset.d.ts +28 -0
- package/build/sdk-typescript/src/model/components/SDKComponent.d.ts +27 -0
- package/build/sdk-typescript/src/model/components/SDKDesignComponent.d.ts +32 -0
- package/build/sdk-typescript/src/model/documentation/SDKDocumentationConfiguration.d.ts +13 -0
- package/build/sdk-typescript/src/model/documentation/SDKDocumentationGroup.d.ts +38 -0
- package/build/sdk-typescript/src/model/documentation/SDKDocumentationItem.d.ts +26 -0
- package/build/sdk-typescript/src/model/documentation/SDKDocumentationPage.d.ts +31 -0
- package/build/sdk-typescript/src/model/documentation/SDKDocumentationPageAsset.d.ts +15 -0
- package/build/sdk-typescript/src/model/documentation/SDKDocumentationPageBlock.d.ts +32 -0
- package/build/sdk-typescript/src/model/documentation/SDKDocumentationRichText.d.ts +10 -0
- package/build/sdk-typescript/src/model/documentation/SDKDocumentationRichTextSpan.d.ts +10 -0
- package/build/sdk-typescript/src/model/documentation/SDKDocumentationRichTextSpanAttribute.d.ts +14 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockAsset.d.ts +15 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockAssets.d.ts +24 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockCallout.d.ts +11 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockCode.d.ts +12 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockColumn.d.ts +8 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockColumnItem.d.ts +11 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockCustom.d.ts +16 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockDivider.d.ts +8 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockEmbedFigma.d.ts +8 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockEmbedGeneric.d.ts +15 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockEmbedLink.d.ts +16 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockEmbedStorybook.d.ts +8 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockEmbedYoutube.d.ts +8 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockFrame.d.ts +18 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockFrames.d.ts +26 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockHeading.d.ts +11 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockImage.d.ts +18 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockOrderedList.d.ts +8 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockQuote.d.ts +8 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockRenderCode.d.ts +34 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockShortcut.d.ts +35 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockShortcuts.d.ts +11 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockTab.d.ts +8 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockTabItem.d.ts +10 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockTable.d.ts +23 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockTableCell.d.ts +13 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockTableColumn.d.ts +10 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockTableRow.d.ts +8 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockText.d.ts +13 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockToken.d.ts +10 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockTokenGroup.d.ts +12 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockTokenList.d.ts +10 -0
- package/build/sdk-typescript/src/model/documentation/blocks/SDKDocumentationPageBlockUnorderedList.d.ts +8 -0
- package/build/sdk-typescript/src/model/documentation/builder/SDKDocumentationBlockBuilder.d.ts +6 -0
- package/build/sdk-typescript/src/model/documentation/configuration/SDKDocumentationItemConfiguration.d.ts +10 -0
- package/build/sdk-typescript/src/model/documentation/configuration/SDKDocumentationItemHeader.d.ts +30 -0
- package/build/sdk-typescript/src/model/elements/SDKElementDataView.d.ts +30 -0
- package/build/sdk-typescript/src/model/elements/SDKElementDataViewColumn.d.ts +37 -0
- package/build/sdk-typescript/src/model/elements/SDKElementProperty.d.ts +56 -0
- package/build/sdk-typescript/src/model/elements/SDKElementPropertyOption.d.ts +13 -0
- package/build/sdk-typescript/src/model/elements/values/SDKElementPropertyValue.d.ts +15 -0
- package/build/sdk-typescript/src/model/enums/SDKAlignment.d.ts +5 -0
- package/build/sdk-typescript/src/model/enums/SDKAssetFormat.d.ts +5 -0
- package/build/sdk-typescript/src/model/enums/SDKAssetScale.d.ts +6 -0
- package/build/sdk-typescript/src/model/enums/SDKAssetScaleType.d.ts +4 -0
- package/build/sdk-typescript/src/model/enums/SDKBlurType.d.ts +4 -0
- package/build/sdk-typescript/src/model/enums/SDKBorderPosition.d.ts +5 -0
- package/build/sdk-typescript/src/model/enums/SDKDocumentationCalloutType.d.ts +6 -0
- package/build/sdk-typescript/src/model/enums/SDKDocumentationGroupBehavior.d.ts +4 -0
- package/build/sdk-typescript/src/model/enums/SDKDocumentationHeadingType.d.ts +5 -0
- package/build/sdk-typescript/src/model/enums/SDKDocumentationItemType.d.ts +4 -0
- package/build/sdk-typescript/src/model/enums/SDKDocumentationPageAssetType.d.ts +4 -0
- package/build/sdk-typescript/src/model/enums/SDKDocumentationPageBlockThemeType.d.ts +4 -0
- package/build/sdk-typescript/src/model/enums/SDKDocumentationPageBlockType.d.ts +31 -0
- package/build/sdk-typescript/src/model/enums/SDKFrameAlignment.d.ts +4 -0
- package/build/sdk-typescript/src/model/enums/SDKFrameLayout.d.ts +11 -0
- package/build/sdk-typescript/src/model/enums/SDKGradientType.d.ts +5 -0
- package/build/sdk-typescript/src/model/enums/SDKRichTextSpanAttributeType.d.ts +7 -0
- package/build/sdk-typescript/src/model/enums/SDKShadowType.d.ts +4 -0
- package/build/sdk-typescript/src/model/enums/SDKSourceType.d.ts +4 -0
- package/build/sdk-typescript/src/model/enums/SDKTextCase.d.ts +6 -0
- package/build/sdk-typescript/src/model/enums/SDKTextDecoration.d.ts +5 -0
- package/build/sdk-typescript/src/model/enums/SDKTokenType.d.ts +13 -0
- package/build/sdk-typescript/src/model/enums/SDKUnit.d.ts +6 -0
- package/build/sdk-typescript/src/model/exporters/SDKExporter.d.ts +74 -0
- package/build/sdk-typescript/src/model/exporters/custom_blocks/SDKExporterCustomBlock.d.ts +23 -0
- package/build/sdk-typescript/src/model/exporters/custom_blocks/SDKExporterCustomBlockProperty.d.ts +32 -0
- package/build/sdk-typescript/src/model/exporters/custom_blocks/SDKExporterCustomBlockVariant.d.ts +12 -0
- package/build/sdk-typescript/src/model/exporters/custom_properties/SDKExporterConfigurationProperty.d.ts +38 -0
- package/build/sdk-typescript/src/model/groups/SDKAssetGroup.d.ts +20 -0
- package/build/sdk-typescript/src/model/groups/SDKDesignComponentGroup.d.ts +33 -0
- package/build/sdk-typescript/src/model/groups/SDKTokenGroup.d.ts +42 -0
- package/build/sdk-typescript/src/model/support/SDKDesignComponentOrigin.d.ts +23 -0
- package/build/sdk-typescript/src/model/support/SDKFrameOrigin.d.ts +25 -0
- package/build/sdk-typescript/src/model/support/SDKSize.d.ts +9 -0
- package/build/sdk-typescript/src/model/support/SDKSource.d.ts +102 -0
- package/build/sdk-typescript/src/model/support/SDKTokenOrigin.d.ts +11 -0
- package/build/sdk-typescript/src/model/support/SDKWorkspaceNPMRegistry.d.ts +13 -0
- package/build/sdk-typescript/src/model/themes/SDKThemeUtilities.d.ts +6 -0
- package/build/sdk-typescript/src/model/themes/SDKTokenTheme.d.ts +63 -0
- package/build/sdk-typescript/src/model/themes/SDKTokenThemeOverride.d.ts +49 -0
- package/build/sdk-typescript/src/model/tokens/SDKBlurToken.d.ts +18 -0
- package/build/sdk-typescript/src/model/tokens/SDKBorderToken.d.ts +19 -0
- package/build/sdk-typescript/src/model/tokens/SDKColorToken.d.ts +22 -0
- package/build/sdk-typescript/src/model/tokens/SDKFontToken.d.ts +16 -0
- package/build/sdk-typescript/src/model/tokens/SDKGenericToken.d.ts +18 -0
- package/build/sdk-typescript/src/model/tokens/SDKGradientToken.d.ts +18 -0
- package/build/sdk-typescript/src/model/tokens/SDKMeasureToken.d.ts +26 -0
- package/build/sdk-typescript/src/model/tokens/SDKRadiusToken.d.ts +18 -0
- package/build/sdk-typescript/src/model/tokens/SDKShadowToken.d.ts +21 -0
- package/build/sdk-typescript/src/model/tokens/SDKTextToken.d.ts +16 -0
- package/build/sdk-typescript/src/model/tokens/SDKToken.d.ts +30 -0
- package/build/sdk-typescript/src/model/tokens/SDKTokenCompator.d.ts +20 -0
- package/build/sdk-typescript/src/model/tokens/SDKTokenValue.d.ts +113 -0
- package/build/sdk-typescript/src/model/tokens/SDKTypographyToken.d.ts +19 -0
- package/build/sdk-typescript/src/model/tokens/remote/SDKRemoteTokenData.d.ts +45 -0
- package/build/sdk-typescript/src/model/tokens/remote/SDKRemoteTokenModel.d.ts +60 -0
- package/build/sdk-typescript/src/model/tokens/remote/SDKRemoteTokenValue.d.ts +72 -0
- package/build/sdk-typescript/src/model/users/SDKUser.d.ts +22 -0
- package/build/sdk-typescript/src/tests/Accessors/Brand.spec.d.ts +1 -0
- package/build/sdk-typescript/src/tests/Accessors/Components.spec.d.ts +1 -0
- package/build/sdk-typescript/src/tests/Accessors/DesignSystem.spec.d.ts +1 -0
- package/build/sdk-typescript/src/tests/Accessors/DesignSystemVersion.spec.d.ts +1 -0
- package/build/sdk-typescript/src/tests/Accessors/Documentation.spec.d.ts +1 -0
- package/build/sdk-typescript/src/tests/Accessors/Supernova.spec.d.ts +1 -0
- package/build/sdk-typescript/src/tests/Accessors/Theme.spec.d.ts +1 -0
- package/build/sdk-typescript/src/tests/Accessors/Workspace.spec.d.ts +1 -0
- package/build/sdk-typescript/src/tests/Tooling/PluginFigmaTokens.spec.d.ts +17 -0
- package/build/sdk-typescript/src/tests/Tooling/PluginJSONBuilder.spec.d.ts +1 -0
- package/build/sdk-typescript/src/tests/Tooling/ToolDocSearch.spec.d.ts +1 -0
- package/build/sdk-typescript/src/tests/Tooling/ToolMarkdownTransform.spec.d.ts +1 -0
- package/build/sdk-typescript/src/tests/helpers.d.ts +2 -0
- package/build/sdk-typescript/src/tools/design-tokens/SDKToolsDesignTokensPlugin.d.ts +48 -0
- package/build/sdk-typescript/src/tools/design-tokens/utilities/SDKDTJSONConverter.d.ts +34 -0
- package/build/sdk-typescript/src/tools/design-tokens/utilities/SDKDTJSONGroupBuilder.d.ts +21 -0
- package/build/sdk-typescript/src/tools/design-tokens/utilities/SDKDTJSONLoader.d.ts +27 -0
- package/build/sdk-typescript/src/tools/design-tokens/utilities/SDKDTJSONParser.d.ts +40 -0
- package/build/sdk-typescript/src/tools/design-tokens/utilities/SDKDTMapLoader.d.ts +39 -0
- package/build/sdk-typescript/src/tools/design-tokens/utilities/SDKDTMapResolver.d.ts +10 -0
- package/build/sdk-typescript/src/tools/design-tokens/utilities/SDKDTThemeMerger.d.ts +17 -0
- package/build/sdk-typescript/src/tools/design-tokens/utilities/SDKDTTokenGroupTreeMerger.d.ts +23 -0
- package/build/sdk-typescript/src/tools/design-tokens/utilities/SDKDTTokenMerger.d.ts +17 -0
- package/build/sdk-typescript/src/tools/design-tokens/utilities/SDKDTTokenReferenceResolver.d.ts +37 -0
- package/build/sdk-typescript/src/tools/design-tokens/utilities/SDKDTTokenSetResolver.d.ts +12 -0
- package/build/sdk-typescript/src/tools/design-tokens/utilities/collection/SDKDTTokenCollection.d.ts +13 -0
- package/build/sdk-typescript/src/tools/design-tokens/utilities/expression/SDKDTExpressionParser.d.ts +5 -0
- package/build/sdk-typescript/src/tools/design-tokens/utilities/tree/SDKDTGroupTree.d.ts +10 -0
- package/build/sdk-typescript/src/tools/design-tokens/utilities/tree/SDKDTGroupTreeNode.d.ts +20 -0
- package/build/sdk-typescript/src/tools/design-tokens/utilities/tree/SDKDTParentChildMapping.d.ts +5 -0
- package/build/sdk-typescript/src/tools/json-builder/SDKToolsJSONBuilder.d.ts +57 -0
- package/build/sdk-typescript/src/tools/json-builder/elements-transformers/SDKToolsJSONElementFigmaTokensTransformer.d.ts +40 -0
- package/build/sdk-typescript/src/tools/json-builder/elements-transformers/SDKToolsJSONElementStyleDictionaryTransformer.d.ts +29 -0
- package/build/sdk-typescript/src/tools/json-builder/elements-transformers/SDKToolsJSONElementTransformer.d.ts +77 -0
- package/build/sdk-typescript/src/tools/markdown-transform/SDKToolsMarkdownTransform.d.ts +23 -0
- package/build/sdk-typescript/src/tools/markdown-transform/SDKToolsMarkdownTransformBlock.d.ts +75 -0
- package/build/sdk-typescript/src/tools/markdown-transform/SDKToolsMarkdownTransformUtil.d.ts +26 -0
- package/build/sdk-typescript/src/tools/search-index/SDKToolsDocSearch.d.ts +47 -0
- package/build/sdk-typescript/src/tools/token-transform/SDKToolsTokenTransform.d.ts +44 -0
- package/build/sdk-typescript/src/utils/FlowUtils.d.ts +5 -0
- package/build/sdk-typescript/src/utils/StringUtils.d.ts +72 -0
- package/build/supernova-sdk-typescript.js +3 -0
- package/build/supernova-sdk-typescript.js.LICENSE.txt +8 -0
- package/build/supernova-sdk-typescript.js.map +1 -0
- package/package.json +114 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Supernova.io
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<img src="https://github.com/Supernova-Studio/sdk-typescript/blob/main/readme-icon.png?raw=true" alt="Supernova SDK" style="max-width:100%; margin-bottom: 20px;" />
|
|
2
|
+
|
|
3
|
+
# Supernova JS/TS SDK [](https://raw.githubusercontent.com/Supernova-Studio/sdk-typescript/main/LICENSE.md) []() []()
|
|
4
|
+
|
|
5
|
+
The Supernova SDK provides convenient access to the [Supernova.io](https://supernova.io) platform. It allows you to build design system tooling without worrying about building entire necessary infrastructure like syncing data from Figma, Storybook, writing entire documentation systems etc. - instead, you get all of this out of the box, and you can use the data coming from your single source of truth for any other purpose.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
SDK comes with all functionality (all will come with more once it reaches general release) you need to build design system tooling you previously only dreamt of:
|
|
10
|
+
|
|
11
|
+
- [x] Read API for `Tokens`, `Assets`, `Components`, `Design Components`
|
|
12
|
+
- [x] Read API for Account-level objects like `Workspaces`, `Design Systems`
|
|
13
|
+
- [x] Support for `single-branded` and `multi-branded` `Design Systems`
|
|
14
|
+
- [x] Read API for `Documentation`, including entire structure, content and configuration
|
|
15
|
+
- [x] Block or markdown `Documentation` representation
|
|
16
|
+
- [x] Rendering pipeline to export your assets as svg, png, pdf
|
|
17
|
+
- [x] Write Token API
|
|
18
|
+
- [ ] (coming) Version management
|
|
19
|
+
- [ ] (coming) Exporter management
|
|
20
|
+
- [ ] (coming) Integrations with awesome community tools (Figma Tokens, Style Dictionary, Raycast..)
|
|
21
|
+
|
|
22
|
+
And of course, features that make all developers happy!
|
|
23
|
+
|
|
24
|
+
- [x] Fully Typescript-enabled code
|
|
25
|
+
- [x] Heavily performance-optimized code and caching
|
|
26
|
+
- [x] Fully documented objects and attributes
|
|
27
|
+
- [x] Plug & play library design
|
|
28
|
+
- [x] Performant even for large design systems with lot of data
|
|
29
|
+
- [x] Extensive examples showing most of the capabilities
|
|
30
|
+
- [x] Unit tests
|
|
31
|
+
|
|
32
|
+
## Installing
|
|
33
|
+
|
|
34
|
+
To install, simply run:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install @supernovaio/supernova-sdk
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Supernova SDK is made to run in both local (like Node.js) and remote environments (like browsers) so you can use it to develop your React sites or any kind of tool you would like to run as client-side app.
|
|
41
|
+
|
|
42
|
+
## Examples
|
|
43
|
+
|
|
44
|
+
We have prepared several examples to show you some things that are possible:
|
|
45
|
+
|
|
46
|
+
- [x] [Supernova + Gatsby Documentation Site Starter](https://github.com/Supernova-Studio/gatsby-documentation-site/)
|
|
47
|
+
- [x] [Supernova Gatsby Source Plugin](https://github.com/Supernova-Studio/gatsby-source-supernova)
|
|
48
|
+
|
|
49
|
+
We are working on a few more that will be available once SDK launches out of public beta. If you are interested in building something for Supernova as well, don't hesitate to [reach out](https://community.supernova.io) and talk with us!
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
## Obtaining API Key
|
|
53
|
+
|
|
54
|
+
Before you can use the SDK, you must obtain your personal access key from your [Supernova.io](https://supernova.io) profile. To do this, sign-in to [Supernova Cloud](https://cloud.supernova.io/), click on your profile picture > profile settings > authentication and generate a new key. [See more information](https://developers.supernova.io/getting-started#obtain-your-developer-key) if you need additional help.
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
## Access Rights
|
|
58
|
+
|
|
59
|
+
Usage of the SDK adheres to the [general access rights](https://learn.supernova.io/workspace/team-management/roles.html) that the account which generated the access key has. For example, if you are a viewer in a specific workspace, then you will not be able to do any change to that workspace through the SDK and error will be thrown instead. For vast majority of use-cases, being editor-level is enough however.
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## Quick-start
|
|
63
|
+
|
|
64
|
+
It is time to put this SDK to good use! To start, import the main Supernova SDK object:
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
import { Supernova } from "@supernovaio/supernova-sdk"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
And instantiate it with your API key:
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
const supernova = new Supernova(key, null, null) // Ignore 2 additional attributes for now
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Supernova instance is used for several purposes, but the main one is to select specific design system you want to fetch the data from.
|
|
77
|
+
|
|
78
|
+
## How are data structured
|
|
79
|
+
|
|
80
|
+
All your design system data live under the following structure (that will match your specific setup, what versions you have created and so on):
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
Workspace 1
|
|
84
|
+
Design System 1
|
|
85
|
+
Version Draft
|
|
86
|
+
Brand 1
|
|
87
|
+
Brand 2
|
|
88
|
+
Version 1.0
|
|
89
|
+
Brand 1
|
|
90
|
+
Brand 2
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
- `Workspace` is what you are a member of and is object that encapsulates everything, from your team to all design systems that were created under it. You can be a member of an unlimited number of workspaces, but in the majority of cases users are members of just a single one. You can have different roles and access rights under each of the workspaces you belong to.
|
|
94
|
+
- Every `Design System` belongs to one `Workspace` and contains things like design system configuration, integration settings and admin-related tools.
|
|
95
|
+
- Each `Design System` contains at minimum one active `Version` called `Shared Draft` - this version is where you write your data and is the only one which is allowed to be written to as well.
|
|
96
|
+
- `Version` is data container for all design system information - like `Tokens`, `Assets`, `DesignComponents` and `Documentation`.
|
|
97
|
+
- `Version` object has all methods you need to access every piece of data you have in Supernova design system.
|
|
98
|
+
- Each `Version` additionally contains `Brands`. As Supernova supports multi-branded design systems, `Brands` further separate data into data packs that only represent data belonging to one specific brand (for example, set of core tokens shared across all brands, but then subset of tokens specific only to that brand).
|
|
99
|
+
- There is always at least one `Brand` in each `Version`, even if multi-branded functionality is disabled.
|
|
100
|
+
- `Brand` object has all methods you need to access every piece of data you have in Supernova design system related to one specific brand.
|
|
101
|
+
|
|
102
|
+
To access the data, you first need to select which `Workspace`, `Design System` and `Version` (optionally `Brand`) you want to use.
|
|
103
|
+
|
|
104
|
+
## Using SDK
|
|
105
|
+
|
|
106
|
+
You can find full list of [what is possible, and how, here](https://github.com/Supernova-Studio/sdk-typescript/tree/main/docs).
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
## Resolution Caching
|
|
110
|
+
|
|
111
|
+
Supernova SDK works little bit differently than you would probably expect by default. Because of how complex the design system data is (as an example, a token can contain references to other tokens and can also be made of different types of tokens which can then be used in designComponents...) the SDK does all necessary resolution for you beforehand.
|
|
112
|
+
|
|
113
|
+
To allow reuse of the data, the resolved results are cached and used in follow-up resolutions (for example, if you would first access your design tokens and then access documentation that uses the tokens, tokens would be reused). In many situations, this is what you want. However, there are some cases where this behavior is not what you want, like longer-running sessions:
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
### Longer-running sessions
|
|
117
|
+
|
|
118
|
+
If you are building a client-side app, your users might stay there for a long time without refreshing their session (like reloading a browser). This means the data will always come from the time of the first request as you are always using the same Supernova instance. To prevent this, you can disable cache layer completely:
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
instance.setResolutionCacheEnabled(false)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
With cache disabled, every request will download all necessary information for every request. This is not particulary efficient, especially for very-large design systems, but we put this option so you can control this behavior if you want to. Cache is enabled by default.
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
## What's next
|
|
128
|
+
|
|
129
|
+
As this is still beta, we are working hard on improving it before the first official release. The following are areas we'd like to solve before general release:
|
|
130
|
+
|
|
131
|
+
- [ ] DesignComponent API
|
|
132
|
+
- [ ] Write API
|
|
133
|
+
- [ ] Metadata API
|
|
134
|
+
- [ ] Automation triggers
|
|
135
|
+
- [ ] More examples
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
## Contributions
|
|
139
|
+
|
|
140
|
+
If you have additional ideas about how to make this project better, let us know by opening an issue! You can also open pull requests if you've worked on improving something yourself and would like to contribute back to the community.
|
|
141
|
+
|
|
142
|
+
We will be reviewing feature-pull-requests on case-by-case basis, but in general, we are super open to your new ideas and we welcome them! And finally, thank you for your support! You are an amazing community.
|
|
143
|
+
|
|
144
|
+
Supernova Engineering Team
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './exports';
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Asset } from '../model/assets/SDKAsset';
|
|
2
|
+
import { RenderedAsset } from '../model/assets/SDKRenderedAsset';
|
|
3
|
+
import { AssetFormat } from '../model/enums/SDKAssetFormat';
|
|
4
|
+
import { AssetScale } from '../model/enums/SDKAssetScale';
|
|
5
|
+
import { DesignComponent } from '../model/components/SDKDesignComponent';
|
|
6
|
+
import { TokenType } from '../model/enums/SDKTokenType';
|
|
7
|
+
import { AssetGroup } from '../model/groups/SDKAssetGroup';
|
|
8
|
+
import { DesignComponentGroup } from '../model/groups/SDKDesignComponentGroup';
|
|
9
|
+
import { TokenGroup } from '../model/groups/SDKTokenGroup';
|
|
10
|
+
import { Token } from '../model/tokens/SDKToken';
|
|
11
|
+
import { DataCore } from './data/SDKDataCore';
|
|
12
|
+
import { DesignSystemVersion } from './SDKDesignSystemVersion';
|
|
13
|
+
import { Component } from '../model/components/SDKComponent';
|
|
14
|
+
import { BrandWriter } from './SDKBrandWriter';
|
|
15
|
+
import { Supernova } from './SDKSupernova';
|
|
16
|
+
import { TokenTheme } from '../model/themes/SDKTokenTheme';
|
|
17
|
+
export interface BrandRemoteModel {
|
|
18
|
+
id: string;
|
|
19
|
+
designSystemVersionId: string;
|
|
20
|
+
persistentId: string;
|
|
21
|
+
meta: {
|
|
22
|
+
name: string;
|
|
23
|
+
description: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export declare class Brand {
|
|
27
|
+
/** Unique identifier of the brand in this specific version */
|
|
28
|
+
id: string;
|
|
29
|
+
/** Unique identifier of the brand */
|
|
30
|
+
persistentId: string;
|
|
31
|
+
/** Design System Version in which this brand exists */
|
|
32
|
+
designSystemVersion: DesignSystemVersion;
|
|
33
|
+
/** Brand name */
|
|
34
|
+
name: string;
|
|
35
|
+
/** Brand description */
|
|
36
|
+
description: string;
|
|
37
|
+
/** Internal: Engine */
|
|
38
|
+
engine: Supernova;
|
|
39
|
+
/** Internal: Data core */
|
|
40
|
+
dataCore: DataCore;
|
|
41
|
+
constructor(engine: Supernova, model: BrandRemoteModel, version: DesignSystemVersion);
|
|
42
|
+
/** Retrieve write object for this brand */
|
|
43
|
+
writer(): BrandWriter;
|
|
44
|
+
/** Fetches all tokens available in this design system version belonging to this specific brand */
|
|
45
|
+
tokens(forceRefreshCache?: boolean): Promise<Array<Token>>;
|
|
46
|
+
/** Fetches all tokens and retrieves resolved array of tokens with applied themes */
|
|
47
|
+
tokensByApplyingThemes(themeIds: Array<string>): Promise<Array<Token>>;
|
|
48
|
+
/** Fetches all brands available in this design system version belonging to this specific brand */
|
|
49
|
+
themes(): Promise<Array<TokenTheme>>;
|
|
50
|
+
/** Fetches all token groups available in this design system version belonging to this specific brand */
|
|
51
|
+
tokenGroups(): Promise<Array<TokenGroup>>;
|
|
52
|
+
/** Fetches root of the token group trees. This method returns roots specific to this brand, one group per category */
|
|
53
|
+
tokenGroupTrees(): Promise<Map<TokenType, TokenGroup>>;
|
|
54
|
+
/** Fetches all designComponents available in this design system version belonging to this specific brand */
|
|
55
|
+
components(): Promise<Array<Component>>;
|
|
56
|
+
/** Fetches all designComponents (Figma for now) available in this design system version belonging to this specific brand */
|
|
57
|
+
designComponents(): Promise<Array<DesignComponent>>;
|
|
58
|
+
/** Fetches all designComponent groups as flattened array available in this design system version belonging to this specific brand */
|
|
59
|
+
designComponentGroups(): Promise<Array<DesignComponentGroup>>;
|
|
60
|
+
/** Fetches root of the designComponent group tree. This group will contain any other top-level groups that user created and will belong to this specific brand */
|
|
61
|
+
designComponentGroupTree(): Promise<DesignComponentGroup>;
|
|
62
|
+
/** Fetches all assets available in this design system version belonging to this specific brand */
|
|
63
|
+
assets(): Promise<Array<Asset>>;
|
|
64
|
+
/** Fetches all asset groups as flattened array available in this design system version belonging to this specific brand */
|
|
65
|
+
assetGroups(): Promise<Array<AssetGroup>>;
|
|
66
|
+
/** Fetches root of the asset group tree. This group will contain any other top-level groups that user created and will be specific to this brand */
|
|
67
|
+
assetGroupTree(): Promise<AssetGroup>;
|
|
68
|
+
/** Renders all assets in this brand and retrieves URLs from which assets can be downloaded as key-value. You can only render one combination of size/format with one request - use more requests if you need to render more.
|
|
69
|
+
*
|
|
70
|
+
* Assets that are rendered as "png" will use "scale" attribute, however, when the format is "svg" or "pdf", scale attribute is ignored and will always render the original size.
|
|
71
|
+
*
|
|
72
|
+
* Note that assets are not persistent and URLs will expire quickly - you must download them and store them locally / remotely and can never use this URL publicly as it won't work after a short time */
|
|
73
|
+
renderedAssets(format: AssetFormat, scale: AssetScale): Promise<Array<RenderedAsset>>;
|
|
74
|
+
/** Renders specific assets in this brand and retrieves URLs from which assets can be downloaded as key-value. You can only render one combination of size/format with one request - use more requests if you need to render more.
|
|
75
|
+
*
|
|
76
|
+
* Assets that are rendered as "png" will use "scale" attribute, however, when the format is "svg" or "pdf", scale attribute is ignored and will always render the original size.
|
|
77
|
+
*
|
|
78
|
+
* Note that assets are not persistent and URLs will expire quickly - you must download them and store them locally / remotely and can never use this URL publicly as it won't work after a short time */
|
|
79
|
+
specificRenderedAssets(assets: Array<Asset>, format: AssetFormat, scale: AssetScale): Promise<Array<RenderedAsset>>;
|
|
80
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { TokenGroup } from "../model/groups/SDKTokenGroup";
|
|
2
|
+
import { TokenTheme } from "../model/themes/SDKTokenTheme";
|
|
3
|
+
import { Token } from "../model/tokens/SDKToken";
|
|
4
|
+
import { DataCore } from "./data/SDKDataCore";
|
|
5
|
+
import { Brand } from "./SDKBrand";
|
|
6
|
+
import { Supernova } from "./SDKSupernova";
|
|
7
|
+
export type TokenWriteResponse = {
|
|
8
|
+
result: "success" | "error";
|
|
9
|
+
errors: Array<string>;
|
|
10
|
+
tokens: Array<Token>;
|
|
11
|
+
tokenGroups: Array<TokenGroup>;
|
|
12
|
+
};
|
|
13
|
+
export type TokenThemeWriteResponse = {
|
|
14
|
+
result: "success" | "error";
|
|
15
|
+
errors: Array<string>;
|
|
16
|
+
theme: TokenTheme;
|
|
17
|
+
};
|
|
18
|
+
export declare class BrandWriter {
|
|
19
|
+
/** Internal: Associated brand */
|
|
20
|
+
brand: Brand;
|
|
21
|
+
/** Internal: Engine */
|
|
22
|
+
engine: Supernova;
|
|
23
|
+
/** Internal: Data core */
|
|
24
|
+
dataCore: DataCore;
|
|
25
|
+
constructor(engine: Supernova, brand: Brand);
|
|
26
|
+
/** Fetches all tokens available in this design system version belonging to this specific brand */
|
|
27
|
+
writeTokens(tokens: Array<Token>, groups: Array<TokenGroup>, deleteTokens: Array<Token>): Promise<TokenWriteResponse>;
|
|
28
|
+
writeTheme(theme: TokenTheme): Promise<TokenThemeWriteResponse>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Supernova } from "../core/SDKSupernova";
|
|
2
|
+
import { Source, SourceRemoteModel } from "../model/support/SDKSource";
|
|
3
|
+
import { DesignSystemVersion } from "./SDKDesignSystemVersion";
|
|
4
|
+
export interface DesignSystemRemoteModel {
|
|
5
|
+
id: string;
|
|
6
|
+
meta: {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
};
|
|
10
|
+
workspaceId: string;
|
|
11
|
+
basePrefixes: string[];
|
|
12
|
+
sources: Array<SourceRemoteModel>;
|
|
13
|
+
isPublic: boolean;
|
|
14
|
+
isMultibrand: boolean;
|
|
15
|
+
docSlug: string;
|
|
16
|
+
docUserSlug?: string;
|
|
17
|
+
docExporterId: string;
|
|
18
|
+
designSystemSwitcher: {
|
|
19
|
+
isEnabled: boolean;
|
|
20
|
+
designSystemIds: Array<string>;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export declare class DesignSystem {
|
|
24
|
+
/** Unique identifier of design system */
|
|
25
|
+
id: string;
|
|
26
|
+
/** Unique identifier of the workspace in which this design system was created */
|
|
27
|
+
workspaceId: string;
|
|
28
|
+
/** Design system name */
|
|
29
|
+
name: string;
|
|
30
|
+
/** Design system description */
|
|
31
|
+
description: string;
|
|
32
|
+
/** If enabled, parts of the design system can be accessed by public (for example, documentation site) */
|
|
33
|
+
isPublic: boolean;
|
|
34
|
+
/** If set, signals that multibrand functionality is enabled for this design system */
|
|
35
|
+
isMultiBrand: boolean;
|
|
36
|
+
/** Unique identifier of exporter package used for the documentation */
|
|
37
|
+
documentationExporterId: string;
|
|
38
|
+
/** Documentation URL slug */
|
|
39
|
+
documentationSlug: string;
|
|
40
|
+
/** Documentation URL slug - user override */
|
|
41
|
+
documentationUserSlug: string | null;
|
|
42
|
+
/** Internal: Engine */
|
|
43
|
+
engine: Supernova;
|
|
44
|
+
/** Binding multiple design systems together */
|
|
45
|
+
designSystemSwitcher: {
|
|
46
|
+
isEnabled: boolean;
|
|
47
|
+
designSystemIds: Array<string>;
|
|
48
|
+
};
|
|
49
|
+
constructor(engine: Supernova, model: DesignSystemRemoteModel);
|
|
50
|
+
/** Fetches all versions that were created in the design system. Note that there is always at least one version - the "draft" - if there was no version created manually. */
|
|
51
|
+
versions(): Promise<Array<DesignSystemVersion>>;
|
|
52
|
+
/** Fetches active design system version - the one to which all changes are being written currently. There is always one active version at any moment. */
|
|
53
|
+
activeVersion(): Promise<DesignSystemVersion>;
|
|
54
|
+
/** Get source by source id */
|
|
55
|
+
sourceById(sourceId: string): Promise<Source | undefined>;
|
|
56
|
+
/** Fetches all sources that were created in the design system. Used to feed the design system with the data (design & code). */
|
|
57
|
+
sources(): Promise<Array<Source>>;
|
|
58
|
+
/** Get Figma file from source id */
|
|
59
|
+
figmaFileIdForSourceId(sourceId: string): Promise<string | undefined>;
|
|
60
|
+
/** Get Figma file name from source id */
|
|
61
|
+
figmaFileNameForSourceId(sourceId: string): Promise<string | undefined>;
|
|
62
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Supernova } from '../core/SDKSupernova';
|
|
2
|
+
import { AssetFormat, AssetScale, RenderedAsset } from '../exports';
|
|
3
|
+
import { Asset } from '../model/assets/SDKAsset';
|
|
4
|
+
import { Component } from '../model/components/SDKComponent';
|
|
5
|
+
import { DesignComponent } from '../model/components/SDKDesignComponent';
|
|
6
|
+
import { ElementDataView } from '../model/elements/SDKElementDataView';
|
|
7
|
+
import { ElementProperty } from '../model/elements/SDKElementProperty';
|
|
8
|
+
import { TokenType } from '../model/enums/SDKTokenType';
|
|
9
|
+
import { AssetGroup } from '../model/groups/SDKAssetGroup';
|
|
10
|
+
import { DesignComponentGroup } from '../model/groups/SDKDesignComponentGroup';
|
|
11
|
+
import { TokenGroup } from '../model/groups/SDKTokenGroup';
|
|
12
|
+
import { TokenTheme } from '../model/themes/SDKTokenTheme';
|
|
13
|
+
import { Token } from '../model/tokens/SDKToken';
|
|
14
|
+
import { DataCore } from './data/SDKDataCore';
|
|
15
|
+
import { Brand } from './SDKBrand';
|
|
16
|
+
import { DesignSystem } from './SDKDesignSystem';
|
|
17
|
+
import { Documentation } from './SDKDocumentation';
|
|
18
|
+
export interface DesignSystemVersionRemoteModel {
|
|
19
|
+
id: string;
|
|
20
|
+
parentId: string;
|
|
21
|
+
version: string;
|
|
22
|
+
designSystemId: string;
|
|
23
|
+
isReadonly: boolean;
|
|
24
|
+
meta: {
|
|
25
|
+
name: string;
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
createdAt: string;
|
|
29
|
+
changeLog: string;
|
|
30
|
+
}
|
|
31
|
+
export declare class DesignSystemVersion {
|
|
32
|
+
/** Unique identifier of design system version */
|
|
33
|
+
id: string;
|
|
34
|
+
/** Design system in which this version was created */
|
|
35
|
+
designSystem: DesignSystem;
|
|
36
|
+
/** Design system version name */
|
|
37
|
+
name: string;
|
|
38
|
+
/** Design system version description */
|
|
39
|
+
description: string;
|
|
40
|
+
/** Semantic name of version. Will be null if the version is in draft mode */
|
|
41
|
+
version: string | null;
|
|
42
|
+
/** Change log for the version. Will be null if the version is in draft mode */
|
|
43
|
+
changeLog: string | null;
|
|
44
|
+
/** If version is in read-only mode, it can't be modified - only documentation that can be improved */
|
|
45
|
+
isReadOnly: boolean;
|
|
46
|
+
/** Internal: Engine */
|
|
47
|
+
engine: Supernova;
|
|
48
|
+
/** Internal: Data core */
|
|
49
|
+
dataCore: DataCore;
|
|
50
|
+
constructor(engine: Supernova, designSystem: DesignSystem, model: DesignSystemVersionRemoteModel);
|
|
51
|
+
/** Fetches all brands belonging to this design system version. Brand objects can be used to access filtered data belonging to a single brand */
|
|
52
|
+
brands(): Promise<Array<Brand>>;
|
|
53
|
+
/** Fetches all tokens in this design system version. This method retrieves all groups defined across all brands */
|
|
54
|
+
tokens(): Promise<Array<Token>>;
|
|
55
|
+
/** Fetches all themes in this design system version. This method retrieves all groups defined across all brands */
|
|
56
|
+
themes(): Promise<Array<TokenTheme>>;
|
|
57
|
+
/** Fetches all tokens and retrieves resolved array of tokens with applied themes */
|
|
58
|
+
tokensByApplyingThemes(tokenIds: Array<string>, themeIds: Array<string>): Promise<Array<Token>>;
|
|
59
|
+
/** Fetches all token groups in this design system version. This method retrieves all groups defined across all brands */
|
|
60
|
+
tokenGroups(): Promise<Array<TokenGroup>>;
|
|
61
|
+
/** Fetches root of the token group trees. This method returns all roots, one per each brand you have defined, ordered under separate TokenType, one array per category */
|
|
62
|
+
tokenGroupTrees(): Promise<Map<TokenType, Array<TokenGroup>>>;
|
|
63
|
+
/** Fetches all assets in this design system version for all defined brands */
|
|
64
|
+
components(): Promise<Array<Component>>;
|
|
65
|
+
/** Fetches all assets in this design system version for all defined brands */
|
|
66
|
+
designComponents(): Promise<Array<DesignComponent>>;
|
|
67
|
+
/** Fetches all designComponent group in this design system version for all defined brands */
|
|
68
|
+
designComponentGroups(): Promise<Array<DesignComponentGroup>>;
|
|
69
|
+
/** Fetches roots of the designComponent group trees. This group will contain any other top-level groups that user created. This method returns all roots, one per each brand you have defined */
|
|
70
|
+
designComponentGroupTree(): Promise<Array<DesignComponentGroup>>;
|
|
71
|
+
/** Fetches all assets in this design system version for all defined brands */
|
|
72
|
+
assets(): Promise<Array<Asset>>;
|
|
73
|
+
/** Fetches all asset groups and retrieve them as flat array. You can still access all children of groups with children accessor of group object. This method retrieves all groups across all brands */
|
|
74
|
+
assetGroups(): Promise<Array<AssetGroup>>;
|
|
75
|
+
/** Fetches root of the asset group trees. This group will contain any other top-level groups that user created. This method returns all roots, one per each brand you have defined */
|
|
76
|
+
assetGroupTrees(): Promise<Array<AssetGroup>>;
|
|
77
|
+
/** Fetches root documentation object containing the entire documentation structure. This will never be null as there is always documentation object attached to a specific design system version */
|
|
78
|
+
documentation(): Promise<Documentation>;
|
|
79
|
+
/** Renders all assets in this version and retrieves URLs from which assets can be downloaded as key-value. You can only render one combination of size/format with one request - use more requests if you need to render more.
|
|
80
|
+
*
|
|
81
|
+
* Assets that are rendered as "png" will use "scale" attribute, however, when the format is "svg" or "pdf", scale attribute is ignored and will always render the original size.
|
|
82
|
+
*
|
|
83
|
+
* Note that assets are not persistent and URLs will expire quickly - you must download them and store them locally / remotely and can never use this URL publicly as it won't work after a short time */
|
|
84
|
+
renderedAssets(format: AssetFormat, scale: AssetScale): Promise<Array<RenderedAsset>>;
|
|
85
|
+
/** Renders specific assets in this version and retrieves URLs from which assets can be downloaded as key-value. You can only render one combination of size/format with one request - use more requests if you need to render more.
|
|
86
|
+
*
|
|
87
|
+
* Assets that are rendered as "png" will use "scale" attribute, however, when the format is "svg" or "pdf", scale attribute is ignored and will always render the original size.
|
|
88
|
+
*
|
|
89
|
+
* Note that assets are not persistent and URLs will expire quickly - you must download them and store them locally / remotely and can never use this URL publicly as it won't work after a short time */
|
|
90
|
+
specificRenderedAssets(assets: Array<Asset>, format: AssetFormat, scale: AssetScale): Promise<Array<RenderedAsset>>;
|
|
91
|
+
/** Retrieves property definitions for tokens */
|
|
92
|
+
tokenProperties(): Promise<Array<ElementProperty>>;
|
|
93
|
+
/** Retrieves property views for tokens */
|
|
94
|
+
tokenDataViews(): Promise<Array<ElementDataView>>;
|
|
95
|
+
/** Retrieves property definitions for components */
|
|
96
|
+
componentProperties(): Promise<Array<ElementProperty>>;
|
|
97
|
+
/** Retrieves property views for components */
|
|
98
|
+
componentDataViews(): Promise<Array<ElementDataView>>;
|
|
99
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ExporterConfigurationProperty } from '../model/exporters/custom_properties/SDKExporterConfigurationProperty';
|
|
2
|
+
import { ExporterCustomBlock } from '../model/exporters/custom_blocks/SDKExporterCustomBlock';
|
|
3
|
+
import { ExporterCustomBlockVariant } from '../model/exporters/custom_blocks/SDKExporterCustomBlockVariant';
|
|
4
|
+
import { DocumentationConfiguration, DocumentationConfigurationModel } from '../model/documentation/SDKDocumentationConfiguration';
|
|
5
|
+
import { DocumentationGroup } from '../model/documentation/SDKDocumentationGroup';
|
|
6
|
+
import { DocumentationItem } from '../model/documentation/SDKDocumentationItem';
|
|
7
|
+
import { DocumentationPage } from '../model/documentation/SDKDocumentationPage';
|
|
8
|
+
import { DesignSystemVersion } from './SDKDesignSystemVersion';
|
|
9
|
+
import { DesignSystem } from './SDKDesignSystem';
|
|
10
|
+
import { WorkspaceNPMRegistry } from '../model/support/SDKWorkspaceNPMRegistry';
|
|
11
|
+
import { ElementProperty } from '..';
|
|
12
|
+
import { ElementDataView } from '../model/elements/SDKElementDataView';
|
|
13
|
+
export interface DocumentationModel {
|
|
14
|
+
settings: DocumentationConfigurationModel;
|
|
15
|
+
}
|
|
16
|
+
/** Main documentation accessor object. All data associated with documentation can be access through here, such as pages, groups, any block, and also any configuration your editors did. */
|
|
17
|
+
export declare class Documentation {
|
|
18
|
+
/** Associated version */
|
|
19
|
+
private version;
|
|
20
|
+
/** Associated design system */
|
|
21
|
+
private designSystem;
|
|
22
|
+
/** Documentation settings */
|
|
23
|
+
settings: DocumentationConfiguration;
|
|
24
|
+
constructor(version: DesignSystemVersion, designSystem: DesignSystem, model: DocumentationModel, registry: WorkspaceNPMRegistry | null);
|
|
25
|
+
/** Main group to which all groups and pages belong. The root group never shows up inside the editor but is always present in data model */
|
|
26
|
+
rootGroup(): Promise<DocumentationGroup>;
|
|
27
|
+
/** All items, including pages, groups and group of tab type fetched together */
|
|
28
|
+
items(): Promise<Array<DocumentationItem>>;
|
|
29
|
+
/** All groups to which other groups and pages can belong. Each group also contains entire children chain pre-fetched and resolved for convenience */
|
|
30
|
+
groups(): Promise<Array<DocumentationGroup>>;
|
|
31
|
+
/** All pages created within documentation presented as flat structure. Each page contains all data neccessary to render it pre-fetched and resolved for convenience */
|
|
32
|
+
pages(): Promise<Array<DocumentationPage>>;
|
|
33
|
+
/** All custom blocks that were registered with the active exporter configuration */
|
|
34
|
+
customBlocks(): Promise<Array<ExporterCustomBlock>>;
|
|
35
|
+
/** All custom configuration properties that are defined within the active exporter package */
|
|
36
|
+
customConfiguration(): Promise<Array<ExporterConfigurationProperty>>;
|
|
37
|
+
/** All custom block variants that are defined within the active exporter package */
|
|
38
|
+
customBlockVariants(): Promise<Array<ExporterCustomBlockVariant>>;
|
|
39
|
+
/** Retrieves property definitions for components */
|
|
40
|
+
pageProperties(): Promise<Array<ElementProperty>>;
|
|
41
|
+
/** Retrieves property views for components */
|
|
42
|
+
pageDataViews(): Promise<Array<ElementDataView>>;
|
|
43
|
+
/** Publish documentation. This queues a build on Supernova's server that will be processed by the asynchronous CI/CD pipeline. You can request status of the build with associated `isBeingPublished` method. */
|
|
44
|
+
publish(): Promise<{
|
|
45
|
+
status: 'Queued' | 'InProgress' | 'Failure';
|
|
46
|
+
jobId: string | null;
|
|
47
|
+
exporterId: string | null;
|
|
48
|
+
}>;
|
|
49
|
+
/** Publish documentation. This queues a build on Supernova's server that will be processed by the asynchronous CI/CD pipeline. You can request status of the build with associated `isBeingPublished` method. */
|
|
50
|
+
isPublishing(): Promise<{
|
|
51
|
+
status: 'InProgress' | 'Idle';
|
|
52
|
+
jobId: string | null;
|
|
53
|
+
exporterId: string | null;
|
|
54
|
+
}>;
|
|
55
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { DataBridge, DataBridgeRequestHook, DebugRequestObserver, DebugResponseObserver } from "./data/SDKDataBridge";
|
|
2
|
+
import { DataCore } from "./data/SDKDataCore";
|
|
3
|
+
import { DesignSystem } from "./SDKDesignSystem";
|
|
4
|
+
import { DesignSystemVersion } from "./SDKDesignSystemVersion";
|
|
5
|
+
import { Workspace } from "./SDKWorkspace";
|
|
6
|
+
import { Exporter } from "../model/exporters/SDKExporter";
|
|
7
|
+
import { Source } from "../model/support/SDKSource";
|
|
8
|
+
import { User } from "../model/users/SDKUser";
|
|
9
|
+
/** Main Supernova.io SDK object. Use this to connect to your data instance and retrieve workspace / design system / version from which you can access all neccessary data. */
|
|
10
|
+
export declare class Supernova {
|
|
11
|
+
private useResolutionCache;
|
|
12
|
+
private apiKey;
|
|
13
|
+
private apiUrl;
|
|
14
|
+
private apiVersion;
|
|
15
|
+
private requestHook;
|
|
16
|
+
private debugRequestObserver;
|
|
17
|
+
private debugResponseObserver;
|
|
18
|
+
dataBridge: DataBridge;
|
|
19
|
+
constructor(apiKey: string, url?: string | null, requestHook?: DataBridgeRequestHook | null, requestObserver?: DebugRequestObserver | null, responseObserver?: DebugResponseObserver | null);
|
|
20
|
+
/** Fetches current user profile based on the API key provided to Supernova instance. */
|
|
21
|
+
me(): Promise<User>;
|
|
22
|
+
/** Fetches all workspaces available under provided API key. Each workspace contains specific design systems, which contain versions, which contain all the design system data. */
|
|
23
|
+
workspaces(): Promise<Array<Workspace>>;
|
|
24
|
+
/** Fetches one specific workspace by provided id. Throws when workspace is not found or user doesn't have access to it. */
|
|
25
|
+
workspace(workspaceId: string): Promise<Workspace | null>;
|
|
26
|
+
/** Fetches design systems which belong to a provided workspace. */
|
|
27
|
+
designSystems(workspaceId: string): Promise<Array<DesignSystem>>;
|
|
28
|
+
/** Fetches design system by provided id. Throws when design system is not found or user doesn't have access to it. */
|
|
29
|
+
designSystem(designSystemId: string): Promise<DesignSystem | null>;
|
|
30
|
+
/** Fetches active design system version - the one to which all changes are being written currently. There is always one active version available for any provided design system. */
|
|
31
|
+
activeDesignSystemVersion(designSystemId: string): Promise<DesignSystemVersion | null>;
|
|
32
|
+
/** Fetches all design system versions of provided design system */
|
|
33
|
+
designSystemVersions(designSystemId: string): Promise<Array<DesignSystemVersion>>;
|
|
34
|
+
/** Fetches design system version by id */
|
|
35
|
+
designSystemVersion(designSystemId: string, versionId: string): Promise<DesignSystemVersion | null>;
|
|
36
|
+
/** Fetches design system sources */
|
|
37
|
+
designSystemSources(designSystemId: string): Promise<Array<Source>>;
|
|
38
|
+
/** Fetches exporters belonging to workspace by id */
|
|
39
|
+
exporters(workspaceId: string): Promise<Array<Exporter>>;
|
|
40
|
+
/** Enables or disables resolution cache. Because of potential amount of data processed extra when this cache is disabled, only do it when you have a good reason (like if you are building a long-running, client-side app). Cache is enabled by default. */
|
|
41
|
+
setResolutionCacheEnabled(isEnabled: boolean): void;
|
|
42
|
+
/** Use this to rebuild data core if the settings change. */
|
|
43
|
+
rebuildBridge(): void;
|
|
44
|
+
/** Use this to make version-instance specific data core. Each version must have its own data core, as it caches the data and they can't intermix. Supernova instance has its own data core. */
|
|
45
|
+
newDataCore(): DataCore;
|
|
46
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Exporter } from "../model/exporters/SDKExporter";
|
|
2
|
+
import { Supernova } from "../core/SDKSupernova";
|
|
3
|
+
import { DesignSystem } from "./SDKDesignSystem";
|
|
4
|
+
export interface WorkspaceRemoteModel {
|
|
5
|
+
id: string;
|
|
6
|
+
profile: {
|
|
7
|
+
name: string;
|
|
8
|
+
handle: string;
|
|
9
|
+
color: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare class Workspace {
|
|
13
|
+
/** Unique identifier of the workspace */
|
|
14
|
+
id: string;
|
|
15
|
+
/** Unique URL handle of the workspace */
|
|
16
|
+
handle: string;
|
|
17
|
+
/** Workspace name */
|
|
18
|
+
name: string;
|
|
19
|
+
/** Private: Engine */
|
|
20
|
+
engine: Supernova;
|
|
21
|
+
constructor(engine: Supernova, model: WorkspaceRemoteModel);
|
|
22
|
+
/** Fetches design systems which belong to this workspace. */
|
|
23
|
+
designSystems(): Promise<Array<DesignSystem>>;
|
|
24
|
+
/** Fetches exporters which belong to this workspace. */
|
|
25
|
+
exporters(): Promise<Array<Exporter>>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { DataCore } from './SDKDataCore';
|
|
2
|
+
type DataBridgeRequestHookResult = {
|
|
3
|
+
skipDefaultAuth?: boolean;
|
|
4
|
+
};
|
|
5
|
+
export type DataBridgeRequestHook = (request: any) => void | DataBridgeRequestHookResult | Promise<void | DataBridgeRequestHookResult>;
|
|
6
|
+
export type DebugResponseObserver = (info: {
|
|
7
|
+
requestUrl: string;
|
|
8
|
+
response: any;
|
|
9
|
+
executionTime: number;
|
|
10
|
+
error?: Error;
|
|
11
|
+
}) => void;
|
|
12
|
+
export type DebugRequestObserver = (info: {
|
|
13
|
+
requestUrl: string;
|
|
14
|
+
requestMethod: string;
|
|
15
|
+
}) => void;
|
|
16
|
+
export interface DataBridgeConfiguration {
|
|
17
|
+
apiUrl: string;
|
|
18
|
+
apiVersion: string;
|
|
19
|
+
accessToken: string;
|
|
20
|
+
target: string | null;
|
|
21
|
+
cache: boolean;
|
|
22
|
+
requestHook: DataBridgeRequestHook | null;
|
|
23
|
+
debugRequestObserver?: DebugRequestObserver | null;
|
|
24
|
+
debugResponseObserver?: DebugResponseObserver | null;
|
|
25
|
+
}
|
|
26
|
+
export declare class DataBridge {
|
|
27
|
+
authToken: string;
|
|
28
|
+
cache: boolean;
|
|
29
|
+
dataCore: DataCore;
|
|
30
|
+
apiUrl: string;
|
|
31
|
+
apiVersion: string;
|
|
32
|
+
target: string | null;
|
|
33
|
+
requestHook: DataBridgeRequestHook | null;
|
|
34
|
+
debugRequestObserver: DebugRequestObserver | null;
|
|
35
|
+
debugResponseObserver: DebugResponseObserver | null;
|
|
36
|
+
constructor(conf: DataBridgeConfiguration);
|
|
37
|
+
getDSMGenericDataFromEndpoint(endpoint: string): Promise<any>;
|
|
38
|
+
getDSMDataFromEndpoint(designSystemId: string, designSystemVersionId: string, endpoint: string): Promise<any>;
|
|
39
|
+
private buildRequestConfig;
|
|
40
|
+
private getDataForAuthenticatedEndpoint;
|
|
41
|
+
postDSMDataToEndpoint(designSystemId: string, designSystemVersionId: string, endpoint: string, data: any, put?: boolean): Promise<any>;
|
|
42
|
+
postDSMDataToGenericEndpoint(endpoint: string, data: any, put?: boolean): Promise<any>;
|
|
43
|
+
private postDataForAuthenticatedEndpoint;
|
|
44
|
+
dsGenericRequestURL(): string;
|
|
45
|
+
dsWorkspaceRequestURL(wsId: string): string;
|
|
46
|
+
dsDataRequestURL(dsId: string, dsVersionId: string): string;
|
|
47
|
+
dsMetadataRequestURL(dsId: string): string;
|
|
48
|
+
dsVersionRequestURL(dsId: string): string;
|
|
49
|
+
}
|
|
50
|
+
export {};
|