@supernova-studio/client 0.48.29 → 0.48.31
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/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +189 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +189 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/yjs/version-room/frontend.ts +7 -2
- package/src/yjs/version-room/utils.ts +62 -3
package/dist/index.d.mts
CHANGED
|
@@ -42566,11 +42566,11 @@ declare class FrontendVersionRoomYDoc {
|
|
|
42566
42566
|
private getDeletedGroups;
|
|
42567
42567
|
private buildGroupPublishedMetadata;
|
|
42568
42568
|
private createDraftState;
|
|
42569
|
-
notifyDocumentationPageContentUpdated(pageId: string, content: DocumentationPageEditorModel): void;
|
|
42569
|
+
notifyDocumentationPageContentUpdated(pageId: string, content: DocumentationPageEditorModel, definitions: PageBlockDefinition[]): void;
|
|
42570
42570
|
isDraftFeatureAdopted(): boolean;
|
|
42571
42571
|
hasPublishedDocumentationContent(): boolean;
|
|
42572
42572
|
}
|
|
42573
42573
|
|
|
42574
|
-
declare function generatePageContentHash(content: DocumentationPageEditorModel, debug?: boolean): string;
|
|
42574
|
+
declare function generatePageContentHash(content: DocumentationPageEditorModel, definitions: PageBlockDefinition[], debug?: boolean): string;
|
|
42575
42575
|
|
|
42576
42576
|
export { BackendVersionRoomYDoc, BlockDefinitionUtils, BlockParsingUtils, DTOAssetRenderConfiguration, DTOBrand, DTOBrandCreateResponse, DTOBrandGetResponse, DTOBrandsListResponse, DTOCreateBrandInput, DTOCreateDocumentationGroupInput, DTOCreateDocumentationPageInputV2, DTOCreateDocumentationTabInput, DTOCreateElementPropertyDefinitionInputV2, DTOCreateVersionInput, DTODataSource, DTODataSourceCreationResponse, DTODataSourceFigma, DTODataSourceFigmaCloud, DTODataSourceFigmaVariablesPlugin, DTODataSourceTokenStudio, DTODataSourcesListResponse, DTODeleteDocumentationGroupInput, DTODeleteDocumentationPageInputV2, DTODeleteDocumentationTabGroupInput, DTODeleteElementPropertyDefinitionInputV2, DTODesignElementsDataDiffResponse, DTODesignSystem, DTODesignSystemUpdateInput, DTODesignSystemVersion, DTODesignSystemVersionCreationResponse, DTODesignSystemVersionGetResponse, DTODesignSystemVersionJobStatusResponse, DTODesignSystemVersionJobsResponse, DTODesignSystemVersionsListResponse, DTODiffCountBase, DTODocumentationDraftChangeType, DTODocumentationDraftState, DTODocumentationDraftStateCreated, DTODocumentationDraftStateDeleted, DTODocumentationDraftStateUpdated, DTODocumentationGroupCreateActionInputV2, DTODocumentationGroupCreateActionOutputV2, DTODocumentationGroupDeleteActionInputV2, DTODocumentationGroupDeleteActionOutputV2, DTODocumentationGroupDuplicateActionInputV2, DTODocumentationGroupDuplicateActionOutputV2, DTODocumentationGroupMoveActionInputV2, DTODocumentationGroupMoveActionOutputV2, DTODocumentationGroupRestoreActionInput, DTODocumentationGroupRestoreActionOutput, DTODocumentationGroupStructureV1, DTODocumentationGroupUpdateActionInputV2, DTODocumentationGroupUpdateActionOutputV2, DTODocumentationGroupV1, DTODocumentationGroupV2, DTODocumentationHierarchyV2, DTODocumentationItemConfigurationV1, DTODocumentationItemConfigurationV2, DTODocumentationItemHeaderV2, DTODocumentationLinkPreviewRequest, DTODocumentationLinkPreviewResponse, DTODocumentationPageAnchor, DTODocumentationPageContent, DTODocumentationPageContentGetResponse, DTODocumentationPageCreateActionInputV2, DTODocumentationPageCreateActionOutputV2, DTODocumentationPageDeleteActionInputV2, DTODocumentationPageDeleteActionOutputV2, DTODocumentationPageDuplicateActionInputV2, DTODocumentationPageDuplicateActionOutputV2, DTODocumentationPageMoveActionInputV2, DTODocumentationPageMoveActionOutputV2, DTODocumentationPageRestoreActionInput, DTODocumentationPageRestoreActionOutput, DTODocumentationPageRoomHeaderData, DTODocumentationPageRoomHeaderDataUpdate, DTODocumentationPageSnapshot, DTODocumentationPageUpdateActionInputV2, DTODocumentationPageUpdateActionOutputV2, DTODocumentationPageV2, DTODocumentationPublishMetadata, DTODocumentationPublishTypeQueryParams, DTODocumentationTabCreateActionInputV2, DTODocumentationTabCreateActionOutputV2, type DTODocumentationTabGroupCreateActionInputV2, DTODocumentationTabGroupDeleteActionInputV2, DTODocumentationTabGroupDeleteActionOutputV2, DTODownloadAssetsRequest, DTODownloadAssetsResponse, DTODuplicateDocumentationGroupInput, DTODuplicateDocumentationPageInputV2, DTOElementActionInput, DTOElementActionOutput, DTOElementPropertyDefinition, DTOElementPropertyDefinitionsGetResponse, DTOElementPropertyValue, DTOElementPropertyValuesGetResponse, DTOElementView, DTOElementViewBasePropertyColumn, DTOElementViewColumn, DTOElementViewColumnSharedAttributes, DTOElementViewPropertyDefinitionColumn, DTOElementViewThemeColumn, DTOElementViewsListResponse, DTOElementsGetOutput, type DTOElementsGetQueryParsed, type DTOElementsGetQueryRaw, DTOElementsGetQuerySchema, DTOElementsGetTypeFilter, DTOExportJob, DTOExportJobCreatedBy, DTOExportJobDesignSystemPreview, DTOExportJobDesignSystemVersionPreview, DTOExportJobDestinations, DTOExportJobResponse, DTOExportJobResult, DTOExportJobsListFilter, DTOExporter, DTOExporterCreateInput, DTOExporterCreateOutput, DTOExporterGitProviderEnum, DTOExporterMembership, DTOExporterMembershipRole, DTOExporterProperty, DTOExporterPropertyListResponse, DTOExporterSource, DTOExporterType, DTOExporterUpdateInput, DTOFigmaNode, DTOFigmaNodeData, DTOFigmaNodeOrigin, DTOFigmaNodeRenderActionInput, DTOFigmaNodeRenderActionOutput, DTOFigmaNodeRenderInput, DTOGetBlockDefinitionsOutput, DTOGetDocumentationPageAnchorsResponse, DTOGitBranch, DTOGitOrganization, DTOGitProject, DTOGitRepository, DTOIntegration, DTOIntegrationCredentials, DTOIntegrationOAuthGetResponse, DTOIntegrationPostResponse, DTOIntegrationsGetListResponse, DTOLiveblocksAuthRequest, DTOLiveblocksAuthResponse, DTOMoveDocumentationGroupInput, DTOMoveDocumentationPageInputV2, DTONpmRegistryConfig, DTONpmRegistryConfigConstants, DTOPageBlockColorV2, DTOPageBlockDefinition, DTOPageBlockDefinitionBehavior, DTOPageBlockDefinitionItem, DTOPageBlockDefinitionLayout, DTOPageBlockDefinitionProperty, DTOPageBlockDefinitionVariant, DTOPageBlockItemV2, DTOPagination, DTOPipeline, DTOPipelineCreateBody, DTOPipelineTriggerBody, DTOPipelineUpdateBody, DTOPropertyDefinitionCreateActionInputV2, DTOPropertyDefinitionCreateActionOutputV2, DTOPropertyDefinitionDeleteActionInputV2, DTOPropertyDefinitionDeleteActionOutputV2, DTOPropertyDefinitionUpdateActionInputV2, DTOPropertyDefinitionUpdateActionOutputV2, DTOPublishDocumentationChanges, DTOPublishDocumentationRequest, DTOPublishDocumentationResponse, DTORenderedAssetFile, DTORestoreDocumentationGroupInput, DTORestoreDocumentationPageInput, DTOUpdateDocumentationGroupInput, DTOUpdateDocumentationPageInputV2, DTOUpdateElementPropertyDefinitionInputV2, DTOUpdateUserNotificationSettingsPayload, DTOUpdateVersionInput, DTOUserNotificationSettingsResponse, DTOUserProfileUpdatePayload, DTOUserProfileUpdateResponse, DTOUserWorkspaceMembership, DTOUserWorkspaceMembershipsResponse, DTOWorkspace, DTOWorkspaceIntegrationGetGitObjectsInput, DTOWorkspaceIntegrationOauthInput, DTOWorkspaceIntegrationPATInput, DTOWorkspaceRole, DocumentationHierarchySettings, DocumentationPageEditorModel, DocumentationPageV1DTO, FrontendVersionRoomYDoc, type ListItemNode, type ListNode, ListTreeBuilder, NpmRegistryInput, ObjectMeta, PageBlockEditorModel, PageSectionEditorModel, type ProsemirrorBlockItem, type ProsemirrorMark, type ProsemirrorNode, VersionRoomBaseYDoc, VersionSQSPayload, WorkspaceConfigurationPayload, applyPrivacyConfigurationToNestedItems, blockToProsemirrorNode, buildDocPagePublishPaths, calculateElementParentChain, documentationItemConfigurationToDTOV1, documentationItemConfigurationToDTOV2, documentationPageToDTOV2, documentationPagesFixedConfigurationToDTOV1, documentationPagesFixedConfigurationToDTOV2, documentationPagesToDTOV1, documentationPagesToDTOV2, elementGroupsToDocumentationGroupDTOV1, elementGroupsToDocumentationGroupDTOV2, elementGroupsToDocumentationGroupFixedConfigurationDTOV1, elementGroupsToDocumentationGroupFixedConfigurationDTOV2, elementGroupsToDocumentationGroupStructureDTOV1, generateHash, generatePageContentHash, getDtoDefaultItemConfigurationV1, getDtoDefaultItemConfigurationV2, getMockPageBlockDefinitions, gitBranchToDto, gitOrganizationToDto, gitProjectToDto, gitRepositoryToDto, integrationCredentialToDto, integrationToDto, itemConfigurationToYjs, pageToProsemirrorDoc, pageToYDoc, pageToYXmlFragment, pipelineToDto, pmSchema, prosemirrorDocToPage, prosemirrorNodeToSection, prosemirrorNodesToBlocks, serializeAsCustomBlock, shallowProsemirrorNodeToBlock, validateDesignSystemVersion, validateSsoPayload, yDocToPage, yXmlFragmentToPage, yjsToDocumentationHierarchy, yjsToItemConfiguration };
|
package/dist/index.d.ts
CHANGED
|
@@ -42566,11 +42566,11 @@ declare class FrontendVersionRoomYDoc {
|
|
|
42566
42566
|
private getDeletedGroups;
|
|
42567
42567
|
private buildGroupPublishedMetadata;
|
|
42568
42568
|
private createDraftState;
|
|
42569
|
-
notifyDocumentationPageContentUpdated(pageId: string, content: DocumentationPageEditorModel): void;
|
|
42569
|
+
notifyDocumentationPageContentUpdated(pageId: string, content: DocumentationPageEditorModel, definitions: PageBlockDefinition[]): void;
|
|
42570
42570
|
isDraftFeatureAdopted(): boolean;
|
|
42571
42571
|
hasPublishedDocumentationContent(): boolean;
|
|
42572
42572
|
}
|
|
42573
42573
|
|
|
42574
|
-
declare function generatePageContentHash(content: DocumentationPageEditorModel, debug?: boolean): string;
|
|
42574
|
+
declare function generatePageContentHash(content: DocumentationPageEditorModel, definitions: PageBlockDefinition[], debug?: boolean): string;
|
|
42575
42575
|
|
|
42576
42576
|
export { BackendVersionRoomYDoc, BlockDefinitionUtils, BlockParsingUtils, DTOAssetRenderConfiguration, DTOBrand, DTOBrandCreateResponse, DTOBrandGetResponse, DTOBrandsListResponse, DTOCreateBrandInput, DTOCreateDocumentationGroupInput, DTOCreateDocumentationPageInputV2, DTOCreateDocumentationTabInput, DTOCreateElementPropertyDefinitionInputV2, DTOCreateVersionInput, DTODataSource, DTODataSourceCreationResponse, DTODataSourceFigma, DTODataSourceFigmaCloud, DTODataSourceFigmaVariablesPlugin, DTODataSourceTokenStudio, DTODataSourcesListResponse, DTODeleteDocumentationGroupInput, DTODeleteDocumentationPageInputV2, DTODeleteDocumentationTabGroupInput, DTODeleteElementPropertyDefinitionInputV2, DTODesignElementsDataDiffResponse, DTODesignSystem, DTODesignSystemUpdateInput, DTODesignSystemVersion, DTODesignSystemVersionCreationResponse, DTODesignSystemVersionGetResponse, DTODesignSystemVersionJobStatusResponse, DTODesignSystemVersionJobsResponse, DTODesignSystemVersionsListResponse, DTODiffCountBase, DTODocumentationDraftChangeType, DTODocumentationDraftState, DTODocumentationDraftStateCreated, DTODocumentationDraftStateDeleted, DTODocumentationDraftStateUpdated, DTODocumentationGroupCreateActionInputV2, DTODocumentationGroupCreateActionOutputV2, DTODocumentationGroupDeleteActionInputV2, DTODocumentationGroupDeleteActionOutputV2, DTODocumentationGroupDuplicateActionInputV2, DTODocumentationGroupDuplicateActionOutputV2, DTODocumentationGroupMoveActionInputV2, DTODocumentationGroupMoveActionOutputV2, DTODocumentationGroupRestoreActionInput, DTODocumentationGroupRestoreActionOutput, DTODocumentationGroupStructureV1, DTODocumentationGroupUpdateActionInputV2, DTODocumentationGroupUpdateActionOutputV2, DTODocumentationGroupV1, DTODocumentationGroupV2, DTODocumentationHierarchyV2, DTODocumentationItemConfigurationV1, DTODocumentationItemConfigurationV2, DTODocumentationItemHeaderV2, DTODocumentationLinkPreviewRequest, DTODocumentationLinkPreviewResponse, DTODocumentationPageAnchor, DTODocumentationPageContent, DTODocumentationPageContentGetResponse, DTODocumentationPageCreateActionInputV2, DTODocumentationPageCreateActionOutputV2, DTODocumentationPageDeleteActionInputV2, DTODocumentationPageDeleteActionOutputV2, DTODocumentationPageDuplicateActionInputV2, DTODocumentationPageDuplicateActionOutputV2, DTODocumentationPageMoveActionInputV2, DTODocumentationPageMoveActionOutputV2, DTODocumentationPageRestoreActionInput, DTODocumentationPageRestoreActionOutput, DTODocumentationPageRoomHeaderData, DTODocumentationPageRoomHeaderDataUpdate, DTODocumentationPageSnapshot, DTODocumentationPageUpdateActionInputV2, DTODocumentationPageUpdateActionOutputV2, DTODocumentationPageV2, DTODocumentationPublishMetadata, DTODocumentationPublishTypeQueryParams, DTODocumentationTabCreateActionInputV2, DTODocumentationTabCreateActionOutputV2, type DTODocumentationTabGroupCreateActionInputV2, DTODocumentationTabGroupDeleteActionInputV2, DTODocumentationTabGroupDeleteActionOutputV2, DTODownloadAssetsRequest, DTODownloadAssetsResponse, DTODuplicateDocumentationGroupInput, DTODuplicateDocumentationPageInputV2, DTOElementActionInput, DTOElementActionOutput, DTOElementPropertyDefinition, DTOElementPropertyDefinitionsGetResponse, DTOElementPropertyValue, DTOElementPropertyValuesGetResponse, DTOElementView, DTOElementViewBasePropertyColumn, DTOElementViewColumn, DTOElementViewColumnSharedAttributes, DTOElementViewPropertyDefinitionColumn, DTOElementViewThemeColumn, DTOElementViewsListResponse, DTOElementsGetOutput, type DTOElementsGetQueryParsed, type DTOElementsGetQueryRaw, DTOElementsGetQuerySchema, DTOElementsGetTypeFilter, DTOExportJob, DTOExportJobCreatedBy, DTOExportJobDesignSystemPreview, DTOExportJobDesignSystemVersionPreview, DTOExportJobDestinations, DTOExportJobResponse, DTOExportJobResult, DTOExportJobsListFilter, DTOExporter, DTOExporterCreateInput, DTOExporterCreateOutput, DTOExporterGitProviderEnum, DTOExporterMembership, DTOExporterMembershipRole, DTOExporterProperty, DTOExporterPropertyListResponse, DTOExporterSource, DTOExporterType, DTOExporterUpdateInput, DTOFigmaNode, DTOFigmaNodeData, DTOFigmaNodeOrigin, DTOFigmaNodeRenderActionInput, DTOFigmaNodeRenderActionOutput, DTOFigmaNodeRenderInput, DTOGetBlockDefinitionsOutput, DTOGetDocumentationPageAnchorsResponse, DTOGitBranch, DTOGitOrganization, DTOGitProject, DTOGitRepository, DTOIntegration, DTOIntegrationCredentials, DTOIntegrationOAuthGetResponse, DTOIntegrationPostResponse, DTOIntegrationsGetListResponse, DTOLiveblocksAuthRequest, DTOLiveblocksAuthResponse, DTOMoveDocumentationGroupInput, DTOMoveDocumentationPageInputV2, DTONpmRegistryConfig, DTONpmRegistryConfigConstants, DTOPageBlockColorV2, DTOPageBlockDefinition, DTOPageBlockDefinitionBehavior, DTOPageBlockDefinitionItem, DTOPageBlockDefinitionLayout, DTOPageBlockDefinitionProperty, DTOPageBlockDefinitionVariant, DTOPageBlockItemV2, DTOPagination, DTOPipeline, DTOPipelineCreateBody, DTOPipelineTriggerBody, DTOPipelineUpdateBody, DTOPropertyDefinitionCreateActionInputV2, DTOPropertyDefinitionCreateActionOutputV2, DTOPropertyDefinitionDeleteActionInputV2, DTOPropertyDefinitionDeleteActionOutputV2, DTOPropertyDefinitionUpdateActionInputV2, DTOPropertyDefinitionUpdateActionOutputV2, DTOPublishDocumentationChanges, DTOPublishDocumentationRequest, DTOPublishDocumentationResponse, DTORenderedAssetFile, DTORestoreDocumentationGroupInput, DTORestoreDocumentationPageInput, DTOUpdateDocumentationGroupInput, DTOUpdateDocumentationPageInputV2, DTOUpdateElementPropertyDefinitionInputV2, DTOUpdateUserNotificationSettingsPayload, DTOUpdateVersionInput, DTOUserNotificationSettingsResponse, DTOUserProfileUpdatePayload, DTOUserProfileUpdateResponse, DTOUserWorkspaceMembership, DTOUserWorkspaceMembershipsResponse, DTOWorkspace, DTOWorkspaceIntegrationGetGitObjectsInput, DTOWorkspaceIntegrationOauthInput, DTOWorkspaceIntegrationPATInput, DTOWorkspaceRole, DocumentationHierarchySettings, DocumentationPageEditorModel, DocumentationPageV1DTO, FrontendVersionRoomYDoc, type ListItemNode, type ListNode, ListTreeBuilder, NpmRegistryInput, ObjectMeta, PageBlockEditorModel, PageSectionEditorModel, type ProsemirrorBlockItem, type ProsemirrorMark, type ProsemirrorNode, VersionRoomBaseYDoc, VersionSQSPayload, WorkspaceConfigurationPayload, applyPrivacyConfigurationToNestedItems, blockToProsemirrorNode, buildDocPagePublishPaths, calculateElementParentChain, documentationItemConfigurationToDTOV1, documentationItemConfigurationToDTOV2, documentationPageToDTOV2, documentationPagesFixedConfigurationToDTOV1, documentationPagesFixedConfigurationToDTOV2, documentationPagesToDTOV1, documentationPagesToDTOV2, elementGroupsToDocumentationGroupDTOV1, elementGroupsToDocumentationGroupDTOV2, elementGroupsToDocumentationGroupFixedConfigurationDTOV1, elementGroupsToDocumentationGroupFixedConfigurationDTOV2, elementGroupsToDocumentationGroupStructureDTOV1, generateHash, generatePageContentHash, getDtoDefaultItemConfigurationV1, getDtoDefaultItemConfigurationV2, getMockPageBlockDefinitions, gitBranchToDto, gitOrganizationToDto, gitProjectToDto, gitRepositoryToDto, integrationCredentialToDto, integrationToDto, itemConfigurationToYjs, pageToProsemirrorDoc, pageToYDoc, pageToYXmlFragment, pipelineToDto, pmSchema, prosemirrorDocToPage, prosemirrorNodeToSection, prosemirrorNodesToBlocks, serializeAsCustomBlock, shallowProsemirrorNodeToBlock, validateDesignSystemVersion, validateSsoPayload, yDocToPage, yXmlFragmentToPage, yjsToDocumentationHierarchy, yjsToItemConfiguration };
|
package/dist/index.js
CHANGED
|
@@ -177,6 +177,12 @@ var _ipcidr = require('ip-cidr'); var _ipcidr2 = _interopRequireDefault(_ipcidr)
|
|
|
177
177
|
|
|
178
178
|
|
|
179
179
|
|
|
180
|
+
var __defProp2 = Object.defineProperty;
|
|
181
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
182
|
+
var __publicField2 = (obj, key, value) => {
|
|
183
|
+
__defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
184
|
+
return value;
|
|
185
|
+
};
|
|
180
186
|
var AssetDeleteScheduleStatus = _zod.z.enum(["InProgress", "Pending"]);
|
|
181
187
|
var AssetDeleteSchedule = _zod.z.object({
|
|
182
188
|
id: _zod.z.string(),
|
|
@@ -1789,6 +1795,96 @@ var PageBlockV1 = PageBlockBaseV1.extend({
|
|
|
1789
1795
|
() => PageBlockV1.array().nullish().transform((t) => _nullishCoalesce(t, () => ( [])))
|
|
1790
1796
|
)
|
|
1791
1797
|
});
|
|
1798
|
+
function removeCommentSpans(text) {
|
|
1799
|
+
const { spans, ...rest } = text;
|
|
1800
|
+
const newSpans = spans.map((s) => {
|
|
1801
|
+
return {
|
|
1802
|
+
...s,
|
|
1803
|
+
attributes: s.attributes.filter((a) => a.type !== "Comment")
|
|
1804
|
+
};
|
|
1805
|
+
});
|
|
1806
|
+
const updatedRichText = {
|
|
1807
|
+
...rest,
|
|
1808
|
+
spans: newSpans
|
|
1809
|
+
};
|
|
1810
|
+
return joinRepeatingSpans(updatedRichText);
|
|
1811
|
+
}
|
|
1812
|
+
function joinRepeatingSpans(text) {
|
|
1813
|
+
if (text.spans.length < 2)
|
|
1814
|
+
return text;
|
|
1815
|
+
text = sanitizeSpans(text);
|
|
1816
|
+
const { spans, ...rest } = text;
|
|
1817
|
+
let previousSpan = { ...spans[0] };
|
|
1818
|
+
const newSpans = [previousSpan];
|
|
1819
|
+
for (let i = 1; i < spans.length; i++) {
|
|
1820
|
+
const span = spans[i];
|
|
1821
|
+
if (areAttributesEqual(span.attributes, previousSpan.attributes)) {
|
|
1822
|
+
previousSpan.text += span.text;
|
|
1823
|
+
} else {
|
|
1824
|
+
previousSpan = { ...span };
|
|
1825
|
+
newSpans.push(previousSpan);
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
return {
|
|
1829
|
+
...rest,
|
|
1830
|
+
spans: newSpans
|
|
1831
|
+
};
|
|
1832
|
+
}
|
|
1833
|
+
function areAttributesEqual(lhs, rhs) {
|
|
1834
|
+
if (lhs.length !== rhs.length)
|
|
1835
|
+
return false;
|
|
1836
|
+
const lhsMap = mapByUnique(lhs, (i) => i.type);
|
|
1837
|
+
for (const rhsAttribute of rhs) {
|
|
1838
|
+
const lhsAttribute = lhsMap.get(rhsAttribute.type);
|
|
1839
|
+
if (!_deepequal2.default.call(void 0, lhsAttribute, rhsAttribute))
|
|
1840
|
+
return false;
|
|
1841
|
+
}
|
|
1842
|
+
return true;
|
|
1843
|
+
}
|
|
1844
|
+
function sanitizeSpans(text) {
|
|
1845
|
+
const { spans, ...rest } = text;
|
|
1846
|
+
return {
|
|
1847
|
+
...rest,
|
|
1848
|
+
spans: spans.map((s) => {
|
|
1849
|
+
const { attributes, ...rest2 } = s;
|
|
1850
|
+
return {
|
|
1851
|
+
...rest2,
|
|
1852
|
+
attributes: attributes.map(sanitizeSpanAttribute)
|
|
1853
|
+
};
|
|
1854
|
+
})
|
|
1855
|
+
};
|
|
1856
|
+
}
|
|
1857
|
+
function sanitizeSpanAttribute(attribute) {
|
|
1858
|
+
switch (attribute.type) {
|
|
1859
|
+
case "Bold":
|
|
1860
|
+
return { type: "Bold" };
|
|
1861
|
+
case "Code":
|
|
1862
|
+
return { type: "Code" };
|
|
1863
|
+
case "Strikethrough":
|
|
1864
|
+
return { type: "Strikethrough" };
|
|
1865
|
+
case "Italic":
|
|
1866
|
+
return { type: "Italic" };
|
|
1867
|
+
case "Comment":
|
|
1868
|
+
const { commentHighlightId, commentIsResolved } = attribute;
|
|
1869
|
+
const isCommentIsResolvedDefined = commentIsResolved !== void 0 && commentIsResolved !== null;
|
|
1870
|
+
return {
|
|
1871
|
+
type: "Comment",
|
|
1872
|
+
...isCommentIsResolvedDefined && { commentIsResolved },
|
|
1873
|
+
...commentHighlightId && { commentHighlightId }
|
|
1874
|
+
};
|
|
1875
|
+
case "Link":
|
|
1876
|
+
const { documentationItemId, link, openInNewTab, openInNewWindow } = attribute;
|
|
1877
|
+
const isOpenInNewTabDefined = openInNewTab !== void 0 && openInNewTab !== null;
|
|
1878
|
+
const isOpenInNewWindowDefined = openInNewWindow !== void 0 && openInNewWindow !== null;
|
|
1879
|
+
return {
|
|
1880
|
+
type: "Link",
|
|
1881
|
+
...isOpenInNewTabDefined && { openInNewTab },
|
|
1882
|
+
...isOpenInNewWindowDefined && { openInNewWindow },
|
|
1883
|
+
...documentationItemId && { documentationItemId },
|
|
1884
|
+
...link && { link }
|
|
1885
|
+
};
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1792
1888
|
var PageBlockLinkType = _zod.z.enum(["DocumentationItem", "PageHeading", "Url"]);
|
|
1793
1889
|
var PageBlockImageType = _zod.z.enum(["Resource", "FigmaNode"]);
|
|
1794
1890
|
var PageBlockImageAlignment = _zod.z.enum(["Left", "Center", "Stretch"]);
|
|
@@ -2614,6 +2710,60 @@ var Theme = DesignElementBase.extend(DesignElementBrandedPart.shape).extend({
|
|
|
2614
2710
|
overrides: _zod.z.array(ThemeOverride),
|
|
2615
2711
|
codeName: _zod.z.string()
|
|
2616
2712
|
});
|
|
2713
|
+
function mapPageBlockItemValuesV2(pageItems, definitionsMap, fn) {
|
|
2714
|
+
traversePageBlockItemsV2(pageItems, (block, item) => {
|
|
2715
|
+
Object.entries(item.props).forEach(([propKey, value]) => {
|
|
2716
|
+
const property = definitionsMap.getDefinitionProperty(block.data.packageId, propKey);
|
|
2717
|
+
if (!property)
|
|
2718
|
+
return;
|
|
2719
|
+
item.props[propKey] = fn(block, item, property, value);
|
|
2720
|
+
});
|
|
2721
|
+
});
|
|
2722
|
+
}
|
|
2723
|
+
function traversePageBlockItemsV2(pageItems, fn) {
|
|
2724
|
+
traversePageItemsV2(pageItems, (block) => {
|
|
2725
|
+
block.data.items.forEach((item) => {
|
|
2726
|
+
fn(block, item);
|
|
2727
|
+
});
|
|
2728
|
+
});
|
|
2729
|
+
}
|
|
2730
|
+
function traversePageItemsV2(pageItems, fn) {
|
|
2731
|
+
for (const item of pageItems) {
|
|
2732
|
+
switch (item.type) {
|
|
2733
|
+
case "Block":
|
|
2734
|
+
fn(item);
|
|
2735
|
+
break;
|
|
2736
|
+
case "Section":
|
|
2737
|
+
item.items.forEach((i) => {
|
|
2738
|
+
i.columns.forEach((c) => {
|
|
2739
|
+
traversePageItemsV2(c.blocks, fn);
|
|
2740
|
+
});
|
|
2741
|
+
});
|
|
2742
|
+
break;
|
|
2743
|
+
}
|
|
2744
|
+
}
|
|
2745
|
+
}
|
|
2746
|
+
var PageBlockDefinitionsMap = class {
|
|
2747
|
+
constructor(definitions) {
|
|
2748
|
+
__publicField2(this, "definitionsMap", /* @__PURE__ */ new Map());
|
|
2749
|
+
__publicField2(this, "propertiesMap", /* @__PURE__ */ new Map());
|
|
2750
|
+
definitions.forEach((d) => {
|
|
2751
|
+
this.definitionsMap.set(d.id, d);
|
|
2752
|
+
d.item.properties.forEach((p) => {
|
|
2753
|
+
this.propertiesMap.set(this.propertyKey(d.id, p.id), p);
|
|
2754
|
+
});
|
|
2755
|
+
});
|
|
2756
|
+
}
|
|
2757
|
+
getDefinition(id) {
|
|
2758
|
+
return this.definitionsMap.get(id);
|
|
2759
|
+
}
|
|
2760
|
+
getDefinitionProperty(defId, propId) {
|
|
2761
|
+
return this.propertiesMap.get(this.propertyKey(defId, propId));
|
|
2762
|
+
}
|
|
2763
|
+
propertyKey(defId, propId) {
|
|
2764
|
+
return `${defId}.${propId}`;
|
|
2765
|
+
}
|
|
2766
|
+
};
|
|
2617
2767
|
var FileStructureStats = _zod.z.object({
|
|
2618
2768
|
frames: zeroNumberByDefault(),
|
|
2619
2769
|
components: zeroNumberByDefault(),
|
|
@@ -6195,9 +6345,10 @@ var VersionRoomBaseYDoc = class {
|
|
|
6195
6345
|
};
|
|
6196
6346
|
|
|
6197
6347
|
// src/yjs/version-room/utils.ts
|
|
6198
|
-
function generatePageContentHash(content, debug = false) {
|
|
6348
|
+
function generatePageContentHash(content, definitions, debug = false) {
|
|
6199
6349
|
let sanitizedContent = content;
|
|
6200
|
-
|
|
6350
|
+
sanitizedContent = removeCommentSpansFromPage(content, definitions);
|
|
6351
|
+
if (isPageContentEmpty(sanitizedContent)) {
|
|
6201
6352
|
sanitizedContent = { blocks: [] };
|
|
6202
6353
|
}
|
|
6203
6354
|
return generateHash(sanitizedContent, debug);
|
|
@@ -6217,6 +6368,40 @@ function isPageContentEmpty(content) {
|
|
|
6217
6368
|
const textValue = singleItem.props["text"];
|
|
6218
6369
|
return !textValue.value.spans.length;
|
|
6219
6370
|
}
|
|
6371
|
+
function removeCommentSpansFromPage(content, definitions) {
|
|
6372
|
+
const defMap = new PageBlockDefinitionsMap(definitions);
|
|
6373
|
+
mapPageBlockItemValuesV2(content.blocks, defMap, (block, item, prop, value) => {
|
|
6374
|
+
if (prop.type === "RichText") {
|
|
6375
|
+
const richTextValue = value;
|
|
6376
|
+
return {
|
|
6377
|
+
...richTextValue,
|
|
6378
|
+
value: removeCommentSpans(richTextValue.value)
|
|
6379
|
+
};
|
|
6380
|
+
}
|
|
6381
|
+
if (prop.type === "MultiRichText") {
|
|
6382
|
+
const multiRichTextValue = value;
|
|
6383
|
+
return {
|
|
6384
|
+
...multiRichTextValue,
|
|
6385
|
+
value: multiRichTextValue.value.map(removeCommentSpans)
|
|
6386
|
+
};
|
|
6387
|
+
}
|
|
6388
|
+
if (prop.type === "Table") {
|
|
6389
|
+
const tableValue = value;
|
|
6390
|
+
tableValue.value.forEach((r) => {
|
|
6391
|
+
r.cells.forEach((c) => {
|
|
6392
|
+
c.nodes.forEach((n) => {
|
|
6393
|
+
if (n.type === "RichText") {
|
|
6394
|
+
n.value = removeCommentSpans(n.value);
|
|
6395
|
+
}
|
|
6396
|
+
});
|
|
6397
|
+
});
|
|
6398
|
+
});
|
|
6399
|
+
return tableValue;
|
|
6400
|
+
}
|
|
6401
|
+
return value;
|
|
6402
|
+
});
|
|
6403
|
+
return content;
|
|
6404
|
+
}
|
|
6220
6405
|
|
|
6221
6406
|
// src/yjs/version-room/frontend.ts
|
|
6222
6407
|
var FrontendVersionRoomYDoc = class {
|
|
@@ -6454,8 +6639,8 @@ var FrontendVersionRoomYDoc = class {
|
|
|
6454
6639
|
//
|
|
6455
6640
|
// Update page content hash
|
|
6456
6641
|
//
|
|
6457
|
-
notifyDocumentationPageContentUpdated(pageId, content) {
|
|
6458
|
-
const pageContentHash = generatePageContentHash(content, this.debug);
|
|
6642
|
+
notifyDocumentationPageContentUpdated(pageId, content, definitions) {
|
|
6643
|
+
const pageContentHash = generatePageContentHash(content, definitions, this.debug);
|
|
6459
6644
|
if (this.debug) {
|
|
6460
6645
|
console.log(`Will set page content hash: '${pageId}' : '${pageContentHash}'`);
|
|
6461
6646
|
}
|