diff --git a/packages/preview/merman/0.4.0/LICENSE b/packages/preview/merman/0.4.0/LICENSE new file mode 100644 index 0000000000..d3d00d0917 --- /dev/null +++ b/packages/preview/merman/0.4.0/LICENSE @@ -0,0 +1,231 @@ +This package is dual-licensed under either of: + +- Apache License, Version 2.0 +- MIT License + +Full license texts follow. + +MIT License + +Copyright (c) 2026 merman contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/packages/preview/merman/0.4.0/README.md b/packages/preview/merman/0.4.0/README.md new file mode 100644 index 0000000000..9471ffc335 --- /dev/null +++ b/packages/preview/merman/0.4.0/README.md @@ -0,0 +1,432 @@ +# merman + +Render Mermaid diagrams in Typst with the `merman` Rust renderer. + +`merman` embeds a WebAssembly plugin so Typst documents can render Mermaid diagrams directly during compilation while reusing the parser, layout, and SVG renderer from the broader `merman` project. This README documents Typst package `0.4.0`, bundling Merman `0.8.0`. It requires Typst `0.15.0` or newer. + +## Quick Start + +After `0.4.0` is available on Typst Universe, import it with: + +```typst +#import "@preview/merman:0.4.0": mermaid +``` + +Before publication, build the package from this repository and pass its parent package root with +`typst compile --package-path document.typ`; the import remains: + +```typst +#import "@preview/merman:0.4.0": mermaid + +#mermaid(" +flowchart TD + A[Write Mermaid] --> B[Render with merman] + B --> C[Embed SVG in Typst] +") +``` + +Upgrading from `0.3.0`? Mermaid 12 changed the default layout of flowcharts and several other graph families to ELK. To keep Dagre, see [Choose a Layout](#choose-a-layout); no custom plugin build is needed. + +## Version Mapping + +| Typst package | merman source version | Typst plugin ABI | Notes | +| --- | --- | --- | --- | +| `0.4.0` | `0.8.0` | `2` | Mermaid 12.1 rendering; requires Typst `0.15.0` or newer. | +| `0.3.0` | `0.8.0-alpha.6` | `2` | Previous size-optimized WASM package. | +| `0.2.0` | Previously published source revision | `2` | Published registry channel; do not infer alpha.6 source provenance from this version. | +| `0.1.0` | `0.8.0-alpha.1` | `1` | Previous package API. | + +The Typst package version tracks the `@preview/merman` wrapper API. The merman source version is the Rust workspace version used to build the package. The Typst plugin ABI tracks the WebAssembly export names and byte payload contracts; wrapper-only API breaks do not require an ABI bump when that plugin surface stays stable. Render option JSON follows shared binding options schema `2`, including `presentation` for first-party profiles and host themes, `layout` for geometry, and `environment` for text measurement and math rendering. This options schema is independent from Typst plugin ABI 2 and native ABI 3. + +The API and example sections below describe the `0.4.0` package. + +## Upgrading from 0.3.0 + +- The bundled renderer moves from Merman `0.8.0-alpha.6` to stable `0.8.0`, targeting Mermaid `12.1.0`. Agentflow and Usecase join the supported diagram families. +- Mermaid 12.0 changed layout and appearance defaults, and this package targets Mermaid 12.1. Flowchart, State, Class, ER, Requirement, Usecase, and Agentflow default to ELK; supported families adopt Redux/Neo presentation. Review existing diagrams for changed geometry, colors, and spacing. To request Dagre with the earlier theme and look, use `site-config: (layout: "dagre", theme: "default", look: "classic")`; this does not promise identical historical output. +- Replace family-local `defaultRenderer` settings with top-level `layout`. The Typst diagnostic analysis payload remains at schema `1`; analysis facts elsewhere in Merman use schema `2`. The operation result envelope, binding options schema, and Typst plugin ABI have separate versions. +- Embedded images still default to `resvg-safe`. Mathematical labels remain unsupported: this package does not include the `math` feature. `math-renderer: "ratex"` reports a missing capability. + +The wrapper entry points remain unchanged. Layout uses deterministic Unicode-aware text measurement; it does not measure Typst's actual glyphs. See the [Merman 0.8.0 upgrade guide](https://github.com/Latias94/merman/blob/v0.8.0/docs/release/V070_TO_V080_UPGRADE_GUIDE.md) for renderer details. + +## Examples + +- [basic.typ](examples/basic.typ): minimal `#mermaid(...)` usage. +- [dagre.typ](examples/dagre.typ): use Dagre for individual diagrams and Mermaid raw blocks through a shared profile. +- [document-context.typ](examples/document-context.typ): opt-in document typography and width bridging. +- [elk.typ](examples/elk.typ): Mermaid's `layout: elk` frontmatter and the bundled ELK backend. +- [profile.typ](examples/profile.typ): reusable renderer settings shared by direct calls and raw blocks. +- [figure.typ](examples/figure.typ): Mermaid diagrams wrapped as Typst figures with reusable layout defaults. +- [raw-block.typ](examples/raw-block.typ): document-wide Mermaid fences with `show-mermaid-blocks`. +- [options.typ](examples/options.typ): themes, stable IDs, `mermaid-result`, SVG export, and placeholder errors. +- [print.typ](examples/print.typ): print-friendly white-background output. +- [presentation.typ](examples/presentation.typ): dark slide-sized output. +- [svg-export.typ](examples/svg-export.typ): raw SVG and structured render payloads. + +Package fixtures are grouped by behavior family under `distribution/typst/merman/tests` in the Merman source repository. They cover API, render environments, context, errors, figures, raw blocks, README examples, historical issues, and visual smoke coverage; test fixtures are not included in the published Typst package. + +## Choose a Layout + +The `0.4.0` package includes both Dagre and ELK. Mermaid 12.0 made ELK the default for Flowchart, State, Class, ER, Requirement, Usecase, and Agentflow when ELK is available; other diagram families keep their own layout behavior. `flowchart LR` sets the direction, not the layout algorithm. + +To use Dagre for one diagram, pass Mermaid site configuration. This does not require rebuilding the plugin: + +```typst +#mermaid( + "flowchart LR\n Source --> Layout\n Layout --> SVG", + site-config: (layout: "dagre"), +) +``` + +To use Dagre throughout a document, reuse a profile for direct calls and Mermaid raw blocks: + +```typst +#import "@preview/merman:0.4.0": mermaid, mermaid-profile, show-mermaid-blocks + +#let dagre = mermaid-profile(site-config: (layout: "dagre")) +#show raw.where(lang: "mermaid"): show-mermaid-blocks(profile: dagre) + +#mermaid("flowchart LR\n Source --> Layout", profile: dagre) +``` + +If a call also passes `site-config`, that dictionary replaces the profile's entire `site-config`; include `layout: "dagre"` in the direct dictionary to keep Dagre. + +To also request the earlier appearance, add `theme: "default", look: "classic"` to the `site-config` dictionary. This does not guarantee pixel-identical output. To select ELK explicitly for one diagram, use Mermaid frontmatter: + +```typst +#mermaid("---\nconfig:\n layout: elk\n---\nflowchart LR\n Source --> Layout\n Layout --> SVG\n") +``` + +Use `site-config: (layout: "dagre")` to choose the Mermaid layout algorithm. The wrapper's top-level `layout:` parameter is a different setting for container geometry (such as `container_width`); it does not select Dagre or ELK. Choosing Dagre at runtime does not remove ELK from the bundled WASM. + +ELK is an embedded, modified Rust translation of Eclipse ELK. The wrapper and Merman-authored code remain under `MIT OR Apache-2.0`; the ELK-derived portion is under `EPL-2.0`. This is a component-level license boundary, not a relicensing of the whole package. When redistributing the package or a derivative artifact, preserve `THIRD_PARTY_NOTICES.md` and the matching files under `THIRD_PARTY_LICENSES/`. + +## Document Fonts + +`mermaid(...)` is explicit-only by default. It does not automatically inherit the surrounding Typst font, text size, or container width. + +Pass `document-context: true` to content-rendering APIs when you want opt-in document context bridging. This forwards the current Typst text font, text size, and available width as renderer options unless you override them directly. + +```typst +#mermaid(source, document-context: true, width: 100%) + +#show raw.where(lang: "mermaid"): show-mermaid-blocks( + document-context: true, + width: 100%, +) +``` + +You can also pass typography intent explicitly: + +```typst +#mermaid( + source, + typography: ( + font: ("Source Sans 3", "Arial", "sans-serif"), + size: "16px", + ), +) +``` + +The typography size accepts CSS `px` strings, absolute Typst lengths, or numeric CSS pixels. Typst lengths are converted through the SVG 96-DPI coordinate system (`72pt == 96px`) so layout measurement and CSS presentation use the same pixel value. Typst font descriptors are projected to their ordered family names; descriptor `covers` constraints have no CSS or deterministic-measurer equivalent and are therefore not preserved. + +This changes the SVG style intent sent to the headless renderer. It does not mean the Typst plugin measured the exact Typst font file. The plugin has no synchronous font-measurement host import and therefore advertises and uses only the built-in `deterministic` provider. Browser-style host callbacks and Typst font-asset measurement are not available through this transport. + +Check the compiled plugin capability surface with: + +```typst +#let capabilities = merman-capabilities() +#capabilities.capabilities.text_measurement +``` + +## Profiles + +Use `mermaid-profile(...)` for reusable diagram settings: + +```typst +#let diagrams = mermaid-profile( + typography: ( + font: ("Source Sans 3", "Arial", "sans-serif"), + size: "16px", + ), + background: "#ffffff", + theme-name: "base", + figure: ( + placement: bottom, + scope: "parent", + caption-position: top, + gap: 1em, + outlined: false, + ), +) + +#mermaid(source, profile: diagrams, width: 100%) +#mermaid-figure(source, profile: diagrams, caption: [System flow], width: 100%) +``` + +Profiles work with `mermaid(...)`, `mermaid-figure(...)`, `mermaid-svg(...)`, `mermaid-result(...)`, `analyze-mermaid(...)`, and raw-block show rules. The optional `figure` section is consumed only by `mermaid-figure(...)`; it does not change raw SVG rendering or non-figure image calls. + +For normal documents, start with `width`, `theme-name`, `theme`, `background`, `typography`, `document-context`, and reusable `profile` values. Lower-level renderer fields remain available when you need parity debugging or deterministic fixture control, but they are not the main authoring path. + +`base-theme` is a lower-priority compatibility alias for `theme-name`; prefer `theme-name` in new documents. When both are supplied, `theme-name` wins. + +Raw `options` always wins. Without it, precedence is field-specific and deterministic: + +- site config: profile full object, profile theme shorthands, direct full object, direct theme shorthands; +- environment: profile full object, profile measurement/math shorthands, direct full object, direct measurement/math shorthands; +- host theme: document context, profile typography, profile host theme, direct typography, direct host theme; +- layout: profile layout followed by container shorthands, unless a direct full `layout` object is present, in which case that object replaces the layout shorthands; +- scalar fields: direct value, profile value, package or renderer default. + +Theme shorthands replace the `theme` or `themeVariables` field at their layer; they do not deep-merge individual theme-variable keys. + +A direct `site-config` object replaces the profile `site-config` object; use the direct `theme-name` and `theme` shorthands when you want the documented theme-layer precedence instead of replacing the full object. + +A profile that contains raw `options` is an opaque binding-options bundle: it bypasses the profile and call-site shorthands. Pass a direct raw `options` dictionary to replace that bundle, or use the structured profile fields when you want field-level overrides. + +## Raw Blocks + +Use `show-mermaid-blocks` with Typst's `raw.where` selector: + +````typst +#import "@preview/merman:0.4.0": show-mermaid-blocks + +#show raw.where(lang: "mermaid"): show-mermaid-blocks(width: 100%) + +```mermaid +flowchart LR + Source --> Typst + Typst --> SVG +``` +```` + +Raw-block show rules default to `error-mode: "placeholder"`, so one invalid fence stays visible as a marked block instead of aborting the whole document. Pass `error-mode: "panic"` when a document-wide rule must fail the compile on the first render error. + +Avoid setting a fixed `id` in a document-wide raw-block show rule unless the document has only one Mermaid block; otherwise multiple diagrams will share the same SVG id. + +For document-context-aware rendering, pass `document-context: true`. This reads the current Typst text font, text size, and container width inside `context`, then forwards them to the renderer. + +```typst +#import "@preview/merman:0.4.0": show-mermaid-blocks + +#show raw.where(lang: "mermaid"): show-mermaid-blocks( + document-context: true, + width: 100%, +) +``` + +## API Migration + +This refactor intentionally removes compatibility-only context wrappers: + +```typst +// Old: +#mermaid-context(source, width: 100%) +#show raw.where(lang: "mermaid"): show-mermaid-blocks-context(width: 100%) + +// New: +#mermaid(source, document-context: true, width: 100%) +#show raw.where(lang: "mermaid"): show-mermaid-blocks( + document-context: true, + width: 100%, +) +``` + +`context` is a Typst keyword, so the public parameter is named `document-context`. + +Measurement and math selection use the binding options schema `2` render environment: + +```typst +#mermaid(source, text-measurement: "deterministic", math-renderer: "none") +#mermaid( + source, + environment: ( + text_measurement: "deterministic", + math_renderer: "none", + ), +) +``` + +The removed layout fields are rejected; they are not translated through a compatibility path. + +## API + +### `mermaid(source, ..)` + +Renders a Mermaid string or raw block as an SVG image. + +Common parameters: + +- `width`, `height`, `fit`, `alt`: forwarded to Typst's `image`. +- `scale`: wraps the rendered image with Typst `scale`; accepts ratios such as `120%` or numbers such as `1.2`. +- `document-context`: `false` by default. Set to `true` to inherit Typst text font, text size, and finite available width for image rendering. An auto-width page reports an infinite outer width, so Merman keeps its renderer default instead of serializing infinity. +- `profile`: reusable options produced by `mermaid-profile(...)`. +- `typography`: high-level font and size intent, merged into the Typst host theme and projected to `presentation.theme`. +- `presentation-profile`: first-party Merman presentation profile ID, such as `"merman-modern"`. This is independent from Mermaid themes and SVG output policy. +- `id`: stable SVG root id. `diagram-id` is the lower-level binding name; direct values override profile values, and `diagram-id` overrides `id` at the same call layer. +- `background`: SVG root background color, mapped to `svg.root_background_color`. +- `theme-name`: Mermaid theme name, such as `"base"` or `"dark"`. +- `theme`: Mermaid `themeVariables`. +- `error-mode`: `"panic"` by default. Use `"placeholder"` or `"text"` to show diagram errors in the document instead of failing the Typst compile. These modes handle structured errors returned by `merman`; missing wasm files, Typst plugin loading failures, invalid `error-mode` values, and SVG image decoding failures still fail the Typst compile. + +This entry point is explicit-only unless `document-context: true` is set. + +Advanced renderer parameters: + +- `pipeline`: `"resvg-safe"` by default for embedded Typst images. Use `"parity"` when you need Mermaid-like SVG DOM output, or `"readable"` for inline SVG inspection. +- `site-config`: full Mermaid site config object. +- `host-theme`: lower-level, already-normalized values projected to `presentation.theme`. Use stable semantic role IDs such as `"actor-background"`; this is independent from `theme-name`/`theme`, which configure Mermaid itself. +- `layout`: full binding layout object for container geometry. This overrides the container shorthands. +- `container-width`, `container-height`: shorthands for `layout.container_width` and `layout.container_height`. +- `environment`: full binding render-environment object. Use `text_measurement` and `math_renderer` fields when composing options directly. +- `text-measurement`, `math-renderer`: shorthands for `environment.text_measurement` and `environment.math_renderer`. Direct values override `environment`, which overrides profile environment values. +- `scoped-css`, `css-override-policy`, `drop-native-duplicate-fallbacks`: SVG post-processing shorthands. + The package keeps `scoped-css` unopinionated by default: Merman resolves fallback typography + from the original SVG/XHTML context before removing `foreignObject`, so ClassDiagram labels do + not need a hidden global 16px override. If a document deliberately wants a host-specific paint + policy, pass an explicit `scoped-css` string. Selectors matching the original SVG/XHTML context + can affect fallback measurement; selectors matching the generated + `.merman-foreignobject-fallback-text` marker are post-fallback paint hooks and cannot recompute + wrapping or placement. CSS injected after fallback can therefore change painted font metrics but + must not be treated as a new measurement pass. +- `fixed-today`, `fixed-local-offset-minutes`: deterministic date controls for date-sensitive diagrams. +- `options`: escape hatch; when present, it supplies the Rust binding options and overrides shorthand parameters. The plugin reserves the constrained `resources` ceiling; documents may provide stricter limits, while looser profiles or overrides return a structured options error. + +Use `typography` for Typst-facing font intent: it accepts Typst font descriptors, absolute Typst lengths, and numeric or string CSS pixels. `host-theme` is the lower-level binding-shaped escape hatch; pass normalized `font_family`, `font_size`, and semantic role values there instead of raw Typst font descriptors or lengths. + +### `mermaid-profile(..)` + +Returns a reusable Typst settings dictionary. `profile` refers to this wrapper-level bundle, while `presentation-profile` selects a first-party Merman presentation profile. Profiles normalize into the same binding options used by direct parameters, so they do not create a second rendering path. + +### `mermaid-figure(source, ..)` + +Renders a Mermaid diagram and wraps it in a Typst `figure`. + +Use `document-context: true` when the figure should opt into the same document-context bridge as `mermaid(...)`. + +Figure layout parameters are forwarded to Typst's native `figure`: `placement`, `scope`, `supplement`, `numbering`, `gap`, and `outlined`. Use `caption-position` and `caption-separator` when you need a top caption or document-specific caption separator. Direct figure parameters override `profile.figure` defaults. + +### `mermaid-svg(source, ..)` + +Returns the rendered SVG as a string instead of embedding it as an image. + +This value-returning API does not enter Typst `context`; pass `typography`, `host-theme`, `layout`, or `container-width` explicitly when exporting SVG text. Rendering failures panic; use `mermaid-result(...)` when the document needs programmatic error handling. + +### `mermaid-result(source, ..)` + +Returns a structured render payload: + +```typst +#let result = mermaid-result("flowchart TD\nA --> B") +#if result.ok { + result.svg +} else { + result.message +} +``` + +The result also includes `operation`, `kind`, and `capability_id`. On failure, these fields let callers distinguish a missing compiled capability from invalid input or a general render error without parsing `message`. +Resource-limit failures additionally expose `details.resource` with the stable limit id, profile, and actual/max values. + +### `analyze-mermaid(source, ..)` + +Returns the canonical diagnostic analysis schema 1 payload produced by the Rust bindings: + +```typst +#let analysis = analyze-mermaid("flowchart TD\nA --> B") +#analysis.version +#analysis.valid +#analysis.summary.errors +#analysis.diagnostics +``` + +Invalid Mermaid source remains a schema-1 analysis payload with `valid: false`; transport, options, and missing-capability failures use the structured operation envelope instead. + +### `merman-capabilities()` + +Returns the compiled plugin capability payload, including the current text measurement boundary: + +```typst +#let capabilities = merman-capabilities() +#capabilities.capabilities.text_measurement.provider_ids +``` + +The flat catalog reports the artifact's current capability, output, operation, registry, and resource sets. The plugin independently applies a fixed constrained resource ceiling to every render and analysis operation. Raw binding options may tighten individual resource limits but cannot loosen or silently replace that transport-owned policy. The options root and any `analysis` or `merman` wrapper must be JSON objects; malformed wrapper values return a structured options error before rendering or analysis begins. + +### `show-mermaid-blocks(..)` + +Returns a raw block show handler. This is the shortest way to enable Mermaid fences across a Typst document: + +```typst +#show raw.where(lang: "mermaid"): show-mermaid-blocks(width: 100%) +``` + +## Development + +The Typst package uses its own version track and is not locked to the Rust crate version. The embedded WebAssembly plugin also has a separate ABI version, documented in the Version Mapping table, for exported function and payload compatibility. + +Build the publish Typst package locally: + +```sh +cargo run --locked -p xtask -- build-typst-package --profile publish +``` + +The release build requires `wasm-tools` and Binaryen `wasm-opt version 131`. The package builder applies a pinned `wasm-opt -Oz` pass before stripping custom sections and records both tool versions in the artifact manifest. + +The package is written to: + +```sh +dist/typst/merman/0.4.0 +``` + +The source package carries the examples shown above so they remain readable in the package review. `typst.toml` excludes `examples/**` from the runtime download; tests stay in the Merman source repository and are not bundled. + +For a manual local install, copy that directory to `/preview/merman/0.4.0` and pass the parent directory to Typst: + +```text +/preview/merman/0.4.0/typst.toml +/preview/merman/0.4.0/lib.typ +/preview/merman/0.4.0/merman_typst_plugin.wasm +``` + +```sh +typst compile --package-path document.typ +``` + +The `typst-package-smoke` command creates this preview layout automatically in a temporary directory. + +For local `@preview` smoke tests, copy the built package under a preview namespace package path and compile with `--package-path`: + +```sh +cargo run --locked -p xtask -- typst-package-smoke --profile publish --skip-wasm-build +``` + +Use an explicit Typst binary when the CLI is downloaded outside `PATH`: + +```sh +cargo run --locked -p xtask -- typst-package-smoke --profile publish --skip-wasm-build --typst /path/to/typst +``` + +Each smoke run owns an independent temporary directory under `target/typst-package-smoke/`. Positive fixtures preserve their nested output paths, and `tests/compile-fail/` fixtures must fail with the diagnostic declared by their adjacent `.error.txt` file. Successful runs remove their artifacts by default; pass `--keep-artifacts` to retain the run directory for inspection. + +The build verifies artifact-recipe provenance from its private build directory, then stages only the +runtime wrapper, WASM, examples, and legal materials. The transaction snapshots source bytes, +verifies the complete file shape and contents, and rechecks live source identity immediately before +atomically replacing the version directory; build receipts are not included in the published package. + +The sole package profile, `publish`, enables SVG rendering, analysis, the complete Mermaid language catalog, and the Cytoscape and ELK layout backends. There are no alternate bridge-only or SVG-only package profiles. ASCII, PNG, JPEG, and PDF are not compiled because this wrapper exposes no operation for those outputs. Maintainer experiments use direct Cargo features and do not create another package identity or release recipe. + +## Current Limits + +- Output is SVG embedded through Typst `image`; diagrams are not Typst-native vector elements. +- Font family and size can be forwarded as style intent, but exact Typst font glyph measurement is not automatic. +- RaTeX math rendering is not available in the Typst plugin. Its current upstream closure depends on browser system-font discovery; the capability will remain closed until a zero-browser-import implementation passes admission. +- Browser-only Mermaid interactions such as script callbacks and popup behavior are not expected to work in static Typst output. +- The package is smoke-tested with Typst 0.15.0. Typst 0.15 HTML export remains experimental and is not a package promise here. +- The `readable` and `parity` pipelines can embed SVG structures that Typst warns about; `resvg-safe` is the intended embedded-image path for package output. + +## License + +The wrapper and Merman-authored code are available under either MIT or Apache-2.0. The embedded ELK-derived implementation is a separate component under EPL-2.0; it does not relicense the rest of the package. `THIRD_PARTY_NOTICES.md` records the exact source revision, relationship, and scope for ELK and the other embedded or translated components, while `THIRD_PARTY_LICENSES/` contains their applicable legal files. Preserve these materials when redistributing the package or a derivative artifact. + +The machine-readable Cargo dependency report remains in the source repository's release evidence instead of being duplicated in the downloaded Typst package. diff --git a/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/cose-base-v1/LICENSE b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/cose-base-v1/LICENSE new file mode 100644 index 0000000000..0c3c5fc6b4 --- /dev/null +++ b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/cose-base-v1/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 - present, iVis@Bilkent. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/cose-base-v2/LICENSE b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/cose-base-v2/LICENSE new file mode 100644 index 0000000000..0c3c5fc6b4 --- /dev/null +++ b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/cose-base-v2/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 - present, iVis@Bilkent. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/cytoscape-cose-bilkent/LICENSE b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/cytoscape-cose-bilkent/LICENSE new file mode 100644 index 0000000000..9e21a7e3e0 --- /dev/null +++ b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/cytoscape-cose-bilkent/LICENSE @@ -0,0 +1,21 @@ + + +Copyright (c) 2016-2018, The Cytoscape Consortium. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the “Software”), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/cytoscape-fcose/LICENSE b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/cytoscape-fcose/LICENSE new file mode 100644 index 0000000000..3552d1cad7 --- /dev/null +++ b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/cytoscape-fcose/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2018 - present, iVis-at-Bilkent. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the “Software”), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/cytoscape/LICENSE b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/cytoscape/LICENSE new file mode 100644 index 0000000000..aac05f201c --- /dev/null +++ b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/cytoscape/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2016-2026, The Cytoscape Consortium. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the “Software”), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/d3-shape/LICENSE b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/d3-shape/LICENSE new file mode 100644 index 0000000000..fbe44bdc9a --- /dev/null +++ b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/d3-shape/LICENSE @@ -0,0 +1,13 @@ +Copyright 2010-2022 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. diff --git a/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/dagre/LICENSE b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/dagre/LICENSE new file mode 100644 index 0000000000..7d7dd94248 --- /dev/null +++ b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/dagre/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2012-2014 Chris Pettitt + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/dompurify/LICENSE b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/dompurify/LICENSE new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/dompurify/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/eclipse-elk/LICENSE.md b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/eclipse-elk/LICENSE.md new file mode 100644 index 0000000000..2849d27f5b --- /dev/null +++ b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/eclipse-elk/LICENSE.md @@ -0,0 +1,264 @@ +# Eclipse Public License - v 2.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE (“AGREEMENT”). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +## 1. DEFINITIONS + +“Contribution” means: + +- a\) in the case of the initial Contributor, the initial content + Distributed under this Agreement, and +- b\) in the case of each subsequent Contributor: + - i\) changes to the Program, and + - ii\) additions to the Program; + + where such changes and/or additions to the Program originate from + and are Distributed by that particular Contributor. A Contribution + “originates” from a Contributor if it was added to the Program by + such Contributor itself or anyone acting on such Contributor's + behalf. Contributions do not include changes or additions to the + Program that are not Modified Works. + +“Contributor” means any person or entity that Distributes the Program. + +“Licensed Patents” mean patent claims licensable by a Contributor which +are necessarily infringed by the use or sale of its Contribution alone +or when combined with the Program. + +“Program” means the Contributions Distributed in accordance with this +Agreement. + +“Recipient” means anyone who receives the Program under this Agreement +or any Secondary License (as applicable), including Contributors. + +“Derivative Works” shall mean any work, whether in Source Code or other +form, that is based on (or derived from) the Program and for which the +editorial revisions, annotations, elaborations, or other modifications +represent, as a whole, an original work of authorship. + +“Modified Works” shall mean any work in Source Code or other form that +results from an addition to, deletion from, or modification of the +contents of the Program, including, for purposes of clarity any new file +in Source Code form that contains any contents of the Program. Modified +Works shall not include works that contain only declarations, +interfaces, types, classes, structures, or files of the Program solely +in each case in order to link to, bind by name, or subclass the Program +or Modified Works thereof. + +“Distribute” means the acts of a) distributing or b) making available in +any manner that enables the transfer of a copy. + +“Source Code” means the form of a Program preferred for making +modifications, including but not limited to software source code, +documentation source, and configuration files. + +“Secondary License” means either the GNU General Public License, Version +2.0, or any later versions of that license, including any exceptions or +additional permissions as identified by the initial Contributor. + +## 2. GRANT OF RIGHTS + +- a\) Subject to the terms of this Agreement, each Contributor hereby + grants Recipient a non-exclusive, worldwide, royalty-free copyright + license to reproduce, prepare Derivative Works of, publicly display, + publicly perform, Distribute and sublicense the Contribution of such + Contributor, if any, and such Derivative Works. +- b\) Subject to the terms of this Agreement, each Contributor hereby + grants Recipient a non-exclusive, worldwide, royalty-free patent license + under Licensed Patents to make, use, sell, offer to sell, import and + otherwise transfer the Contribution of such Contributor, if any, in + Source Code or other form. This patent license shall apply to the + combination of the Contribution and the Program if, at the time the + Contribution is added by the Contributor, such addition of the + Contribution causes such combination to be covered by the + Licensed Patents. The patent license shall not apply to any other + combinations which include the Contribution. No hardware per se is + licensed hereunder. +- c\) Recipient understands that although each Contributor grants the + licenses to its Contributions set forth herein, no assurances are + provided by any Contributor that the Program does not infringe the + patent or other intellectual property rights of any other entity. Each + Contributor disclaims any liability to Recipient for claims brought by + any other entity based on infringement of intellectual property rights + or otherwise. As a condition to exercising the rights and licenses + granted hereunder, each Recipient hereby assumes sole responsibility to + secure any other intellectual property rights needed, if any. For + example, if a third party patent license is required to allow Recipient + to Distribute the Program, it is Recipient's responsibility to acquire + that license before distributing the Program. +- d\) Each Contributor represents that to its knowledge it has sufficient + copyright rights in its Contribution, if any, to grant the copyright + license set forth in this Agreement. +- e\) Notwithstanding the terms of any Secondary License, no Contributor + makes additional grants to any Recipient (other than those set forth in + this Agreement) as a result of such Recipient's receipt of the Program + under the terms of a Secondary License (if permitted under the terms of + Section 3). + +## 3. REQUIREMENTS + +3.1 If a Contributor Distributes the Program in any form, then: + +- a\) the Program must also be made available as Source Code, in accordance + with section 3.2, and the Contributor must accompany the Program with a + statement that the Source Code for the Program is available under this + Agreement, and informs Recipients how to obtain it in a reasonable + manner on or through a medium customarily used for software exchange; + and +- b\) the Contributor may Distribute the Program under a license different + than this Agreement, provided that such license: + - i\) effectively disclaims on behalf of all other Contributors all + warranties and conditions, express and implied, including warranties or + conditions of title and non-infringement, and implied warranties or + conditions of merchantability and fitness for a particular purpose; + - ii\) effectively excludes on behalf of all other Contributors all + liability for damages, including direct, indirect, special, incidental + and consequential damages, such as lost profits; + - iii\) does not attempt to limit or alter the recipients' rights in the + Source Code under section 3.2; and + - iv\) requires any subsequent distribution of the Program by any party to + be under a license that satisfies the requirements of this section 3. + +3.2 When the Program is Distributed as Source Code: + +- a\) it must be made available under this Agreement, or if the Program (i) + is combined with other material in a separate file or files made + available under a Secondary License, and (ii) the initial Contributor + attached to the Source Code the notice described in Exhibit A of this + Agreement, then the Program may be made available under the terms of + such Secondary Licenses, and +- b\) a copy of this Agreement must be included with each copy of + the Program. + +3.3 Contributors may not remove or alter any copyright, patent, +trademark, attribution notices, disclaimers of warranty, or limitations +of liability (‘notices’) contained within the Program from any copy of +the Program which they Distribute, provided that Contributors may add +their own appropriate notices. + +## 4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities +with respect to end users, business partners and the like. While this +license is intended to facilitate the commercial use of the Program, the +Contributor who includes the Program in a commercial product offering +should do so in a manner which does not create potential liability for +other Contributors. Therefore, if a Contributor includes the Program in +a commercial product offering, such Contributor (“Commercial +Contributor”) hereby agrees to defend and indemnify every other +Contributor (“Indemnified Contributor”) against any losses, damages and +costs (collectively “Losses”) arising from claims, lawsuits and other +legal actions brought by a third party against the Indemnified +Contributor to the extent caused by the acts or omissions of such +Commercial Contributor in connection with its distribution of the +Program in a commercial product offering. The obligations in this +section do not apply to any claims or Losses relating to any actual or +alleged intellectual property infringement. In order to qualify, an +Indemnified Contributor must: a) promptly notify the Commercial +Contributor in writing of such claim, and b) allow the Commercial +Contributor to control, and cooperate with the Commercial Contributor +in, the defense and any related settlement negotiations. The Indemnified +Contributor may participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +## 5. NO WARRANTY {#warranty} + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT +PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN “AS IS” +BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR +IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF +TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR +PURPOSE. Each Recipient is solely responsible for determining the +appropriateness of using and distributing the Program and assumes all +risks associated with its exercise of rights under this Agreement, +including but not limited to the risks and costs of program errors, +compliance with applicable laws, damage to or loss of data, programs or +equipment, and unavailability or interruption of operations. + +## 6. DISCLAIMER OF LIABILITY {#disclaimer} + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT +PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS +SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST +PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE +EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + +## 7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further action +by the parties hereto, such provision shall be reformed to the minimum +extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity (including +a cross-claim or counterclaim in a lawsuit) alleging that the Program +itself (excluding combinations of the Program with other software or +hardware) infringes such Recipient's patent(s), then such Recipient's +rights granted under Section 2(b) shall terminate as of the date such +litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails +to comply with any of the material terms or conditions of this Agreement +and does not cure such failure in a reasonable period of time after +becoming aware of such noncompliance. If all Recipient's rights under +this Agreement terminate, Recipient agrees to cease use and distribution +of the Program as soon as reasonably practicable. However, Recipient's +obligations under this Agreement and any licenses granted by Recipient +relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and may +only be modified in the following manner. The Agreement Steward reserves +the right to publish new versions (including revisions) of this +Agreement from time to time. No one other than the Agreement Steward has +the right to modify this Agreement. The Eclipse Foundation is the +initial Agreement Steward. The Eclipse Foundation may assign the +responsibility to serve as the Agreement Steward to a suitable separate +entity. Each new version of the Agreement will be given a distinguishing +version number. The Program (including Contributions) may always be +Distributed subject to the version of the Agreement under which it was +received. In addition, after a new version of the Agreement is +published, Contributor may elect to Distribute the Program (including +its Contributions) under the new version. + +Except as expressly stated in Sections 2(a) and 2(b) above, Recipient +receives no rights or licenses to the intellectual property of any +Contributor under this Agreement, whether expressly, by implication, +estoppel or otherwise. All rights in the Program not expressly granted +under this Agreement are reserved. Nothing in this Agreement is intended +to be enforceable by any entity that is not a Contributor or Recipient. +No third-party beneficiary rights are created under this Agreement. + +## Exhibit A – Form of Secondary Licenses Notice {#exhibit-a} + +“This Source Code may also be made available under the following +Secondary Licenses when the conditions for such availability set forth +in the Eclipse Public License, v. 2.0 are satisfied: {name license(s), +version(s), and exceptions or additional permissions here}.” + +> Simply including a copy of this Agreement, including this Exhibit A is +> not sufficient to license the Source Code under Secondary Licenses. +> +> If it is not possible or desirable to put the notice in a particular +> file, then You may include the notice in a location (such as a LICENSE +> file in a relevant directory) where a recipient would be likely to +> look for such a notice. +> +> You may add additional accurate notices of copyright ownership. diff --git a/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/elkjs/LICENSE.md b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/elkjs/LICENSE.md new file mode 100644 index 0000000000..2849d27f5b --- /dev/null +++ b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/elkjs/LICENSE.md @@ -0,0 +1,264 @@ +# Eclipse Public License - v 2.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE (“AGREEMENT”). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +## 1. DEFINITIONS + +“Contribution” means: + +- a\) in the case of the initial Contributor, the initial content + Distributed under this Agreement, and +- b\) in the case of each subsequent Contributor: + - i\) changes to the Program, and + - ii\) additions to the Program; + + where such changes and/or additions to the Program originate from + and are Distributed by that particular Contributor. A Contribution + “originates” from a Contributor if it was added to the Program by + such Contributor itself or anyone acting on such Contributor's + behalf. Contributions do not include changes or additions to the + Program that are not Modified Works. + +“Contributor” means any person or entity that Distributes the Program. + +“Licensed Patents” mean patent claims licensable by a Contributor which +are necessarily infringed by the use or sale of its Contribution alone +or when combined with the Program. + +“Program” means the Contributions Distributed in accordance with this +Agreement. + +“Recipient” means anyone who receives the Program under this Agreement +or any Secondary License (as applicable), including Contributors. + +“Derivative Works” shall mean any work, whether in Source Code or other +form, that is based on (or derived from) the Program and for which the +editorial revisions, annotations, elaborations, or other modifications +represent, as a whole, an original work of authorship. + +“Modified Works” shall mean any work in Source Code or other form that +results from an addition to, deletion from, or modification of the +contents of the Program, including, for purposes of clarity any new file +in Source Code form that contains any contents of the Program. Modified +Works shall not include works that contain only declarations, +interfaces, types, classes, structures, or files of the Program solely +in each case in order to link to, bind by name, or subclass the Program +or Modified Works thereof. + +“Distribute” means the acts of a) distributing or b) making available in +any manner that enables the transfer of a copy. + +“Source Code” means the form of a Program preferred for making +modifications, including but not limited to software source code, +documentation source, and configuration files. + +“Secondary License” means either the GNU General Public License, Version +2.0, or any later versions of that license, including any exceptions or +additional permissions as identified by the initial Contributor. + +## 2. GRANT OF RIGHTS + +- a\) Subject to the terms of this Agreement, each Contributor hereby + grants Recipient a non-exclusive, worldwide, royalty-free copyright + license to reproduce, prepare Derivative Works of, publicly display, + publicly perform, Distribute and sublicense the Contribution of such + Contributor, if any, and such Derivative Works. +- b\) Subject to the terms of this Agreement, each Contributor hereby + grants Recipient a non-exclusive, worldwide, royalty-free patent license + under Licensed Patents to make, use, sell, offer to sell, import and + otherwise transfer the Contribution of such Contributor, if any, in + Source Code or other form. This patent license shall apply to the + combination of the Contribution and the Program if, at the time the + Contribution is added by the Contributor, such addition of the + Contribution causes such combination to be covered by the + Licensed Patents. The patent license shall not apply to any other + combinations which include the Contribution. No hardware per se is + licensed hereunder. +- c\) Recipient understands that although each Contributor grants the + licenses to its Contributions set forth herein, no assurances are + provided by any Contributor that the Program does not infringe the + patent or other intellectual property rights of any other entity. Each + Contributor disclaims any liability to Recipient for claims brought by + any other entity based on infringement of intellectual property rights + or otherwise. As a condition to exercising the rights and licenses + granted hereunder, each Recipient hereby assumes sole responsibility to + secure any other intellectual property rights needed, if any. For + example, if a third party patent license is required to allow Recipient + to Distribute the Program, it is Recipient's responsibility to acquire + that license before distributing the Program. +- d\) Each Contributor represents that to its knowledge it has sufficient + copyright rights in its Contribution, if any, to grant the copyright + license set forth in this Agreement. +- e\) Notwithstanding the terms of any Secondary License, no Contributor + makes additional grants to any Recipient (other than those set forth in + this Agreement) as a result of such Recipient's receipt of the Program + under the terms of a Secondary License (if permitted under the terms of + Section 3). + +## 3. REQUIREMENTS + +3.1 If a Contributor Distributes the Program in any form, then: + +- a\) the Program must also be made available as Source Code, in accordance + with section 3.2, and the Contributor must accompany the Program with a + statement that the Source Code for the Program is available under this + Agreement, and informs Recipients how to obtain it in a reasonable + manner on or through a medium customarily used for software exchange; + and +- b\) the Contributor may Distribute the Program under a license different + than this Agreement, provided that such license: + - i\) effectively disclaims on behalf of all other Contributors all + warranties and conditions, express and implied, including warranties or + conditions of title and non-infringement, and implied warranties or + conditions of merchantability and fitness for a particular purpose; + - ii\) effectively excludes on behalf of all other Contributors all + liability for damages, including direct, indirect, special, incidental + and consequential damages, such as lost profits; + - iii\) does not attempt to limit or alter the recipients' rights in the + Source Code under section 3.2; and + - iv\) requires any subsequent distribution of the Program by any party to + be under a license that satisfies the requirements of this section 3. + +3.2 When the Program is Distributed as Source Code: + +- a\) it must be made available under this Agreement, or if the Program (i) + is combined with other material in a separate file or files made + available under a Secondary License, and (ii) the initial Contributor + attached to the Source Code the notice described in Exhibit A of this + Agreement, then the Program may be made available under the terms of + such Secondary Licenses, and +- b\) a copy of this Agreement must be included with each copy of + the Program. + +3.3 Contributors may not remove or alter any copyright, patent, +trademark, attribution notices, disclaimers of warranty, or limitations +of liability (‘notices’) contained within the Program from any copy of +the Program which they Distribute, provided that Contributors may add +their own appropriate notices. + +## 4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities +with respect to end users, business partners and the like. While this +license is intended to facilitate the commercial use of the Program, the +Contributor who includes the Program in a commercial product offering +should do so in a manner which does not create potential liability for +other Contributors. Therefore, if a Contributor includes the Program in +a commercial product offering, such Contributor (“Commercial +Contributor”) hereby agrees to defend and indemnify every other +Contributor (“Indemnified Contributor”) against any losses, damages and +costs (collectively “Losses”) arising from claims, lawsuits and other +legal actions brought by a third party against the Indemnified +Contributor to the extent caused by the acts or omissions of such +Commercial Contributor in connection with its distribution of the +Program in a commercial product offering. The obligations in this +section do not apply to any claims or Losses relating to any actual or +alleged intellectual property infringement. In order to qualify, an +Indemnified Contributor must: a) promptly notify the Commercial +Contributor in writing of such claim, and b) allow the Commercial +Contributor to control, and cooperate with the Commercial Contributor +in, the defense and any related settlement negotiations. The Indemnified +Contributor may participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +## 5. NO WARRANTY {#warranty} + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT +PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN “AS IS” +BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR +IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF +TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR +PURPOSE. Each Recipient is solely responsible for determining the +appropriateness of using and distributing the Program and assumes all +risks associated with its exercise of rights under this Agreement, +including but not limited to the risks and costs of program errors, +compliance with applicable laws, damage to or loss of data, programs or +equipment, and unavailability or interruption of operations. + +## 6. DISCLAIMER OF LIABILITY {#disclaimer} + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT +PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS +SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST +PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE +EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + +## 7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further action +by the parties hereto, such provision shall be reformed to the minimum +extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity (including +a cross-claim or counterclaim in a lawsuit) alleging that the Program +itself (excluding combinations of the Program with other software or +hardware) infringes such Recipient's patent(s), then such Recipient's +rights granted under Section 2(b) shall terminate as of the date such +litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails +to comply with any of the material terms or conditions of this Agreement +and does not cure such failure in a reasonable period of time after +becoming aware of such noncompliance. If all Recipient's rights under +this Agreement terminate, Recipient agrees to cease use and distribution +of the Program as soon as reasonably practicable. However, Recipient's +obligations under this Agreement and any licenses granted by Recipient +relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and may +only be modified in the following manner. The Agreement Steward reserves +the right to publish new versions (including revisions) of this +Agreement from time to time. No one other than the Agreement Steward has +the right to modify this Agreement. The Eclipse Foundation is the +initial Agreement Steward. The Eclipse Foundation may assign the +responsibility to serve as the Agreement Steward to a suitable separate +entity. Each new version of the Agreement will be given a distinguishing +version number. The Program (including Contributions) may always be +Distributed subject to the version of the Agreement under which it was +received. In addition, after a new version of the Agreement is +published, Contributor may elect to Distribute the Program (including +its Contributions) under the new version. + +Except as expressly stated in Sections 2(a) and 2(b) above, Recipient +receives no rights or licenses to the intellectual property of any +Contributor under this Agreement, whether expressly, by implication, +estoppel or otherwise. All rights in the Program not expressly granted +under this Agreement are reserved. Nothing in this Agreement is intended +to be enforceable by any entity that is not a Contributor or Recipient. +No third-party beneficiary rights are created under this Agreement. + +## Exhibit A – Form of Secondary Licenses Notice {#exhibit-a} + +“This Source Code may also be made available under the following +Secondary Licenses when the conditions for such availability set forth +in the Eclipse Public License, v. 2.0 are satisfied: {name license(s), +version(s), and exceptions or additional permissions here}.” + +> Simply including a copy of this Agreement, including this Exhibit A is +> not sufficient to license the Source Code under Secondary Licenses. +> +> If it is not possible or desirable to put the notice in a particular +> file, then You may include the notice in a location (such as a LICENSE +> file in a relevant directory) where a recipient would be likely to +> look for such a notice. +> +> You may add additional accurate notices of copyright ownership. diff --git a/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/fmin/LICENSE b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/fmin/LICENSE new file mode 100644 index 0000000000..a9a110484a --- /dev/null +++ b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/fmin/LICENSE @@ -0,0 +1,27 @@ +Copyright 2016, Ben Frederickson +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the author nor the names of contributors may be used to + endorse or promote products derived from this software without specific prior + written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/graphlib/LICENSE b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/graphlib/LICENSE new file mode 100644 index 0000000000..7d7dd94248 --- /dev/null +++ b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/graphlib/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2012-2014 Chris Pettitt + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/layout-base-v1/LICENSE b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/layout-base-v1/LICENSE new file mode 100644 index 0000000000..6553af2e92 --- /dev/null +++ b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/layout-base-v1/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 iVis@Bilkent + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/layout-base-v2/LICENSE b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/layout-base-v2/LICENSE new file mode 100644 index 0000000000..6553af2e92 --- /dev/null +++ b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/layout-base-v2/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 iVis@Bilkent + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/mermaid/LICENSE b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/mermaid/LICENSE new file mode 100644 index 0000000000..2e5daebd2a --- /dev/null +++ b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/mermaid/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 - 2022 Knut Sveidqvist + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/non-layered-tidy-tree-layout/LICENSE b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/non-layered-tidy-tree-layout/LICENSE new file mode 100644 index 0000000000..47b964b6ef --- /dev/null +++ b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/non-layered-tidy-tree-layout/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Michael Wong + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/rough-rs/LICENSE b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/rough-rs/LICENSE new file mode 100644 index 0000000000..4d07414176 --- /dev/null +++ b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/rough-rs/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Orhan Balci + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/roughjs/LICENSE b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/roughjs/LICENSE new file mode 100644 index 0000000000..8861089702 --- /dev/null +++ b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/roughjs/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Preet Shihn + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/sanitize-url/LICENSE b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/sanitize-url/LICENSE new file mode 100644 index 0000000000..99107f8f61 --- /dev/null +++ b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/sanitize-url/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Braintree + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/venn-js/LICENSE b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/venn-js/LICENSE new file mode 100644 index 0000000000..ad6e7d7739 --- /dev/null +++ b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/venn-js/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2013 Ben Frederickson +Copyright (c) 2021 Samuel Gratzl + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/wasm-minimal-protocol/LICENSE b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/wasm-minimal-protocol/LICENSE new file mode 100644 index 0000000000..fdddb29aa4 --- /dev/null +++ b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/wasm-minimal-protocol/LICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/zenuml-core/LICENSE b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/zenuml-core/LICENSE new file mode 100644 index 0000000000..bd7a4ea82e --- /dev/null +++ b/packages/preview/merman/0.4.0/THIRD_PARTY_LICENSES/zenuml-core/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Peng Xiao + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/preview/merman/0.4.0/THIRD_PARTY_NOTICES.md b/packages/preview/merman/0.4.0/THIRD_PARTY_NOTICES.md new file mode 100644 index 0000000000..1316e9eba9 --- /dev/null +++ b/packages/preview/merman/0.4.0/THIRD_PARTY_NOTICES.md @@ -0,0 +1,277 @@ +# Third-Party Notices + +This file records the third-party material in the `typst-publish` artifact scope. +It is generated from the release component contract and is intentionally limited to this artifact. +The wrapper and Merman-authored code remain under the project license; each component below keeps its own terms. + +## Artifact scope + +- ID: `typst-publish` +- Description: The Typst WASM publish profile, including ELK and wasm-minimal-protocol but excluding RaTeX. +- Components: `cose-base-v1`, `cose-base-v2`, `cytoscape`, `cytoscape-cose-bilkent`, `cytoscape-fcose`, `d3-shape`, `dagre`, `dompurify`, `fmin`, `graphlib`, `layout-base-v1`, `layout-base-v2`, `mermaid`, `non-layered-tidy-tree-layout`, `rough-rs`, `roughjs`, `sanitize-url`, `venn-js`, `zenuml-core`, `eclipse-elk`, `elkjs`, `wasm-minimal-protocol` + +## Components + +### cose-base 1.x + +Manatee contains Rust translations and adaptations of CoSE layout behavior from this baseline. + +- Version: `1.0.3` +- Source: https://github.com/iVis-at-Bilkent/cose-base.git @ `914bfe712991534af1d8b795d6f262687edc2563` +- Source path: `.` +- Relationship: `modified`, `translated` +- License: `MIT` +- Local evidence: `crates/manatee` +- Legal file: `THIRD_PARTY_LICENSES/cose-base-v1/LICENSE` + +### cose-base 2.x + +Manatee contains Rust translations and adaptations of the newer CoSE base behavior from this baseline. + +- Version: `2.2.0` +- Source: https://github.com/iVis-at-Bilkent/cose-base.git @ `37f07ed2b8803211ec6c74110574cc47c156a136` +- Source path: `.` +- Relationship: `modified`, `translated` +- License: `MIT` +- Local evidence: `crates/manatee` +- Legal file: `THIRD_PARTY_LICENSES/cose-base-v2/LICENSE` + +### Cytoscape.js + +Architecture layout and styling use source-backed Cytoscape behavior and defaults. + +- Version: `3.34.0` +- Source: https://github.com/cytoscape/cytoscape.js.git @ `22716bfb75834b56fa6679648b0abb06f4ae691c` +- Source path: `.` +- Relationship: `behavior-reference`, `translated` +- License: `MIT` +- Local evidence: `crates/manatee`, `crates/merman-render/src/architecture.rs` +- Legal file: `THIRD_PARTY_LICENSES/cytoscape/LICENSE` + +### cytoscape.js-cose-bilkent + +Manatee includes source-backed CoSE-Bilkent layout behavior translated to Rust. + +- Version: `4.1.0` +- Source: https://github.com/iVis-at-Bilkent/cytoscape.js-cose-bilkent.git @ `999090a8438b4f14788d636ef4fd7a5355e29e8c` +- Source path: `.` +- Relationship: `modified`, `translated` +- License: `MIT` +- Local evidence: `crates/manatee` +- Legal file: `THIRD_PARTY_LICENSES/cytoscape-cose-bilkent/LICENSE` + +### cytoscape.js-fcose + +The headless Architecture layout is a modified Rust implementation of FCoSE behavior. + +- Version: `2.2.0` +- Source: https://github.com/iVis-at-Bilkent/cytoscape.js-fcose.git @ `78afcf96512a409abc903699277ad616c02dfad9` +- Source path: `.` +- Relationship: `modified`, `translated` +- License: `MIT` +- Local evidence: `crates/manatee`, `crates/merman-render/src/architecture.rs` +- Legal file: `THIRD_PARTY_LICENSES/cytoscape-fcose/LICENSE` + +### d3-shape + +The SVG parity layer translates D3 curve algorithms, including basis, natural, step, cardinal, bump, and Catmull-Rom variants. + +- Version: `3.2.0` +- Source: https://github.com/d3/d3-shape.git @ `8ec82658454750cfa29efb1e0ea514e3dd9b2297` +- Source path: `src/curve` +- Relationship: `modified`, `translated` +- License: `ISC` +- Local evidence: `crates/merman-render/src/svg/parity/curve.rs` +- Legal file: `THIRD_PARTY_LICENSES/d3-shape/LICENSE` + +### Dagre + +Dugong is a modified Rust translation of Dagre's directed graph layout pipeline. + +- Version: `2.0.2` +- Source: https://github.com/dagrejs/dagre.git @ `ba986662394f8f3ed608717194e5958f3386ce01` +- Source path: `lib` +- Relationship: `modified`, `translated` +- License: `MIT` +- Local evidence: `crates/dugong` +- Legal file: `THIRD_PARTY_LICENSES/dagre/LICENSE` + +### DOMPurify + +Merman selects DOMPurify's Apache-2.0 option for generated sanitizer defaults; the exact upstream Apache-2.0 license file is preserved. + +- Version: `3.4.16` +- Source: https://github.com/cure53/DOMPurify.git @ `b9b9d80f7e401771c2ccaef5f45def7eec8f27d7` +- Source path: `.` +- Relationship: `generated`, `translated` +- License: `(Apache-2.0 OR MPL-2.0)` +- Local evidence: `crates/merman-core/src/generated/dompurify_defaults.rs` +- Legal file: `THIRD_PARTY_LICENSES/dompurify/LICENSE` + +### fmin + +The Venn layout kernel translates the fmin Nelder-Mead and conjugate-gradient optimization behavior. + +- Version: `0.0.4` +- Source: https://github.com/benfred/fmin.git @ `6b155c9f4a6ecf73ea5d71666da8e5dcd418b18b` +- Source path: `.` +- Relationship: `modified`, `translated` +- License: `BSD-3-Clause` +- Local evidence: `crates/merman-render/src/venn.rs` +- Legal file: `THIRD_PARTY_LICENSES/fmin/LICENSE` + +### Graphlib + +dugong-graphlib is a modified Rust translation of the graph model used by Dagre. + +- Version: `2.2.4` +- Source: https://github.com/dagrejs/graphlib.git @ `380d5efa1f4ab0904539f046bdba583d14ac2add` +- Source path: `lib` +- Relationship: `modified`, `translated` +- License: `MIT` +- Local evidence: `crates/dugong-graphlib` +- Legal file: `THIRD_PARTY_LICENSES/graphlib/LICENSE` + +### layout-base 1.x + +Manatee translates shared layout-base geometry, graph, and force-layout primitives from this baseline. + +- Version: `1.0.2` +- Source: https://github.com/iVis-at-Bilkent/layout-base.git @ `836898aa4a88e2794774997d7128b383108a3d5a` +- Source path: `.` +- Relationship: `modified`, `translated` +- License: `MIT` +- Local evidence: `crates/manatee` +- Legal file: `THIRD_PARTY_LICENSES/layout-base-v1/LICENSE` + +### layout-base 2.x + +Manatee also follows the newer layout-base behavior selected by the FCoSE dependency graph. + +- Version: `2.0.1` +- Source: https://github.com/iVis-at-Bilkent/layout-base.git @ `3f7549940feef31416cc35ef8256282ebc4d1ecd` +- Source path: `.` +- Relationship: `modified`, `translated` +- License: `MIT` +- Local evidence: `crates/manatee` +- Legal file: `THIRD_PARTY_LICENSES/layout-base-v2/LICENSE` + +### Mermaid + +Merman independently implements Mermaid-compatible behavior while translating selected algorithms, generating defaults, copying architecture icon data, and retaining upstream fixtures and snapshots. + +- Version: `12.1.0` +- Source: https://github.com/mermaid-js/mermaid.git @ `21f72f07ea22c0af48a3149c550654e80d8e40cb` +- Source path: `packages/mermaid` +- Relationship: `behavior-reference`, `copied`, `fixtures`, `generated`, `modified`, `translated` +- License: `MIT` +- Local evidence: `crates/merman-core/src`, `crates/merman-render/src`, `crates/merman-render/src/svg/parity/architecture/icons.rs`, `fixtures` +- Legal file: `THIRD_PARTY_LICENSES/mermaid/LICENSE` + +### non-layered-tidy-tree-layout + +Merman's Mindmap tidy-tree layout is a modified Rust translation of the non-layered tidy-tree contour and threading algorithm bundled by Mermaid's tidy-tree adapter. + +- Version: `2.0.2` +- Source: https://github.com/stetrevor/non-layered-tidy-tree-layout.git @ `63852fb7646eb079ce0e1976044d54545de273e8` +- Source path: `src` +- Relationship: `modified`, `translated` +- License: `MIT` +- Local evidence: `crates/merman-render/src/mindmap/tidy_tree.rs` +- Legal file: `THIRD_PARTY_LICENSES/non-layered-tidy-tree-layout/LICENSE` + +### rough-rs roughr + +roughr-merman is a modified in-tree fork of the rough-rs roughr crate. + +- Version: `0.12.0` +- Source: https://github.com/orhanbalci/rough-rs.git @ `b1c2d96c944da4e74275aa09892be14e2d54445a` +- Source path: `roughr` +- Relationship: `copied`, `modified` +- License: `MIT` +- Local evidence: `crates/roughr` +- Legal file: `THIRD_PARTY_LICENSES/rough-rs/LICENSE` + +### Rough.js + +The roughr fork aligns its randomization and drawing-operation semantics with Rough.js as used by Mermaid. + +- Version: `4.6.6` +- Source: https://github.com/pshihn/rough.git @ `56a2762171b1294d643501e8d14f120db6b27bd7` +- Source path: `src` +- Relationship: `behavior-reference`, `translated` +- License: `MIT` +- Local evidence: `crates/roughr` +- Legal file: `THIRD_PARTY_LICENSES/roughjs/LICENSE` + +### sanitize-url + +Merman's URL sanitization behavior is a source-backed Rust translation of sanitize-url. + +- Version: `7.1.1` +- Source: https://github.com/braintree/sanitize-url.git @ `b1e8d50e4066a9af00fa042176676374747f754b` +- Source path: `src` +- Relationship: `modified`, `translated` +- License: `MIT` +- Local evidence: `crates/merman-core/src/utils.rs` +- Legal file: `THIRD_PARTY_LICENSES/sanitize-url/LICENSE` + +### @upsetjs/venn.js + +The Venn family uses a modified Rust translation of the venn.js geometry and layout kernel. + +- Version: `2.0.0` +- Source: https://github.com/upsetjs/venn.js.git @ `350c835aab4a92a7570963c28f725cf9f6e5f258` +- Source path: `src` +- Relationship: `modified`, `translated` +- License: `MIT` +- Local evidence: `crates/merman-core/src/diagrams/venn.rs`, `crates/merman-render/src/venn.rs` +- Legal file: `THIRD_PARTY_LICENSES/venn-js/LICENSE` + +### ZenUML Core + +Merman's ZenUML grammar, model, renderer, emoji/icon data, and behavior probes follow the admitted ZenUML Core 3.50.1 source baseline. + +- Version: `3.50.1` +- Source: https://github.com/mermaid-js/zenuml-core.git @ `38404ccc14243ed54ab45b804b2eb6f2ca73af36` +- Source path: `.` +- Relationship: `behavior-reference`, `copied`, `modified`, `translated` +- License: `MIT` +- Local evidence: `crates/merman-core/src/diagrams/zenuml`, `crates/merman-render/assets/zenuml`, `crates/merman-render/src/zenuml.rs` +- Legal file: `THIRD_PARTY_LICENSES/zenuml-core/LICENSE` + +### Eclipse Layout Kernel + +The merman-elk-layered crate contains modified Rust source translations of Eclipse ELK layered, Box, Force, Stress, Mr. Tree, Radial, Rectangle Packing, and SPOrE overlap-removal algorithms, including common and core layout utilities, under EPL-2.0. + +- Version: `0.9.1` +- Source: https://github.com/eclipse-elk/elk.git @ `62d5909f96fad541bc101ad52dabaece6b7eab7e` +- Source path: `plugins` +- Relationship: `modified`, `translated` +- License: `EPL-2.0` +- Local evidence: `crates/merman-elk-layered`, `crates/merman-layout-elk` +- Legal file: `THIRD_PARTY_LICENSES/eclipse-elk/LICENSE.md` + +### elkjs + +Mermaid's ELK adapter behavior is compared against this JavaScript distribution, which is generated from Eclipse ELK sources. + +- Version: `0.9.3` +- Source: https://github.com/kieler/elkjs.git @ `a8304cf79fde75bc2ab1a89d28320f53f8637436` +- Source path: `.` +- Relationship: `behavior-reference` +- License: `EPL-2.0` +- Local evidence: `crates/merman-layout-elk`, `playground` +- Legal file: `THIRD_PARTY_LICENSES/elkjs/LICENSE.md` + +### wasm-minimal-protocol + +The Typst WASM transport links wasm-minimal-protocol; its upstream license file is the Unlicense text. + +- Version: `0.2.1` +- Source: https://github.com/typst-community/wasm-minimal-protocol.git @ `b595eb790d9926dd91afc37d98c2e1fd3102cb2a` +- Source path: `crates/macro` +- Relationship: `linked` +- License: `Unlicense` +- Local evidence: `Cargo.lock`, `crates/merman-typst-plugin` +- Legal file: `THIRD_PARTY_LICENSES/wasm-minimal-protocol/LICENSE` diff --git a/packages/preview/merman/0.4.0/examples/basic.typ b/packages/preview/merman/0.4.0/examples/basic.typ new file mode 100644 index 0000000000..034c255962 --- /dev/null +++ b/packages/preview/merman/0.4.0/examples/basic.typ @@ -0,0 +1,12 @@ +#import "@preview/merman:0.4.0": mermaid + += merman Typst Basic Example + +#mermaid( + "flowchart TD + A[Write Mermaid] --> B[Render with merman] + B --> C[Embed SVG in Typst] + ", + width: 90%, + alt: "A flowchart rendered by merman", +) diff --git a/packages/preview/merman/0.4.0/examples/dagre.typ b/packages/preview/merman/0.4.0/examples/dagre.typ new file mode 100644 index 0000000000..65d3de9333 --- /dev/null +++ b/packages/preview/merman/0.4.0/examples/dagre.typ @@ -0,0 +1,17 @@ +#import "@preview/merman:0.4.0": mermaid, mermaid-profile, show-mermaid-blocks + += Dagre layout + +#let dagre = mermaid-profile(site-config: (layout: "dagre")) +#show raw.where(lang: "mermaid"): show-mermaid-blocks(profile: dagre) + +#mermaid( + "flowchart LR\n Source --> Layout\n Layout --> SVG", + profile: dagre, +) + +```mermaid +flowchart LR + Source --> Profile + Profile --> RawBlock +``` diff --git a/packages/preview/merman/0.4.0/examples/document-context.typ b/packages/preview/merman/0.4.0/examples/document-context.typ new file mode 100644 index 0000000000..de5242dc28 --- /dev/null +++ b/packages/preview/merman/0.4.0/examples/document-context.typ @@ -0,0 +1,28 @@ +#import "@preview/merman:0.4.0": mermaid, show-mermaid-blocks + +#set page(width: 16cm, margin: 18mm) +#set text(font: "Arial", size: 13pt) + +#show raw.where(lang: "mermaid"): show-mermaid-blocks( + document-context: true, + width: 100%, +) + += Document context example + +#mermaid( + "flowchart LR + A[Document font] --> B[document-context render] + B --> C[Respects container width] + ", + document-context: true, + width: 100%, +) + +```mermaid +sequenceDiagram + participant Typst + participant merman + Typst->>merman: Use document-context raw blocks + merman-->>Typst: Render with the current document context +``` diff --git a/packages/preview/merman/0.4.0/examples/elk.typ b/packages/preview/merman/0.4.0/examples/elk.typ new file mode 100644 index 0000000000..175849d1b3 --- /dev/null +++ b/packages/preview/merman/0.4.0/examples/elk.typ @@ -0,0 +1,9 @@ +#import "@preview/merman:0.4.0": mermaid + += ELK layout + +#mermaid( + "---\nconfig:\n layout: elk\n---\nflowchart LR\n Source --> Layout\n Layout --> SVG\n Layout --> Details\n", + width: 95%, + alt: "A flowchart rendered with the ELK layout backend", +) diff --git a/packages/preview/merman/0.4.0/examples/figure.typ b/packages/preview/merman/0.4.0/examples/figure.typ new file mode 100644 index 0000000000..355ca6c44e --- /dev/null +++ b/packages/preview/merman/0.4.0/examples/figure.typ @@ -0,0 +1,48 @@ +#import "@preview/merman:0.4.0": mermaid-figure, mermaid-profile + += Mermaid figure + +#let diagram-profile = mermaid-profile( + pipeline: "resvg-safe", + background: "#ffffff", + typography: ( + font: ("Source Sans 3", "Arial", "sans-serif"), + size: "16px", + ), + figure: ( + placement: bottom, + scope: "parent", + caption-position: top, + caption-separator: [ -- ], + gap: 1em, + outlined: false, + ), +) + +#mermaid-figure( + "flowchart TD + Source[Mermaid source] --> Diagram[SVG image] + Diagram --> Figure[Typst figure] + ", + caption: [A Mermaid diagram rendered as a Typst figure.], + profile: diagram-profile, + width: 90%, + alt: "A Mermaid diagram rendered as a Typst figure", +) + +#set text(font: "Arial", size: 12pt) + +#mermaid-figure( + "sequenceDiagram + participant Typst + participant merman + Typst->>merman: Render with document context + merman-->>Typst: Embed as a figure + ", + caption: [A document-context Mermaid figure.], + document-context: true, + profile: diagram-profile, + caption-position: bottom, + width: 100%, + alt: "A document-context Mermaid sequence diagram", +) diff --git a/packages/preview/merman/0.4.0/examples/options.typ b/packages/preview/merman/0.4.0/examples/options.typ new file mode 100644 index 0000000000..3c598901d0 --- /dev/null +++ b/packages/preview/merman/0.4.0/examples/options.typ @@ -0,0 +1,57 @@ +#import "@preview/merman:0.4.0": analyze-mermaid, mermaid, mermaid-result, mermaid-svg + += merman Typst Options Example + +#let source = "flowchart LR + Start([Start]) --> Parse[Parse] + Parse --> Render[Render SVG] + Render --> Done([Done]) +" + +#let analysis = analyze-mermaid(source) +#let render-result = mermaid-result( + source, + pipeline: "readable", + text-measurement: "deterministic", + math-renderer: "none", +) +#let failed-result = mermaid-result("flowchart TD\n A -->") + +Analysis schema: `#analysis.version` + +Analysis valid: `#analysis.valid` + +Render result: `#render-result.code_name` + +Failed render result: `#failed-result.code_name` + +#mermaid( + source, + width: 95%, + id: "typst-options-demo", + scale: 1.05, + background: "#f8fafc", + theme-name: "base", + theme: ( + primaryColor: "#0f172a", + primaryTextColor: "#f8fafc", + primaryBorderColor: "#38bdf8", + lineColor: "#475569", + ), +) + +#let svg = mermaid-svg(source, pipeline: "readable") + +SVG starts with: + +```text +#svg.slice(0, 80) +``` + +Diagram errors can stay visible in drafts: + +#mermaid( + "flowchart TD\n A -->", + width: 95%, + error-mode: "placeholder", +) diff --git a/packages/preview/merman/0.4.0/examples/presentation.typ b/packages/preview/merman/0.4.0/examples/presentation.typ new file mode 100644 index 0000000000..e3d0f5a23b --- /dev/null +++ b/packages/preview/merman/0.4.0/examples/presentation.typ @@ -0,0 +1,48 @@ +#import "@preview/merman:0.4.0": mermaid, mermaid-profile, show-mermaid-blocks + +#set page(width: 16cm, height: 9cm, margin: 12mm, fill: rgb("#111827")) +#set text(fill: rgb("#e5e7eb")) + +#let slide-profile = mermaid-profile( + presentation-profile: "merman-modern", + background: "#111827", + host-theme: ( + appearance: "dark", + roles: ( + canvas: "#111827", + surface: "#1f2937", + text: "#e5e7eb", + border: "#475569", + line: "#93c5fd", + "actor-background": "#1f2937", + "actor-border": "#60a5fa", + "actor-text": "#e5e7eb", + ), + ), +) + +#show raw.where(lang: "mermaid"): show-mermaid-blocks( + profile: slide-profile, + width: 100%, +) + += Mermaid in slides + +#mermaid( + "flowchart LR + Idea[Idea] --> Demo[Typst slide] + Demo --> PDF[PDF deck] + ", + profile: slide-profile, + width: 100%, +) + +```mermaid +sequenceDiagram + participant Speaker + participant Typst + participant merman + Speaker->>Typst: Write a Mermaid fence + Typst->>merman: Render with the dark host theme + merman-->>Typst: Return presentation-aware SVG +``` diff --git a/packages/preview/merman/0.4.0/examples/print.typ b/packages/preview/merman/0.4.0/examples/print.typ new file mode 100644 index 0000000000..42febe9ce4 --- /dev/null +++ b/packages/preview/merman/0.4.0/examples/print.typ @@ -0,0 +1,32 @@ +#import "@preview/merman:0.4.0": mermaid, mermaid-profile + +#set page(paper: "a4", margin: 20mm) + += Print-friendly Mermaid + +#let source = "flowchart TD + Draft[Draft Mermaid] --> Review[Review in Typst] + Review --> Export[Export PDF] +" + +#let print-profile = mermaid-profile( + background: "#ffffff", + theme-name: "base", + typography: ( + font: ("Source Sans 3", "Arial", "sans-serif"), + size: "16px", + ), + theme: ( + primaryColor: "#f8fafc", + primaryTextColor: "#111827", + primaryBorderColor: "#2563eb", + lineColor: "#475569", + ), +) + +#mermaid( + source, + profile: print-profile, + width: 100%, + alt: "A print-friendly flowchart rendered by merman", +) diff --git a/packages/preview/merman/0.4.0/examples/profile.typ b/packages/preview/merman/0.4.0/examples/profile.typ new file mode 100644 index 0000000000..d4cbd1b3a7 --- /dev/null +++ b/packages/preview/merman/0.4.0/examples/profile.typ @@ -0,0 +1,42 @@ +#import "@preview/merman:0.4.0": mermaid, mermaid-profile, show-mermaid-blocks + += Reusable diagram profile + +#let diagram-profile = mermaid-profile( + background: "#ffffff", + theme-name: "base", + typography: ( + font: ("Source Sans 3", "Arial", "sans-serif"), + size: "16px", + ), + theme: ( + primaryColor: "#f8fafc", + primaryTextColor: "#111827", + primaryBorderColor: "#2563eb", + lineColor: "#475569", + ), +) + +#show raw.where(lang: "mermaid"): show-mermaid-blocks( + profile: diagram-profile, + width: 100%, +) + +#mermaid( + "flowchart LR + Profile[Profile] --> Direct[Direct call] + Profile --> Raw[Raw block] + ", + profile: diagram-profile, + width: 100%, +) + +```mermaid +sequenceDiagram + participant Typst + participant Profile + participant merman + Typst->>Profile: Reuse renderer settings + Profile->>merman: Normalize to binding options + merman-->>Typst: Return SVG +``` diff --git a/packages/preview/merman/0.4.0/examples/raw-block.typ b/packages/preview/merman/0.4.0/examples/raw-block.typ new file mode 100644 index 0000000000..5ef2bffdca --- /dev/null +++ b/packages/preview/merman/0.4.0/examples/raw-block.typ @@ -0,0 +1,19 @@ +#import "@preview/merman:0.4.0": show-mermaid-blocks + +#show raw.where(lang: "mermaid"): show-mermaid-blocks( + document-context: true, + width: 100%, + alt: "A Mermaid diagram rendered from a raw block", +) + += merman Typst Raw Block Example + +```mermaid +sequenceDiagram + participant User + participant Typst + participant merman + User->>Typst: Write a mermaid raw block + Typst->>merman: Call the wasm plugin + merman-->>Typst: Return SVG bytes +``` diff --git a/packages/preview/merman/0.4.0/examples/svg-export.typ b/packages/preview/merman/0.4.0/examples/svg-export.typ new file mode 100644 index 0000000000..d32c0547b8 --- /dev/null +++ b/packages/preview/merman/0.4.0/examples/svg-export.typ @@ -0,0 +1,25 @@ +#import "@preview/merman:0.4.0": mermaid-result, mermaid-svg + += SVG export + +#let source = "flowchart LR + Source[Mermaid source] --> SVG[SVG string] + Source --> Result[Structured result] +" + +#let svg = mermaid-svg(source, pipeline: "readable") +#let result = mermaid-result(source, pipeline: "readable") + +Render result: `#result.code_name` + +SVG starts with: + +```text +#svg.slice(0, 120) +``` + +Result SVG starts with: + +```text +#result.svg.slice(0, 120) +``` diff --git a/packages/preview/merman/0.4.0/lib.typ b/packages/preview/merman/0.4.0/lib.typ new file mode 100644 index 0000000000..fc23b42c96 --- /dev/null +++ b/packages/preview/merman/0.4.0/lib.typ @@ -0,0 +1 @@ +#import "src/exports.typ": * diff --git a/packages/preview/merman/0.4.0/merman_typst_plugin.wasm b/packages/preview/merman/0.4.0/merman_typst_plugin.wasm new file mode 100644 index 0000000000..f10c921f61 Binary files /dev/null and b/packages/preview/merman/0.4.0/merman_typst_plugin.wasm differ diff --git a/packages/preview/merman/0.4.0/src/capabilities.typ b/packages/preview/merman/0.4.0/src/capabilities.typ new file mode 100644 index 0000000000..eb1c7fdd7f --- /dev/null +++ b/packages/preview/merman/0.4.0/src/capabilities.typ @@ -0,0 +1,5 @@ +#import "plugin.typ": merman-plugin + +#let merman-capabilities() = { + json(merman-plugin.capabilities_json()) +} diff --git a/packages/preview/merman/0.4.0/src/context.typ b/packages/preview/merman/0.4.0/src/context.typ new file mode 100644 index 0000000000..c0483a3e0d --- /dev/null +++ b/packages/preview/merman/0.4.0/src/context.typ @@ -0,0 +1 @@ +#let typst-layout = layout diff --git a/packages/preview/merman/0.4.0/src/errors.typ b/packages/preview/merman/0.4.0/src/errors.typ new file mode 100644 index 0000000000..468ac3247c --- /dev/null +++ b/packages/preview/merman/0.4.0/src/errors.typ @@ -0,0 +1,33 @@ +#let error-message(result) = { + if result.message == none { + result.code_name + } else { + result.message + } +} + +#let validate-error-mode(error-mode) = { + if not ("panic", "text", "placeholder").contains(error-mode) { + panic("unknown merman error-mode: " + str(error-mode)) + } + error-mode +} + +#let diagram-error(result, error-mode, width) = { + if error-mode == "text" { + text(fill: rgb("#b91c1c"))[merman: #error-message(result)] + } else if error-mode == "placeholder" { + block( + width: width, + inset: 8pt, + fill: rgb("#fff7f7"), + stroke: rgb("#ef4444"), + )[ + #strong[merman diagram error] + #linebreak() + #error-message(result) + ] + } else { + panic("unknown merman error-mode: " + str(error-mode)) + } +} diff --git a/packages/preview/merman/0.4.0/src/exports.typ b/packages/preview/merman/0.4.0/src/exports.typ new file mode 100644 index 0000000000..ce6f61d369 --- /dev/null +++ b/packages/preview/merman/0.4.0/src/exports.typ @@ -0,0 +1,5 @@ +#import "capabilities.typ": merman-capabilities +#import "figure.typ": mermaid-figure +#import "options.typ": mermaid-profile +#import "raw.typ": show-mermaid-blocks +#import "render.typ": analyze-mermaid, mermaid, mermaid-result, mermaid-svg diff --git a/packages/preview/merman/0.4.0/src/figure.typ b/packages/preview/merman/0.4.0/src/figure.typ new file mode 100644 index 0000000000..d54b54cad5 --- /dev/null +++ b/packages/preview/merman/0.4.0/src/figure.typ @@ -0,0 +1,143 @@ +#import "options.typ": choose-value, dictionary-or-none, profile-field +#import "render.typ": mermaid + +#let figure-field(figure-profile, key, alt: none) = { + let figure-profile = dictionary-or-none(figure-profile, "merman figure profile") + if figure-profile == none { + none + } else if key in figure-profile { + figure-profile.at(key) + } else if alt != none and alt in figure-profile { + figure-profile.at(alt) + } else { + none + } +} + +#let figure-caption(caption, caption-position, caption-separator) = { + if caption == none { + none + } else if caption-position != none and caption-separator != none { + figure.caption(position: caption-position, separator: caption-separator, caption) + } else if caption-position != none { + figure.caption(position: caption-position, caption) + } else if caption-separator != none { + figure.caption(separator: caption-separator, caption) + } else { + caption + } +} + +#let build-figure-options( + profile, + caption, + placement, + scope, + supplement, + numbering, + outlined, + gap, + caption-position, + caption-separator, +) = { + let figure-profile = profile-field(profile, "figure") + let placement = choose-value(figure-field(figure-profile, "placement"), placement) + let scope = choose-value(figure-field(figure-profile, "scope"), scope) + let supplement = choose-value(figure-field(figure-profile, "supplement"), supplement) + let numbering = choose-value(figure-field(figure-profile, "numbering"), numbering) + let outlined = choose-value(figure-field(figure-profile, "outlined"), outlined) + let gap = choose-value(figure-field(figure-profile, "gap"), gap) + let caption-position = choose-value( + figure-field(figure-profile, "caption-position", alt: "caption_position"), + caption-position, + ) + let caption-separator = choose-value( + figure-field(figure-profile, "caption-separator", alt: "caption_separator"), + caption-separator, + ) + + let caption = figure-caption(caption, caption-position, caption-separator) + let out = if caption != none { + (caption: caption) + } else { + (:) + } + let out = if placement != none { + (: ..out, placement: placement) + } else { + out + } + let out = if scope != none { + (: ..out, scope: scope) + } else { + out + } + let out = if supplement != none { + (: ..out, supplement: supplement) + } else { + out + } + let out = if numbering != none { + (: ..out, numbering: numbering) + } else { + out + } + let out = if outlined != none { + (: ..out, outlined: outlined) + } else { + out + } + if gap != none { + (: ..out, gap: gap) + } else { + out + } +} + +#let mermaid-figure( + source, + caption: none, + document-context: false, + placement: none, + scope: none, + supplement: none, + numbering: none, + outlined: none, + gap: none, + caption-position: none, + caption-separator: none, + profile: none, + width: auto, + height: auto, + fit: "contain", + scale: none, + alt: none, + error-mode: "panic", + ..args, +) = { + let diagram = mermaid( + source, + profile: profile, + document-context: document-context, + width: width, + height: height, + fit: fit, + scale: scale, + alt: alt, + error-mode: error-mode, + ..args, + ) + let resolved-figure-options = build-figure-options( + profile, + caption, + placement, + scope, + supplement, + numbering, + outlined, + gap, + caption-position, + caption-separator, + ) + figure(diagram, ..resolved-figure-options) +} diff --git a/packages/preview/merman/0.4.0/src/image.typ b/packages/preview/merman/0.4.0/src/image.typ new file mode 100644 index 0000000000..69aa4137d2 --- /dev/null +++ b/packages/preview/merman/0.4.0/src/image.typ @@ -0,0 +1,50 @@ +#import "errors.typ": diagram-error, error-message + +#let scale-factor(factor) = { + if type(factor) == int or type(factor) == float { + factor * 100% + } else { + factor + } +} + +#let scaled(body, factor) = { + if factor == none { + body + } else { + scale(x: scale-factor(factor), y: scale-factor(factor), reflow: true, body) + } +} + +#let svg-bytes-or-panic(result) = { + if result.ok { + bytes(result.svg) + } else { + panic(error-message(result)) + } +} + +#let result-image( + result, + width, + height, + fit, + alt, + scale, + error-mode, +) = { + if result.ok { + scaled(image( + bytes(result.svg), + format: "svg", + width: width, + height: height, + fit: fit, + alt: alt, + ), scale) + } else if error-mode == "panic" { + panic(error-message(result)) + } else { + diagram-error(result, error-mode, width) + } +} diff --git a/packages/preview/merman/0.4.0/src/options.typ b/packages/preview/merman/0.4.0/src/options.typ new file mode 100644 index 0000000000..56a345d4b8 --- /dev/null +++ b/packages/preview/merman/0.4.0/src/options.typ @@ -0,0 +1,566 @@ +#import "units.typ": canonical-css-px-string, css-px-number-string, css-px-string + +#let dictionary-or-none(value, name) = { + if value == none { + none + } else if type(value) == dictionary { + value + } else { + panic(name + " must be a dictionary") + } +} + +#let profile-field(profile, key, alt: none) = { + let profile = dictionary-or-none(profile, "merman profile") + if profile == none { + none + } else if key in profile { + profile.at(key) + } else if alt != none and alt in profile { + profile.at(alt) + } else { + none + } +} + +#let choose-value(profile-value, direct-value, default: none) = { + if direct-value != none { + direct-value + } else if profile-value != none { + profile-value + } else { + default + } +} + +#let resolve-diagram-id(profile-id, profile-diagram-id, direct-id, direct-diagram-id) = { + if direct-diagram-id != none { + direct-diagram-id + } else if direct-id != none { + direct-id + } else if profile-diagram-id != none { + profile-diagram-id + } else { + profile-id + } +} + +#let merge-dict(base, override, name) = { + let base = dictionary-or-none(base, name) + let override = dictionary-or-none(override, name) + if base == none { + override + } else if override == none { + base + } else { + (: ..base, ..override) + } +} + +#let font-descriptor-name(font) = { + if type(font) == str { + font + } else if type(font) == dictionary { + if "name" not in font or type(font.at("name")) != str { + panic("merman typography font descriptor must contain a string name") + } + font.at("name") + } else { + panic("merman typography font must contain only strings or font descriptors") + } +} + +#let font-family-value(font) = { + if font == none { + none + } else if type(font) == array { + font.map(font-descriptor-name).join(", ") + } else { + font-descriptor-name(font) + } +} + +#let font-size-value(size) = { + if size == none { + none + } else if type(size) == str { + canonical-css-px-string(size, name: "merman typography size") + } else if type(size) == length { + css-px-string(size, name: "merman typography size") + } else if type(size) == int or type(size) == float { + css-px-number-string(size, name: "merman typography size") + } else { + panic("merman typography size must be a CSS px string, absolute Typst length, or pixel number") + } +} + +#let host-theme-from-font(font-family, font-size) = { + let family = font-family-value(font-family) + let size = font-size-value(font-size) + let out = if family == none { (:) } else { (font_family: family) } + let out = if size == none { out } else { (: ..out, font_size: size) } + if out.len() == 0 { + none + } else { + out + } +} + +#let context-host-theme(font-family, font-size) = { + host-theme-from-font(font-family, font-size) +} + +#let field3(dict, a, b, c) = { + if dict == none { + none + } else if a in dict { + dict.at(a) + } else if b in dict { + dict.at(b) + } else if c in dict { + dict.at(c) + } else { + none + } +} + +#let typography-host-theme(typography) = { + let typography = dictionary-or-none(typography, "merman typography") + if typography == none { + none + } else { + let allowed = ( + "font", + "font-family", + "font_family", + "size", + "font-size", + "font_size", + ) + for key in typography.keys() { + if not allowed.contains(key) { + panic("unsupported merman typography key: " + key) + } + } + host-theme-from-font( + field3(typography, "font", "font-family", "font_family"), + field3(typography, "size", "font-size", "font_size"), + ) + } +} + +#let merged-host-theme( + context-host-theme, + profile-typography, + profile-host-theme, + typography, + host-theme, +) = { + let out = context-host-theme + let out = merge-dict(out, typography-host-theme(profile-typography), "merman host-theme") + let out = merge-dict(out, profile-host-theme, "merman host-theme") + let out = merge-dict(out, typography-host-theme(typography), "merman host-theme") + merge-dict(out, host-theme, "merman host-theme") +} + +#let build-presentation-theme(theme) = { + let theme = dictionary-or-none(theme, "merman host-theme") + if theme == none { + none + } else { + let allowed = ( + "preset", + "appearance", + "font-family", + "font_family", + "font-size", + "font_size", + "roles", + "series-palette", + "series_palette", + ) + for key in theme.keys() { + if not allowed.contains(key) { + panic("unsupported merman host-theme key: " + key) + } + } + + let font-family = if "font-family" in theme { + theme.at("font-family") + } else if "font_family" in theme { + theme.at("font_family") + } else { + none + } + let font-size = if "font-size" in theme { + theme.at("font-size") + } else if "font_size" in theme { + theme.at("font_size") + } else { + none + } + let series-palette = if "series-palette" in theme { + theme.at("series-palette") + } else if "series_palette" in theme { + theme.at("series_palette") + } else { + none + } + + let out = (:) + let out = if "preset" in theme and theme.at("preset") != none { + (: ..out, preset: theme.at("preset")) + } else { + out + } + let out = if "appearance" in theme and theme.at("appearance") != none { + (: ..out, appearance: theme.at("appearance")) + } else { + out + } + let out = if font-family != none { (: ..out, font_family: font-family) } else { out } + let out = if font-size != none { (: ..out, font_size: font-size) } else { out } + let out = if "roles" in theme and theme.at("roles") != none { + (: ..out, roles: theme.at("roles")) + } else { + out + } + let out = if series-palette != none { + (: ..out, series_palette: series-palette) + } else { + out + } + if out.len() == 0 { none } else { out } + } +} + +#let build-presentation-options(profile, theme) = { + let theme = build-presentation-theme(theme) + let out = if profile == none { (:) } else { (profile: profile) } + let out = if theme == none { out } else { (: ..out, theme: theme) } + if out.len() == 0 { none } else { out } +} + +#let apply-theme-site-config(site-config, theme, theme-name, base-theme) = { + let theme-name = choose-value(base-theme, theme-name) + if theme == none and theme-name == none { + dictionary-or-none(site-config, "merman site-config") + } else { + let out = if site-config == none { + (:) + } else { + dictionary-or-none(site-config, "merman site-config") + } + let out = if theme-name != none { + (: ..out, theme: theme-name) + } else { + out + } + if theme != none { + (: ..out, themeVariables: theme) + } else { + out + } + } +} + +#let build-layout-options( + layout, + container-width, + container-height, + base-layout: none, +) = { + if layout != none { + layout + } else { + let out = if base-layout != none { + dictionary-or-none(base-layout, "merman layout") + } else { + (:) + } + let out = if container-width != none { + (: ..out, container_width: container-width) + } else { + out + } + let out = if container-height != none { + (: ..out, container_height: container-height) + } else { + out + } + out + } +} + +#let layout-container-width(layout) = { + let layout = dictionary-or-none(layout, "merman layout") + if layout != none and "container_width" in layout { + layout.at("container_width") + } else { + none + } +} + +#let build-environment-options( + environment, + text-measurement, + math-renderer, + base-environment: none, +) = { + let out = merge-dict(base-environment, environment, "merman environment") + let out = if text-measurement != none { + let out = if out == none { (:) } else { out } + (: ..out, text_measurement: text-measurement) + } else { + out + } + if math-renderer != none { + let out = if out == none { (:) } else { out } + (: ..out, math_renderer: math-renderer) + } else { + out + } +} + +#let mermaid-profile( + options: none, + site-config: none, + presentation-profile: none, + host-theme: none, + typography: none, + theme: none, + theme-name: none, + base-theme: none, + pipeline: none, + id: none, + diagram-id: none, + background: none, + layout: none, + environment: none, + scoped-css: none, + css-override-policy: none, + drop-native-duplicate-fallbacks: none, + text-measurement: none, + math-renderer: none, + container-width: none, + container-height: none, + fixed-today: none, + fixed-local-offset-minutes: none, + figure: none, +) = { + ( + options: options, + site-config: site-config, + presentation-profile: presentation-profile, + host-theme: host-theme, + typography: typography, + theme: theme, + theme-name: theme-name, + base-theme: base-theme, + pipeline: pipeline, + id: id, + diagram-id: diagram-id, + background: background, + layout: layout, + environment: environment, + scoped-css: scoped-css, + css-override-policy: css-override-policy, + drop-native-duplicate-fallbacks: drop-native-duplicate-fallbacks, + text-measurement: text-measurement, + math-renderer: math-renderer, + container-width: container-width, + container-height: container-height, + fixed-today: fixed-today, + fixed-local-offset-minutes: fixed-local-offset-minutes, + figure: figure, + ) +} + +#let opaque-render-config(binding-options, direct-options: none, profile-options: none) = { + ( + binding_options: binding-options, + direct_layout: none, + direct_options: direct-options, + direct_container_width: none, + profile_layout: none, + profile_layout_container_width: none, + profile_options: profile-options, + ) +} + +#let render-config( + options: none, + profile: none, + typography: none, + context-host-theme: none, + site-config: none, + presentation-profile: none, + host-theme: none, + theme: none, + theme-name: none, + base-theme: none, + pipeline: none, + id: none, + diagram-id: none, + background: none, + layout: none, + environment: none, + scoped-css: none, + css-override-policy: none, + drop-native-duplicate-fallbacks: none, + text-measurement: none, + math-renderer: none, + container-width: none, + container-height: none, + fixed-today: none, + fixed-local-offset-minutes: none, +) = { + if options != none { + opaque-render-config(options, direct-options: options) + } else { + let profile-options = profile-field(profile, "options") + if profile-options != none { + opaque-render-config(profile-options, profile-options: profile-options) + } else { + let profile-site-config = profile-field(profile, "site-config", alt: "site_config") + let profile-presentation-profile = profile-field(profile, "presentation-profile") + let profile-host-theme = profile-field(profile, "host-theme") + let profile-typography = profile-field(profile, "typography") + let profile-layout = profile-field(profile, "layout") + let profile-layout-container-width = layout-container-width(profile-layout) + let profile-environment = profile-field(profile, "environment") + let profile-text-measurement = profile-field(profile, "text-measurement") + let profile-math-renderer = profile-field(profile, "math-renderer") + + let profile-site-config = apply-theme-site-config( + profile-site-config, + profile-field(profile, "theme"), + profile-field(profile, "theme-name", alt: "theme_name"), + profile-field(profile, "base-theme", alt: "base_theme"), + ) + let site-config = if site-config == none { + profile-site-config + } else { + dictionary-or-none(site-config, "merman site-config") + } + let site-config = apply-theme-site-config(site-config, theme, theme-name, base-theme) + let pipeline = choose-value(profile-field(profile, "pipeline"), pipeline, default: "resvg-safe") + let profile-id = profile-field(profile, "id") + let profile-diagram-id = profile-field(profile, "diagram-id", alt: "diagram_id") + let background = choose-value(profile-field(profile, "background"), background) + let scoped-css = choose-value(profile-field(profile, "scoped-css", alt: "scoped_css"), scoped-css) + let css-override-policy = choose-value( + profile-field(profile, "css-override-policy", alt: "css_override_policy"), + css-override-policy, + ) + let drop-native-duplicate-fallbacks = choose-value( + profile-field( + profile, + "drop-native-duplicate-fallbacks", + alt: "drop_native_duplicate_fallbacks", + ), + drop-native-duplicate-fallbacks, + ) + let container-width = choose-value( + profile-field(profile, "container-width", alt: "container_width"), + container-width, + ) + let container-height = choose-value( + profile-field(profile, "container-height", alt: "container_height"), + container-height, + ) + let fixed-today = choose-value(profile-field(profile, "fixed-today", alt: "fixed_today"), fixed-today) + let fixed-local-offset-minutes = choose-value( + profile-field(profile, "fixed-local-offset-minutes", alt: "fixed_local_offset_minutes"), + fixed-local-offset-minutes, + ) + let presentation-profile = choose-value(profile-presentation-profile, presentation-profile) + + let host-theme = merged-host-theme( + context-host-theme, + profile-typography, + profile-host-theme, + typography, + host-theme, + ) + let presentation = build-presentation-options(presentation-profile, host-theme) + + let binding-options = ( + version: 2, + fixed_today: fixed-today, + fixed_local_offset_minutes: fixed-local-offset-minutes, + site_config: site-config, + layout: build-layout-options( + layout, + container-width, + container-height, + base-layout: profile-layout, + ), + environment: build-environment-options( + environment, + text-measurement, + math-renderer, + base-environment: build-environment-options( + profile-environment, + profile-text-measurement, + profile-math-renderer, + ), + ), + svg: ( + diagram_id: resolve-diagram-id( + profile-id, + profile-diagram-id, + id, + diagram-id, + ), + pipeline: pipeline, + root_background_color: background, + scoped_css: scoped-css, + css_override_policy: css-override-policy, + drop_native_duplicate_fallbacks: drop-native-duplicate-fallbacks, + ), + ) + let binding-options = if presentation == none { + binding-options + } else { + (: ..binding-options, presentation: presentation) + } + ( + binding_options: binding-options, + direct_layout: layout, + direct_options: none, + direct_container_width: container-width, + profile_layout: profile-layout, + profile_layout_container_width: profile-layout-container-width, + profile_options: none, + ) + } + } +} + +#let config-with-context-width(config, width) = { + if width == none or config.direct_layout != none or config.direct_container_width != none or config.direct_options != none or config.profile_options != none or config.profile_layout_container_width != none { + config + } else { + let binding-options = config.binding_options + let layout = build-layout-options( + none, + width, + none, + base-layout: config.profile_layout, + ) + (: ..config, binding_options: (: ..binding-options, layout: layout)) + } +} + +#let build-binding-options(..args) = { + render-config(..args).binding_options +} + +#let options-bytes(options) = { + if options == none { + bytes(()) + } else { + bytes(json.encode(options)) + } +} diff --git a/packages/preview/merman/0.4.0/src/plugin.typ b/packages/preview/merman/0.4.0/src/plugin.typ new file mode 100644 index 0000000000..0d06b72710 --- /dev/null +++ b/packages/preview/merman/0.4.0/src/plugin.typ @@ -0,0 +1 @@ +#let merman-plugin = plugin("../merman_typst_plugin.wasm") diff --git a/packages/preview/merman/0.4.0/src/raw.typ b/packages/preview/merman/0.4.0/src/raw.typ new file mode 100644 index 0000000000..e2ec98c6c8 --- /dev/null +++ b/packages/preview/merman/0.4.0/src/raw.typ @@ -0,0 +1,22 @@ +#import "render.typ": mermaid + +#let show-mermaid-blocks( + document-context: false, + width: 100%, + height: auto, + fit: "contain", + scale: none, + alt: none, + error-mode: "placeholder", + ..args, +) = block => mermaid( + block.text, + document-context: document-context, + width: width, + height: height, + fit: fit, + scale: scale, + alt: alt, + error-mode: error-mode, + ..args, +) diff --git a/packages/preview/merman/0.4.0/src/render.typ b/packages/preview/merman/0.4.0/src/render.typ new file mode 100644 index 0000000000..5e0b624fdf --- /dev/null +++ b/packages/preview/merman/0.4.0/src/render.typ @@ -0,0 +1,137 @@ +#import "context.typ": typst-layout +#import "errors.typ": validate-error-mode +#import "image.typ": result-image, svg-bytes-or-panic +#import "options.typ": config-with-context-width, context-host-theme, options-bytes, render-config +#import "plugin.typ": merman-plugin +#import "source.typ": source-text-value +#import "units.typ": context-width-css-px + +#let render-svg-result-with-config(source, config) = { + let source-text = source-text-value(source) + let envelope = json( + merman-plugin.render_svg_json(bytes(source-text), options-bytes(config.binding_options)), + ) + if envelope.operation != "render-svg" { + panic("merman Typst plugin returned an unexpected render operation") + } + ( + version: envelope.version, + operation: envelope.operation, + ok: envelope.ok, + code: envelope.code, + code_name: envelope.code_name, + kind: envelope.kind, + capability_id: envelope.capability_id, + message: envelope.message, + details: if "details" in envelope { envelope.details } else { none }, + svg: if envelope.ok { envelope.data.svg } else { none }, + ) +} + +#let render-svg-result(source, ..args) = { + render-svg-result-with-config(source, render-config(..args)) +} + +#let render-svg-bytes(..args) = { + svg-bytes-or-panic(render-svg-result(..args)) +} + +#let analyze-payload-with-config(source, config) = { + let source-text = source-text-value(source) + let envelope = json( + merman-plugin.analyze_json(bytes(source-text), options-bytes(config.binding_options)), + ) + if envelope.operation != "analyze" { + panic("merman Typst plugin returned an unexpected analysis operation") + } + if envelope.ok { envelope.data.analysis } else { envelope } +} + +#let analyze-payload(source, ..args) = { + analyze-payload-with-config(source, render-config(..args)) +} + +#let mermaid-result(source, ..args) = render-svg-result(source, ..args) + +#let mermaid-svg(source, ..args) = { + str(render-svg-bytes(source, ..args)) +} + +#let analyze-mermaid(source, ..args) = analyze-payload(source, ..args) + +#let render-image( + source, + width: auto, + height: auto, + fit: "contain", + scale: none, + alt: none, + error-mode: "panic", + ..args, +) = { + let result = render-svg-result(source, ..args) + result-image(result, width, height, fit, alt, scale, error-mode) +} + +#let render-image-with-document-context( + source, + width: auto, + height: auto, + fit: "contain", + scale: none, + alt: none, + error-mode: "panic", + ..args, +) = context { + let inferred-host-theme = context-host-theme(text.font, text.size) + let base-config = render-config(context-host-theme: inferred-host-theme, ..args) + if base-config.direct_layout != none or base-config.direct_container_width != none or base-config.direct_options != none or base-config.profile_options != none or base-config.profile_layout_container_width != none { + let result = render-svg-result-with-config(source, base-config) + result-image(result, width, height, fit, alt, scale, error-mode) + } else { + typst-layout(size => { + let result = render-svg-result-with-config( + source, + config-with-context-width(base-config, context-width-css-px(size.width)), + ) + result-image(result, width, height, fit, alt, scale, error-mode) + }) + } +} + +#let mermaid( + source, + document-context: false, + width: auto, + height: auto, + fit: "contain", + scale: none, + alt: none, + error-mode: "panic", + ..args, +) = { + let error-mode = validate-error-mode(error-mode) + if document-context { + render-image-with-document-context( + source, + width: width, + height: height, + fit: fit, + scale: scale, + alt: alt, + error-mode: error-mode, + ..args, + ) + } else { + render-image( + source, + width: width, + height: height, + fit: fit, + scale: scale, + alt: alt, + error-mode: error-mode, + ..args, + ) + } +} diff --git a/packages/preview/merman/0.4.0/src/source.typ b/packages/preview/merman/0.4.0/src/source.typ new file mode 100644 index 0000000000..fcc8c09750 --- /dev/null +++ b/packages/preview/merman/0.4.0/src/source.typ @@ -0,0 +1,7 @@ +#let source-text-value(source) = { + if type(source) == str { + source + } else { + source.text + } +} diff --git a/packages/preview/merman/0.4.0/src/units.typ b/packages/preview/merman/0.4.0/src/units.typ new file mode 100644 index 0000000000..f1a7c3ab37 --- /dev/null +++ b/packages/preview/merman/0.4.0/src/units.typ @@ -0,0 +1,51 @@ +#let css-pixels-per-point = 96 / 72 + +#let typst-length-to-css-px(value, name: "merman length", allow-infinite: false) = { + if type(value) != length { + panic(name + " must be a Typst length") + } + + let points = value.pt() + if float.is-nan(points) { + panic(name + " must not be NaN") + } else if float.is-infinite(points) { + if allow-infinite { + none + } else { + panic(name + " must be finite") + } + } else { + let pixels = points * css-pixels-per-point + if pixels <= 0 { + panic(name + " must be positive") + } + pixels + } +} + +#let css-px-number-string(value, name: "merman CSS pixel value") = { + if (type(value) != int and type(value) != float) or float.is-nan(value) or float.is-infinite(value) or value <= 0 { + panic(name + " must be positive and finite") + } + str(value) + "px" +} + +#let canonical-css-px-string(value, name: "merman CSS pixel value") = { + let value = value.trim() + if not value.ends-with("px") { + panic(name + " must use CSS px units") + } + css-px-number-string(float(value.slice(0, -2).trim()), name: name) +} + +#let context-width-css-px(width) = { + typst-length-to-css-px( + width, + name: "merman document context width", + allow-infinite: true, + ) +} + +#let css-px-string(value, name: "merman length") = { + css-px-number-string(typst-length-to-css-px(value, name: name), name: name) +} diff --git a/packages/preview/merman/0.4.0/typst.toml b/packages/preview/merman/0.4.0/typst.toml new file mode 100644 index 0000000000..d156502f35 --- /dev/null +++ b/packages/preview/merman/0.4.0/typst.toml @@ -0,0 +1,12 @@ +[package] +name = "merman" +version = "0.4.0" +entrypoint = "lib.typ" +compiler = "0.15.0" +authors = ["Mingzhen Zhuang <@Latias94>"] +license = "MIT OR Apache-2.0" +description = "Render Mermaid diagrams as SVG." +repository = "https://github.com/Latias94/merman" +keywords = ["mermaid", "diagrams", "svg", "wasm"] +categories = ["visualization", "integration"] +exclude = ["examples/**"]