diff --git a/.changeset/popular-fireants-boil.md b/.changeset/popular-fireants-boil.md new file mode 100644 index 0000000000..a91ce531e8 --- /dev/null +++ b/.changeset/popular-fireants-boil.md @@ -0,0 +1,6 @@ +--- +"@quri/squiggle-lang": patch +"@quri/squiggle-components": patch +--- + +Adds versionAdded flag for functions, to tag with version information in documentation. diff --git a/packages/components/src/components/ui/FnDocumentation.tsx b/packages/components/src/components/ui/FnDocumentation.tsx index dd9c19ef66..e9fe84f1ac 100644 --- a/packages/components/src/components/ui/FnDocumentation.tsx +++ b/packages/components/src/components/ui/FnDocumentation.tsx @@ -69,6 +69,7 @@ export const FnDocumentation: FC<{ definitions, examples, interactiveExamples, + versionAdded, } = documentation; const textSize = size === "small" ? "text-xs" : "text-sm"; const fullName = `${nameSpace ? nameSpace + "." : ""}${name}`; @@ -102,7 +103,11 @@ export const FnDocumentation: FC<{ )} - {(isUnit || shorthand || isExperimental || !requiresNamespace) && ( + {(isUnit || + shorthand || + isExperimental || + !requiresNamespace || + versionAdded) && (
{isUnit && ( @@ -128,6 +133,11 @@ export const FnDocumentation: FC<{ {`Namespace optional`}
)} + {versionAdded && ( +
+ v{versionAdded} +
+ )}
)} diff --git a/packages/components/src/stories/InternalComponents/FnDocumentation.stories.tsx b/packages/components/src/stories/InternalComponents/FnDocumentation.stories.tsx index 77b3baefbf..d6534568dc 100644 --- a/packages/components/src/stories/InternalComponents/FnDocumentation.stories.tsx +++ b/packages/components/src/stories/InternalComponents/FnDocumentation.stories.tsx @@ -83,6 +83,7 @@ Plot.scatter({ shorthand: { type: "unary", symbol: "-" }, description: `**Lorem Ipsum** More content *here*`, + versionAdded: "0.9.0", }; export const Simple: Story = { diff --git a/packages/squiggle-lang/src/library/registry/core.ts b/packages/squiggle-lang/src/library/registry/core.ts index a7d6377d47..447158f6d7 100644 --- a/packages/squiggle-lang/src/library/registry/core.ts +++ b/packages/squiggle-lang/src/library/registry/core.ts @@ -25,6 +25,7 @@ export type FRFunction = { isUnit?: boolean; shorthand?: Shorthand; displaySection?: string; + versionAdded?: string; }; type FnNameDict = Map; @@ -42,6 +43,7 @@ export type FnDocumentation = Pick< | "isUnit" | "shorthand" | "displaySection" + | "versionAdded" > & { signatures: string[] }; export class Registry {