@lofcz/streamdown-ascii 0.0.0-bootstrap.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2023 Vercel, Inc.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
@@ -0,0 +1,66 @@
1
+ import type { ComponentType } from "react";
2
+ /**
3
+ * Props passed to the ASCII renderer component.
4
+ */
5
+ export interface AsciiRendererProps {
6
+ /**
7
+ * The raw text content inside the code fence
8
+ */
9
+ code: string;
10
+ /**
11
+ * `true` while the code fence is still being streamed
12
+ */
13
+ isIncomplete: boolean;
14
+ /**
15
+ * The language identifier from the code fence
16
+ */
17
+ language: string;
18
+ /**
19
+ * Raw metastring from the code fence, if present
20
+ */
21
+ meta?: string;
22
+ }
23
+ /**
24
+ * Options for creating an ASCII plugin
25
+ */
26
+ export interface AsciiPluginOptions {
27
+ /**
28
+ * Extra class names applied to the rendered `<pre>` element
29
+ */
30
+ className?: string;
31
+ /**
32
+ * Override the monospace font stack used for the rendered block
33
+ * @default 'ui-monospace, "SF Mono", "Cascadia Mono", "DejaVu Sans Mono", "Liberation Mono", Menlo, Consolas, monospace'
34
+ */
35
+ fontFamily?: string;
36
+ /**
37
+ * Code fence languages bound to this renderer
38
+ * @default ["ascii", "diagram", "chart"]
39
+ */
40
+ languages?: string[];
41
+ }
42
+ /**
43
+ * Plugin for rendering ASCII / Unicode box-drawing diagrams.
44
+ *
45
+ * Structurally compatible with Streamdown's `CustomRenderer` type, so it can
46
+ * be passed directly into `plugins.renderers` without a core dependency on
47
+ * this package.
48
+ */
49
+ export interface AsciiPlugin {
50
+ /**
51
+ * The React component that renders matching code fences
52
+ */
53
+ component: ComponentType<AsciiRendererProps>;
54
+ /**
55
+ * Code fence languages bound to this renderer
56
+ */
57
+ language: string[];
58
+ }
59
+ /**
60
+ * Create an ASCII plugin with optional configuration
61
+ */
62
+ export declare function createAsciiPlugin(options?: AsciiPluginOptions): AsciiPlugin;
63
+ /**
64
+ * Pre-configured ASCII plugin with default settings
65
+ */
66
+ export declare const ascii: AsciiPlugin;
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ import {jsx}from'react/jsx-runtime';var s='ui-monospace, "SF Mono", "Cascadia Mono", "DejaVu Sans Mono", "Liberation Mono", Menlo, Consolas, monospace',r=["ascii","diagram","chart"],c=(e,a)=>{let n=({code:i,isIncomplete:t,language:o})=>jsx("pre",{className:a,"data-incomplete":t,"data-language":o,"data-streamdown":"ascii-block",style:{fontFamily:e,fontFeatureSettings:'"liga" 0, "calt" 0',fontVariantLigatures:"none",overflowX:"auto",tabSize:2,whiteSpace:"pre"},children:i});return n.displayName="AsciiRenderer",n};function g(e={}){var i,t;let a=(i=e.fontFamily)!=null?i:s,n=(t=e.languages)!=null?t:r;return {component:c(a,e.className),language:n}}var u=g();export{u as ascii,g as createAsciiPlugin};
package/package.json CHANGED
@@ -1,11 +1,48 @@
1
1
  {
2
2
  "name": "@lofcz/streamdown-ascii",
3
- "version": "0.0.0-bootstrap.0",
4
- "description": "ASCII and Unicode box-drawing diagram rendering plugin for Streamdown (name claim — real releases are published from CI via npm trusted publishing)",
3
+ "version": "1.1.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "peerDependencies": {
18
+ "react": "^18.0.0 || ^19.0.0"
19
+ },
20
+ "devDependencies": {
21
+ "@testing-library/react": "^16.3.2",
22
+ "@types/react": "^19.2.7",
23
+ "@types/react-dom": "^19.2.3",
24
+ "@vitejs/plugin-react": "^5.1.2",
25
+ "@vitest/coverage-v8": "^4.1.10",
26
+ "jsdom": "^27.3.0",
27
+ "react-dom": "^19.2.3",
28
+ "tsup": "^8.5.1",
29
+ "typescript": "^7.0.2",
30
+ "vitest": "^4.1.10"
31
+ },
32
+ "author": "Hayden Bleasel <hayden.bleasel@vercel.com>",
5
33
  "license": "Apache-2.0",
34
+ "description": "ASCII and Unicode box-drawing diagram rendering plugin for Streamdown",
6
35
  "repository": {
7
36
  "type": "git",
8
37
  "url": "git+https://github.com/lofcz/streamdown-ng.git",
9
38
  "directory": "packages/streamdown-ascii"
39
+ },
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "scripts": {
44
+ "build": "node scripts/build.mjs",
45
+ "test": "vitest run",
46
+ "test:coverage": "vitest --coverage run"
10
47
  }
11
- }
48
+ }
package/README.md DELETED
@@ -1,5 +0,0 @@
1
- # @lofcz/streamdown-ascii
2
-
3
- This version (`0.0.0-bootstrap.0`, dist-tag `bootstrap`) is a name claim so npm
4
- trusted publishing can be attached to the package. Real releases are published
5
- from CI: https://github.com/lofcz/streamdown-ng (packages/streamdown-ascii).