Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/contributor-docs/multi-version-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,4 +304,4 @@ When you add a breaking change to a component, you manually add the new `./v11_8
4. **Create** a new lettered export file that exports all components at their latest versions
5. **Update** `package.json` exports: add the new `./vX_Y` entry and point `./latest` to the new letter

For information on how documentation is versioned alongside components, see the [Docs Versioning](/#contributor-guides/#docs-versioning) guide.
For information on how documentation is versioned alongside components, see the [Docs Versioning](/#docs-versioning) guide.
5 changes: 3 additions & 2 deletions packages/__docs__/buildScripts/DataTypes.mts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type ProcessedFile =
YamlMetaInfo &
JsDocResult &
PackagePathData &
{ title: string, id:string, componentVersion?: string }
{ title: string, id:string, componentVersion?: string, componentDirName?: string }

type PackagePathData = {
extension: string
Expand Down Expand Up @@ -146,7 +146,8 @@ type MainDocsData = {

type VersionMapEntry = {
exportLetter: string
componentVersions: string[]
/** Maps component directory names (e.g. 'DateInput') to their version (e.g. 'v2') */
componentDirVersions: Record<string, string>
}

type VersionMap = {
Expand Down
3 changes: 2 additions & 1 deletion packages/__docs__/buildScripts/build-docs.mts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ function filterDocsForVersion(
versionMap,
libVersion,
doc.componentVersion,
getPackageShortName(doc.relativePath)
getPackageShortName(doc.relativePath),
doc.componentDirName
)
)
}
Expand Down
11 changes: 7 additions & 4 deletions packages/__docs__/buildScripts/processFile.mts
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,16 @@ export function processFile(
docData.title = docData.id
}

// Extract component version from the file path (e.g. /v1/ or /v2/)
// Extract component version and directory name from the file path (e.g. /v1/ or /v2/)
const pathSegments = fullPath.split(path.sep)
const srcIndex = pathSegments.indexOf('src')
const segmentsAfterSrc = srcIndex >= 0 ? pathSegments.slice(srcIndex + 1) : pathSegments
const versionSegment = segmentsAfterSrc.find((seg) => /^v\d+$/.test(seg))
if (versionSegment) {
docData.componentVersion = versionSegment
const versionSegmentIndex = segmentsAfterSrc.findIndex((seg) => /^v\d+$/.test(seg))
if (versionSegmentIndex >= 0) {
docData.componentVersion = segmentsAfterSrc[versionSegmentIndex]
if (versionSegmentIndex > 0) {
docData.componentDirName = segmentsAfterSrc[versionSegmentIndex - 1]
}
}

return docData
Expand Down
28 changes: 18 additions & 10 deletions packages/__docs__/buildScripts/utils/buildVersionMap.mts
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ export async function buildVersionMap(
continue
}

// Resolve all component versions from the source export file
const componentVersions = resolveComponentVersions(
// Resolve per-component-dir versions from the source export file
const componentDirVersions = resolveComponentVersions(
pkgDir,
exportLetter,
pkgShortName
Expand All @@ -104,7 +104,7 @@ export async function buildVersionMap(
}
mapping[libVersion][pkgShortName] = {
exportLetter,
componentVersions
componentDirVersions
}
}
}
Expand Down Expand Up @@ -150,7 +150,8 @@ export function isDocIncludedInVersion(
versionMap: VersionMap,
libVersion: string,
componentVersion: string | undefined,
pkgShortName: string | undefined
pkgShortName: string | undefined,
componentDirName: string | undefined
): boolean {
if (!componentVersion || !pkgShortName) {
return true
Expand All @@ -162,7 +163,14 @@ export function isDocIncludedInVersion(
return componentVersion === 'v1'
}

return entry.componentVersions.includes(componentVersion)
if (componentDirName) {
const mappedVersion = entry.componentDirVersions[componentDirName]
if (mappedVersion !== undefined) {
return mappedVersion === componentVersion
}
// Component dir not found in map; fall back to checking any match
}
return Object.values(entry.componentDirVersions).includes(componentVersion)
}

/**
Expand All @@ -175,7 +183,7 @@ function resolveComponentVersions(
pkgDir: string,
exportLetter: string,
pkgShortName: string
): string[] {
): Record<string, string> {
const exportFilePath = path.join(
pkgDir,
'src',
Expand All @@ -195,11 +203,11 @@ function resolveComponentVersions(
// Match all patterns like:
// from '../ComponentName/v2'
// from '../ComponentName/v1/SubComponent'
const versionRegex = /from\s+['"]\.\.\/[^/]+\/(v\d+)(?:\/|['"])/g
const versions = new Set<string>()
const versionRegex = /from\s+['"]\.\.\/([^/]+)\/(v\d+)(?:\/|['"])/g
const versions = new Map<string, string>() // componentDir → version
let match
while ((match = versionRegex.exec(content)) !== null) {
versions.add(match[1])
versions.set(match[1], match[2])
}

if (versions.size === 0) {
Expand All @@ -209,7 +217,7 @@ function resolveComponentVersions(
)
}

return Array.from(versions)
return Object.fromEntries(versions)
}

/**
Expand Down
2 changes: 0 additions & 2 deletions packages/ui-menu/src/Menu/v2/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ const generateStyle = (
listStyleType: 'none',
margin: '0',
padding: '0.25rem 0',
// TODO-rework
//background: componentTheme.background,
//borderRadius: componentTheme.borderRadius,
display: 'block',
position: 'relative',
Expand Down
4 changes: 4 additions & 0 deletions packages/ui-themes/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import type {
} from './themes/newThemes/commonTypes'
import type { CanvasHighContrastTheme } from './themes/canvasHighContrast'
import type { CanvasTheme, CanvasBrandVariables } from './themes/canvas'
import type { DarkTheme } from './themes/dark'
import type { LightTheme } from './themes/light'
import type {
BaseTheme,
Primitives,
Expand Down Expand Up @@ -99,6 +101,8 @@ export type {
CanvasTheme,
CanvasBrandVariables,
CanvasHighContrastTheme,
DarkTheme,
LightTheme,
Primitives,
AdditionalPrimitives,
DataVisualization,
Expand Down
8 changes: 7 additions & 1 deletion packages/ui/src/v11_7.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,8 @@ export type { TextInputProps } from '@instructure/ui-text-input/v11_7'
export {
canvas,
canvasHighContrast,
dark,
light,
primitives,
additionalPrimitives,
dataVisualization
Expand All @@ -426,7 +428,11 @@ export type {
Primitives,
AdditionalPrimitives,
DataVisualization,
UI
UI,
Dark,
DarkTheme,
Light,
LightTheme
} from '@instructure/ui-themes'
export { TimeSelect } from '@instructure/ui-time-select/v11_7'
export type { TimeSelectProps } from '@instructure/ui-time-select/v11_7'
Expand Down
Loading