-
Notifications
You must be signed in to change notification settings - Fork 2
IS-11008 HAAPI React SDK documentation #226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 14 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
4a39c62
IS-11008 Restructure HAAPI React SDK README; fix HaapiStepper JSDoc s…
aleixsuau bd9de0e
IS-11008: improve docs
aleixsuau 98cbedd
IS-11008 Refine HAAPI React SDK docs and fix JSDoc editor previews
aleixsuau 470d5d4
IS-11008: fix type references
aleixsuau 9316540
IS-11008: improve form tests references
aleixsuau d431948
IS-11008 Sharpen customization docs (interceptors vs UI composition)
aleixsuau feb9aba
IS-11008: form field docs and improvements
aleixsuau 296eef3
IS-11008 Document workspace-root install in haapi-react-app README
aleixsuau ddb3c35
IS-11008 Rewrite SDK README and TSDoc for the docs site
aleixsuau bfe3556
IS-11008 Add HAAPI React SDK docs site (Docusaurus + generation)
aleixsuau d91ec77
IS-11008 Add docs examples and single-source step catalog
aleixsuau 996cd53
IS-11008 Register docs workspace and StackBlitz preview
aleixsuau 01d674f
IS-11008 Format docs sources with Prettier; add docs-workspace pretti…
aleixsuau 5c31f96
IS-11008 Scope SDK CI steps to the SDK workspace; stop linting docs
aleixsuau b797445
IS-11008 Build ui-kit icons + css libs before generating docs
aleixsuau 7a6a6e8
IS-11008 Remove StackBlitz links and config
aleixsuau 3c3126c
Merge remote-tracking branch 'origin/dev' into feature/IS-11008/haapi…
aleixsuau d02d5c2
IS-11008 Land docs on the overview and link to the online docs from t…
aleixsuau 124ed7f
IS-11008: remove haapi-react-app from the uikit npm start command
aleixsuau b829e83
IS-11008: curity logo, favicon and styles in docs
aleixsuau a84b0e2
IS-11008: add previewer to the overview page
aleixsuau ee05874
IS-11008: add sdk docs link in the uikit overview page
aleixsuau 67b458a
IS-11008: prevent haapi-react-app from opening on uikit main page start
aleixsuau e2d7628
IS-11008: remove curity-cli command from docs
aleixsuau 4c6bcd3
IS-11008: improve docs npm command
aleixsuau 3442124
IS-11008: simplify folder structure and gitignore
aleixsuau eac93d6
IS-11008 Move SDK README to package root; brand docs links; fix entri…
aleixsuau 1d8de84
IS-11008 Centralize docs generator paths in scripts/paths.mjs.
aleixsuau 1db1a99
IS-11008: add typecheck, prettier and build to the ci workflow
aleixsuau dbc35a0
IS-11008: add previewer note to haapi-react-app readme
aleixsuau File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "installDependencies": false, | ||
| "startCommand": "npm install --engine-strict=false --no-audit --no-fund && cd src/haapi-react-sdk/docs && npm run docs -- --host 0.0.0.0 --no-open" | ||
| } |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| .prettierrc | ||
| tsconfig.* | ||
| README.md | ||
|
|
||
| # The docs are their own workspace with its own prettier-check (run via `-w src/haapi-react-sdk`). | ||
| docs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Dependencies | ||
| /node_modules | ||
|
|
||
| # Docusaurus build output | ||
| /build | ||
| /.docusaurus | ||
|
|
||
| # Generated by scripts/build-sandpack-sdk.mjs (npm run docs:gen) | ||
| /src/generated/ | ||
| /docs/_overview.mdx | ||
|
|
||
| # Generated by scripts/split-docs.mjs (npm run docs:split): one short page per `##` section | ||
| /docs/overview/ | ||
|
|
||
| # Generated by scripts/emit-api-reference.mjs (npm run docs:apiref) from api-reference.entries.mjs | ||
| /docs/api-reference/ | ||
|
|
||
| # Generated by scripts/emit-examples.mjs (npm run docs:examples) from examples.entries.mjs | ||
| /docs/examples/ | ||
|
aleixsuau marked this conversation as resolved.
Outdated
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # Tooling / config | ||
| .prettierrc | ||
| tsconfig.* | ||
| README.md | ||
|
|
||
| # Dependencies & build output | ||
| node_modules | ||
| build | ||
| .docusaurus | ||
|
|
||
| # Generated by the docs:gen / docs:split / docs:apiref / docs:examples scripts (see .gitignore) | ||
| src/generated | ||
| docs/_overview.mdx | ||
| docs/overview | ||
| docs/api-reference | ||
| docs/examples | ||
|
aleixsuau marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # HAAPI React SDK docs | ||
|
|
||
| Docusaurus site for the HAAPI React SDK. Most content is **generated** from the SDK source, so you rarely | ||
| edit pages by hand — you edit the SDK (README + TSDoc) and the example files, and the build assembles the site. | ||
|
|
||
| ## Run it | ||
|
|
||
| ```bash | ||
| npm run docs # dev server on http://localhost:3220 | ||
| npm run docs:build # production build (fails on broken links) | ||
| ``` | ||
|
|
||
| Both run the generators first (`predocs`): `docs:gen → docs:split → docs:apiref → docs:examples`. | ||
|
|
||
| ## Where content comes from | ||
|
|
||
| | Sidebar section | Source | How | | ||
| |---|---|---| | ||
| | **Overview** | SDK `README.md` | `docs:gen` → `_overview.mdx`, `docs:split` → one page per `##` | | ||
| | **API Reference** | component **TSDoc** | `docs:apiref` extracts the TSDoc (`scripts/extract-tsdoc.mjs`) and emits a Markdown page per entry in `api-reference.entries.mjs` | | ||
| | **Examples** | `examples/*.tsx` | `docs:examples` emits a playground page per entry in `examples.entries.mjs` | | ||
|
|
||
| Generated folders (`docs/_overview.mdx`, `docs/overview/`, `docs/api-reference/`, `docs/examples/`) are | ||
| **gitignored** — don't edit them; change the source instead. | ||
|
aleixsuau marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## Examples = live playgrounds | ||
|
|
||
| An example is a self-contained `examples/<Name>.tsx` (default `App`, wrapped in `<ExamplePreviewer>`). | ||
| `docs:gen` bundles every example into `examples.json` (keyed by basename). You reference it by **name** | ||
| (its filename, no `.tsx`) in one of two ways — both get rewritten, at generation time, into the same | ||
| `<DocExample id="<Name>" />` runtime tag, which looks the source up in `examples.json` by that `id`: | ||
|
|
||
| - **A markdown link to the file** — `[label](…/examples/<Name>.tsx)`, in the SDK `README.md` (→ Overview). | ||
| It stays a clickable link on GitHub; the build derives `<Name>` from the link and converts it to a | ||
| playground (`build-sandpack-sdk.mjs`). | ||
| - **A `{@see_example docs/examples/<Name>.tsx Label}` marker** — inside a component's TSDoc, so the | ||
| playground renders inline on its API Reference page (`emit-api-reference.mjs`). | ||
|
|
||
| (The Examples section pages are emitted from `examples.entries.mjs`. You don't hand-write `<DocExample>` — | ||
| it's the generated tag underlying all of these.) Each mounts the example in Sandpack against the **mocked** | ||
| HAAPI driver (no backend) using the shared closure in `src/sandpack/closure.ts`. | ||
|
|
||
| ``` | ||
| examples/<Name>.tsx ──(docs:gen)──▶ examples.json[<Name>] | ||
| │ | ||
| ├─ [label](…/examples/<Name>.tsx) (README markdown) ─┐ | ||
| ├─ {@see_example …<Name>.tsx Label} (component TSDoc) ─┤─(generate)─▶ <DocExample id="<Name>"/> | ||
| └─ entry in examples.entries.mjs (Examples section) ─┘ │ | ||
| ▼ ▼ | ||
| examples.json[<Name>] ──▶ SandpackPlayer( SDK + mocked driver + <Name>.tsx ) ──▶ live playground | ||
| ``` | ||
|
|
||
| ## Add an example | ||
|
|
||
| 1. Create `examples/MyExample.tsx` — a default `App`, wrapped in `<ExamplePreviewer>`. | ||
| 2. Surface it by **name**: a markdown link `[label](…/examples/MyExample.tsx)` in the README, **or** an | ||
| entry in `examples.entries.mjs` (Examples section), **or** a `{@see_example …MyExample.tsx Label}` | ||
| marker in a component's TSDoc. | ||
| 3. `npm run docs` — it's picked up automatically; no registry edit needed for `examples.json`. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| /* | ||
| * Copyright (C) 2026 Curity AB. All rights reserved. | ||
| * | ||
| * The contents of this file are the property of Curity AB. | ||
| * You may not copy or use this file, in either source code | ||
| * or executable form, except in compliance with terms | ||
| * set by Curity AB. | ||
| * | ||
| * For further information, please contact Curity AB. | ||
| */ | ||
|
|
||
| /* | ||
| * Single source of truth for the API Reference docs layout. Each leaf entry maps an SDK export | ||
| * (`{ id, file, export }`) to a sidebar label; the grouping describes the nested sidebar tree. | ||
| * | ||
| * `scripts/emit-api-reference.mjs` walks the tree to generate `docs/api-reference/**`: it extracts each | ||
| * export's TSDoc (via `scripts/extract-tsdoc.mjs`) into a Markdown page, plus a `_category_.json` per | ||
| * (sub)category, ordered by declaration order here. | ||
| * | ||
| * Add or reorder API Reference pages here only — the generator follows automatically. | ||
| */ | ||
|
|
||
| /** | ||
| * The API Reference structure: an ordered list of top-level items, where an item is either a leaf | ||
| * entry (`{ id, file, export, label }`) or a group (`{ group, label, items }`) that nests further. | ||
| * @typedef {{ id: string, file: string, export: string, label: string }} ApiReferenceEntry | ||
| * @typedef {{ group: string, label: string, items: ApiReferenceItem[] }} ApiReferenceGroup | ||
| * @typedef {ApiReferenceEntry | ApiReferenceGroup} ApiReferenceItem | ||
| * @type {ApiReferenceItem[]} | ||
| */ | ||
| export const apiReferenceStructure = [ | ||
| { | ||
| id: 'stepper', | ||
| file: 'haapi-stepper/feature/stepper/HaapiStepper.tsx', | ||
| export: 'HaapiStepper', | ||
| label: 'HaapiStepper', | ||
| }, | ||
| { | ||
| id: 'use-haapi-stepper', | ||
| file: 'haapi-stepper/feature/stepper/HaapiStepperHook.ts', | ||
| export: 'useHaapiStepper', | ||
| label: 'useHaapiStepper', | ||
| }, | ||
| { | ||
| id: 'step-ui', | ||
| file: 'haapi-stepper/feature/steps/HaapiStepperStepUI.tsx', | ||
| export: 'HaapiStepperStepUI', | ||
| label: 'HaapiStepperStepUI', | ||
| }, | ||
| { | ||
| group: 'ui-components', | ||
| label: 'UI Components', | ||
| items: [ | ||
| { | ||
| id: 'ui-components-overview', | ||
| file: 'haapi-stepper/ui/index.ts', | ||
| export: 'HaapiStepperUiComponents', | ||
| label: 'Overview', | ||
| }, | ||
| { | ||
| // A documented component that also nests its parts: the form-field components are children of | ||
| // HaapiStepperFormUI (its `index.mdx`). | ||
| group: 'form-ui', | ||
| label: 'HaapiStepperFormUI', | ||
| id: 'form-ui', | ||
| file: 'haapi-stepper/feature/actions/form/HaapiStepperFormUI.tsx', | ||
| export: 'HaapiStepperFormUI', | ||
| items: [ | ||
| { | ||
| id: 'form-field-ui', | ||
| file: 'haapi-stepper/feature/actions/form/fields/HaapiStepperFormFieldUI.tsx', | ||
| export: 'HaapiStepperFormFieldUI', | ||
| label: 'HaapiStepperFormFieldUI', | ||
| }, | ||
| { | ||
| id: 'text-form-field-ui', | ||
| file: 'haapi-stepper/feature/actions/form/fields/HaapiStepperTextFormFieldUI.tsx', | ||
| export: 'HaapiStepperTextFormFieldUI', | ||
| label: 'HaapiStepperTextFormFieldUI', | ||
| }, | ||
| { | ||
| id: 'password-form-field-ui', | ||
| file: 'haapi-stepper/feature/actions/form/fields/HaapiStepperPasswordFormFieldUI.tsx', | ||
| export: 'HaapiStepperPasswordFormFieldUI', | ||
| label: 'HaapiStepperPasswordFormFieldUI', | ||
| }, | ||
| { | ||
| id: 'select-form-field-ui', | ||
| file: 'haapi-stepper/feature/actions/form/fields/HaapiStepperSelectFormFieldUI.tsx', | ||
| export: 'HaapiStepperSelectFormFieldUI', | ||
| label: 'HaapiStepperSelectFormFieldUI', | ||
| }, | ||
| { | ||
| id: 'checkbox-form-field-ui', | ||
| file: 'haapi-stepper/feature/actions/form/fields/HaapiStepperCheckboxFormFieldUI.tsx', | ||
| export: 'HaapiStepperCheckboxFormFieldUI', | ||
| label: 'HaapiStepperCheckboxFormFieldUI', | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| id: 'selector-ui', | ||
| file: 'haapi-stepper/feature/actions/selector/HaapiStepperSelectorUI.tsx', | ||
| export: 'HaapiStepperSelectorUI', | ||
| label: 'HaapiStepperSelectorUI', | ||
| }, | ||
| { | ||
| id: 'client-operation-ui', | ||
| file: 'haapi-stepper/feature/actions/client-operation/HaapiStepperClientOperationUI.tsx', | ||
| export: 'HaapiStepperClientOperationUI', | ||
| label: 'HaapiStepperClientOperationUI', | ||
| }, | ||
| { | ||
| id: 'links-ui', | ||
| file: 'haapi-stepper/ui/links/HaapiStepperLinksUI.tsx', | ||
| export: 'HaapiStepperLinksUI', | ||
| label: 'HaapiStepperLinksUI', | ||
| }, | ||
| { | ||
| id: 'messages-ui', | ||
| file: 'haapi-stepper/ui/messages/HaapiStepperMessagesUI.tsx', | ||
| export: 'HaapiStepperMessagesUI', | ||
| label: 'HaapiStepperMessagesUI', | ||
| }, | ||
| { | ||
| id: 'error-notifier-ui', | ||
| file: 'haapi-stepper/feature/stepper/HaapiStepperErrorNotifier.tsx', | ||
| export: 'HaapiStepperErrorNotifier', | ||
| label: 'HaapiStepperErrorNotifier', | ||
| }, | ||
| { | ||
| id: 'validation-error-wrapper-ui', | ||
| file: 'haapi-stepper/feature/actions/form/HaapiStepperFormValidationErrorInputWrapper.tsx', | ||
| export: 'HaapiStepperFormValidationErrorInputWrapper', | ||
| label: 'HaapiStepperFormValidationErrorInputWrapper', | ||
| }, | ||
| ], | ||
| }, | ||
| ]; | ||
|
|
||
| /** Whether an item is a group (has nested `items`) rather than a leaf entry. */ | ||
| export const isApiReferenceGroup = item => Array.isArray(item?.items); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.