Skip to content

Commit

Permalink
docs: generate api files from typedoc
Browse files Browse the repository at this point in the history
  • Loading branch information
chloe-renaud committed Dec 12, 2024
1 parent 3a874f9 commit 9c03aae
Show file tree
Hide file tree
Showing 70 changed files with 3,307 additions and 1,560 deletions.
137 changes: 0 additions & 137 deletions docs/docusaurus.config.ts

This file was deleted.

106 changes: 0 additions & 106 deletions docs/sidebars.ts

This file was deleted.

9 changes: 0 additions & 9 deletions docs/src/css/custom.css

This file was deleted.

2 changes: 1 addition & 1 deletion lunatic-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://insee.fr/lunatic/survey.schema.json",
"title": "Lunatic Source",
"description": "A lunatic survey unit",
"description": "Representation of a Lunatic survey unit in the Lunatic Model.",
"type": "object",
"properties": {
"label": {
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"test-watch": "vitest",
"build:types": "node ./tools/schema-ts-generator.js && prettier src/type.source.ts --write",
"check": "tsc --noEmit",
"docs": "typedoc",
"lint:check": "eslint ./src",
"_format": "prettier **/*.{ts,tsx,json,scss}",
"format": "npm run _format -- --write",
Expand Down Expand Up @@ -122,6 +123,8 @@
"react-dom": "^18.3.1",
"storybook": "^8.2.9",
"tsx": "^4.19.1",
"typedoc": "^0.27.3",
"typedoc-plugin-markdown": "^4.3.1",
"typescript": "^5.4.5",
"typescript-eslint": "^8.11.0",
"vite": "^5.4.0",
Expand Down
18 changes: 10 additions & 8 deletions src/components/LunaticComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ import {
import type { LunaticComponentProps } from './type';

type Props<V = unknown> = {
// List of components to display (coming from getComponents)
/** List of components to display (coming from getComponents). */
components: LunaticComponentProps[];
// Should we memoized children
/** Should we memoized children. */
memo?: boolean;
// Key that trigger autofocus when it changes (pageTag)
/** Key that trigger autofocus when it changes (pageTag). */
autoFocusKey?: string;
// Returns the list of extra props to add to components
/** Returns the list of extra props to add to components. */
componentProps?: (component: LunaticComponentProps) => V;
// Forbidden components
/** Forbidden components. */
blocklist?: string[];
// Add additional wrapper around each component
/** Add additional wrapper around each component. */
wrapper?: (
props: PropsWithChildren<LunaticComponentProps & V & { index: number }>
) => ReactNode;
// Customized deep components
/** Customized deep components. */
slots?: Partial<LunaticSlotComponents>;
};

Expand All @@ -45,7 +45,9 @@ const LunaticComponentWrapper = slottableComponent(
);

/**
* Entry point for orchestrators, this component display the list of fields
* Entry point for orchestrators, this component display the list of fields.
*
* Components offered by Lunatic can be seen at {@link https://github.com/InseeFr/Lunatic/tree/3.0/src/components}
*/
export function LunaticComponents<V = unknown>({
components,
Expand Down
6 changes: 3 additions & 3 deletions src/components/shared/HOC/slottableComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import type { MarkdownLink } from '../MDLabel/MarkdownLink';
import type { Accordion } from '../../Accordion/Accordion';

/**
* Contains the type of every customizable component
* Contain the type of every customizable components.
*/
export type LunaticSlotComponents = {
// Components
Expand Down Expand Up @@ -130,9 +130,9 @@ export const SlotsProvider = ({
};

/**
* Create a replaceable version of a component
* Create a replaceable version of a component.
*
* The component can be replaced using the "slots" props on <LunaticComponents>
* The component can be replaced through the `slots` props on `LunaticComponents`.
*/
export function slottableComponent<T>(
name: keyof LunaticSlotComponents,
Expand Down
7 changes: 4 additions & 3 deletions src/use-lunatic/commons/compile-controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ const isLoopComponent = (
};

/**
* Check if components of the current page have errors, and return a map of error (indexed by component ID)
* Check if components of the current page have errors, and return a map of
* errors (indexed by component ID).
*/
function checkComponents(
state: StateForControls,
Expand Down Expand Up @@ -93,7 +94,7 @@ function checkControls(
}

/**
* Figure out the number of iterations of a component
* Figure out the number of iterations of a component.
*/
function computeIterations(
component: InterpretedComponent | ComponentDefinition,
Expand Down Expand Up @@ -210,7 +211,7 @@ function hasCriticalError(errors?: Record<string, LunaticError[]>): boolean {
}

/**
* Check controls for currently visible components and output errors
* Check controls for currently visible components and output errors.
*/
export function compileControls(state: StateForControls) {
const components = replaceComponentSequence(getComponentsFromState(state));
Expand Down
Loading

0 comments on commit 9c03aae

Please sign in to comment.