1434 Commits

Author SHA1 Message Date
Sidharth Vinod
fff3acd064
Verify release-version on push to release or master 2023-07-18 21:55:44 +05:30
Sidharth Vinod
88856a721f
Support MERMAID_RELEASE_VERSION in docs 2023-07-07 11:28:04 +05:30
Sidharth Vinod
bcffff3b7b
Terminate build in CI if download fails 2023-07-06 21:36:10 +05:30
Sidharth Vinod
d4281d365d
Add Yokozuna59 & nirname 2023-07-06 21:29:40 +05:30
Sidharth Vinod
48050333a0
Merge branch 'develop' into sidv/optimiseDocs 2023-07-06 15:57:01 +05:30
Sidharth Vinod
c17dc15c57
chore: Rename to teamMembers 2023-07-06 15:54:27 +05:30
Sidharth Vinod
2b5da79cdf
Merge pull request #4112 from aloisklink/add-jsonschema-schema-for-config
Use JSON Schema to define and document `MermaidConfig`
2023-07-06 10:03:55 +00:00
Sidharth Vinod
aaec16ed6c
chore: Remove lint warnings in example-diagram 2023-07-06 11:58:55 +05:30
Sidharth Vinod
d2e62022f1
Avoid downloading avtars everytime on docs:dev 2023-07-06 11:09:09 +05:30
Sidharth Vinod
29291c8901
Merge branch 'develop' into pr/aloisklink/4112
* develop:
  test: test partial QuadrantChartConfig options
  test: fix types in `config.spec.ts`
  style: fix lint issues in src/config.spec.ts
  test: rename src/config.spec.js to config.spec.ts
  fix lint
  update homepage community link
  docs(flowchart): add documentation on multiple nodes style
  Add docker-specific command, leave commonly used command intact
  Support docs:dev in docker
  Fix lint.
  Update docs
  add ChatGPT plugin blog post
  Fix flowchart tooltip typing
2023-07-06 10:42:13 +05:30
Sidharth Vinod
1a4e5d9c5a
Merge pull request #4562 from lishid/patch-3
Fix flowchart tooltip typing bug
2023-07-06 04:19:08 +00:00
Sidharth Vinod
e80e281a66
Merge pull request #4600 from tomperr/docs/4558-multiple-vertices-with-style
docs(flowchart): add documentation on multiple nodes style
2023-07-06 04:10:43 +00:00
Nikolay Rozhkov
04597d29c0
Merge pull request #4599 from nirname/fix/support-docs-dev-in-docker
Support docs:dev in docker
2023-07-06 04:04:18 +00:00
Sidharth Vinod
43df84a4d5
Merge branch 'master' into develop
* master:
  fix lint
  update homepage community link
  Update docs
  add ChatGPT plugin blog post
2023-07-06 09:34:26 +05:30
Sidharth Vinod
a753b1f18b
Merge branch 'develop' into fix/support-docs-dev-in-docker 2023-07-06 09:29:51 +05:30
Alois Klink
c29088af01 build(docs): fix links to config.schema.json
Fix the link in some Mermaid Config markdown documentation,
which previously pointed to `src/schemas/config.schema.yaml`,
which went nowhere.

Now, these links point to:
  - config.schema.json (i.e. the generated JSON file, not YAML)
  - links are relative to the markdown documentation

We also needed to store the `schema.json` file in the Vitepress
`public/` folder, as Vitepress otherwise doesn't bundle `.json` files
properly, when running `vitepress build src/vitepress`.
2023-07-06 03:53:40 +01:00
Alois Klink
70a5a13273 docs: add link to mermaid config docs in sidebar 2023-07-06 03:53:40 +01:00
Alois Klink
063cb124cd test(config): add temp test for defaultConfig
Adds a temporary test to ensure that the new defaultConfig,
generated by Vite automatically from the `MermaidConfig` JSON Schema,
has the same values as the old defaultConfig
(taken from
38013de711/packages/mermaid/src/defaultConfig.ts)

The only minor difference seems to be that:
  - `gitGraph` now has a default `useMaxWidth: false` option
    (previously used to be `undefined`),
  - `class` now has a `htmlLabels` value of `false` instead of `undefined`.
2023-07-06 03:53:40 +01:00
Alois Klink
eb5d65fabc build(types): create types from config JSON Schema
Runs `pnpm --filter mermaid run types:build-config` to automatically
generate typescript types for `MermaidConfig` from the
JSON Schema file.
2023-07-06 03:53:40 +01:00
Alois Klink
7c3a73d4a8 build(types): add script to generate Config types
Add script `packages/mermaid/scripts/create-types-from-json-schema.mts`
to automatically generate the TypeScript definition for `MermaidConfig`
from the `MermaidConfig` JSON Schema at
`packages/mermaid/src/schemas/config.schema.yaml`.

To do this, we are using this library
[`json-schema-to-typescript`][1], which is also used by Webpack to
generate their types from their JSON Schema.

In order to make sure that this isn't a breaking change, the script
makes all fields **optional**, as that is what the original typescript
file has.

Additionally, I've put in some custom logic into the script, so that
the exact same order is used for the TypeScript file, to make the
`git diff` easier to review. In the future, we can remove this custom
logic, once we no longer need to worry about `git merge` conflicts.

[1]: https://github.com/bcherny/json-schema-to-typescript
2023-07-06 03:53:40 +01:00
Alois Klink
0230722d36 build(docs): build JSON Schema docs
Automatically build documentation for JSON Schema.

This is only built when running with `--vitepress`,
as it currently produces loads of markdown files, which I feel like
we shouldn't be committing.

This currently manually uses some internal `jsonschema2md` functions
so that we can manually control the Markdown output.
2023-07-06 03:53:40 +01:00
Alois Klink
52a1243da5 build: use vite to get default mermaid config
Adds a vitepress JsonSchema plugin that automatically loads
the Mermaid Config JSON Schema from a .schema.yaml file and
gets the default values from it.
2023-07-06 03:53:40 +01:00
Alois Klink
58b43976ff feat: add Mermaid Config in JSON Schema format
Add a JSON Schema file (in YAML) for the MermaidConfig.

This JSON Schema file follows [JSON Schema 2019-09][1], with some slight
modifications to work with:

- [json-schema-to-typescript][2]
  The `tsType` keyword is used to override the generated TypeScript
  type, when it doesn't match the JSON Schema type.

  This is used in two cases:
    - when the current type cannot be represented in JSON Schema
      (e.g. `FontCalculator`, which is a function)
    - when the JSON Schema type is narrower than the TypeScript type.
      Currently, many enums types are listed as `string` in TypeScript,
      but json-schema-to-typescript converts them to `"val1" | "val2"`.
      I've manually set them to `string | "val1" | "val2"` to avoid
      causing a breaking change in the TypeScript types. We should
      remove these in a future major version of TypeScript.
- [@adobe/jsonschema2md][3]
  The `meta:enum` keyword is used to add documentation for specific enum
  values.

[1]: https://json-schema.org/draft/2019-09/release-notes.html
[2]: https://www.npmjs.com/package/json-schema-to-typescript
[3]: https://www.npmjs.com/package/@adobe/jsonschema2md
2023-07-06 03:53:35 +01:00
Alois Klink
4372a54dba docs: add support for ``regexp`` code blocks
Currently, shiki doesn't support code-blocks that use the regexp
language, which means vitepress throws an error on them:

```regexp
^([1-9][0-9]*)(minute|hour|day|week|month)$
```

As a hack until shiki supports them, I've just modified them to get
converted into JavaScript RegEx literal code-blocks, e.g.:

```javascript
/^([1-9][0-9]*)(minute|hour|day|week|month)$/
```
2023-07-06 03:04:08 +01:00
Alois Klink
a862565a24 test: test partial QuadrantChartConfig options 2023-07-06 01:35:11 +01:00
Alois Klink
6ceee7f253 test: fix types in config.spec.ts
The `foo`, `bar`, and `foobar` options don't exist in MermaidConfig.

Instead, I've replaced them with:
  - `foo` -> `fontFamily`
  - `bar` -> `fontSize`
  - `foobar` -> `altfontFamily`
2023-07-06 01:27:24 +01:00
Alois Klink
f731853e01 style: fix lint issues in src/config.spec.ts
It looks like our linter automatically converts `let` to `const` in
TypeScript files, but not in JavaScript files.
2023-07-06 01:20:24 +01:00
Alois Klink
5885f5f82a test: rename src/config.spec.js to config.spec.ts 2023-07-06 01:19:34 +01:00
Alois Klink
38013de711 fix(quadrant): make quadrant options optional
Make the types of the options in QuadrantChartConfig in the
MermaidConfig optional. All of these (except for the values in
`BaseDiagramConfig`) will be automatically set to their
default values, so they're optional from a user perspective.
2023-07-06 01:06:01 +01:00
Steph
9251e520ab fix lint 2023-07-05 13:50:33 -07:00
Steph
5e7e3e21c8 update homepage community link 2023-07-05 13:42:42 -07:00
Tom PERRILLAT-COLLOMB
fcb25aee7c docs(flowchart): add documentation on multiple nodes style 2023-07-05 21:09:44 +02:00
Nikolay Rozhkov
95d62367e9 Add docker-specific command, leave commonly used command intact 2023-07-05 19:39:05 +03:00
Nikolay Rozhkov
34b2b5ba35 Support docs:dev in docker 2023-07-05 17:25:07 +03:00
Nikolay Rozhkov
c742ac71a4
Merge pull request #4598 from mermaid-js/sidv/fixDocsDev
Fix docs:dev
2023-07-05 14:05:27 +00:00
Sidharth Vinod
382026ed33
Fix docs:dev 2023-07-05 12:20:56 +05:30
Nikolay Rozhkov
9f5f0a6e66 Reduce sankey width 2023-07-05 01:49:58 +03:00
Nikolay Rozhkov
8449a44607 Sankey: Remove duplicated examples 2023-07-05 01:15:22 +03:00
Lishid
12fe6ff26e
Fix lint. 2023-07-03 18:56:00 -07:00
Nikolay Rozhkov
d5021cab1d Remove double parsing 2023-07-03 18:57:26 +03:00
Sidharth Vinod
1b190b2892
Merge pull request #4551 from Yokozuna59/refactor-accessibility
refactor accessibility
2023-07-03 15:07:21 +00:00
Sidharth Vinod
6d7cd2b41f
Merge pull request #4580 from aloisklink/refactor/replace-enums
Remove all TypeScript enums and forbid them in ESLint
2023-07-03 07:26:39 +00:00
renovate[bot]
d6731a07db
Update all patch dependencies 2023-07-03 05:18:01 +00:00
Alois Klink
fbf79ffcc0 refactor: replace TypeScript enum with JS obj
[`const` assertions where added in TypeScript 3.4][1] and can be used
to create enum-like objects in plain JavaScript, that act like
TypeScript enums, but has none of the downsides of TypeScript enums.

[1]: https://devblogs.microsoft.com/typescript/announcing-typescript-3-4/#const-assertions
2023-07-02 23:56:42 +01:00
Alois Klink
b989ff5362 fix: change sankey config types to be unions
Replace the TypeScript `enum {a = "a", b = "b"}` types with
TypeScript's literal types (e.g. `"a" | "b"`).

This is because TypeScript enums are
[_not_ a type-level addition to JavaScript][1], and even the official
TypeScript docs say to be careful when using.

[1]: https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#enums
2023-07-02 23:44:19 +01:00
Yokozuna59
406df57f81
Merge branch 'develop' into refactor-accessibility 2023-07-02 10:24:21 +02:00
Sidharth Vinod
dfc466514d
Merge branch 'develop' into feature/1838_actor_creation_destruction 2023-07-02 13:36:04 +05:30
Sidharth Vinod
2a1759aab4
Merge branch 'develop' into refactor-accessibility 2023-07-02 13:04:09 +05:30
renovate[bot]
b55a9328f4
Update all patch dependencies 2023-07-02 05:07:56 +00:00
Sidharth Vinod
19325777e5
Merge branch 'develop' into feature/1838_actor_creation_destruction 2023-07-02 10:32:59 +05:30