@markii/ansi 0.0.1
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/dist/ansi.d.ts +79 -0
- package/dist/ansi.js +136 -0
- package/dist/box.d.ts +47 -0
- package/dist/box.js +209 -0
- package/dist/components/badge.d.ts +10 -0
- package/dist/components/badge.js +44 -0
- package/dist/components/callout.d.ts +20 -0
- package/dist/components/callout.js +71 -0
- package/dist/components/card.d.ts +12 -0
- package/dist/components/card.js +44 -0
- package/dist/components/cell.d.ts +18 -0
- package/dist/components/cell.js +31 -0
- package/dist/components/chart.d.ts +15 -0
- package/dist/components/chart.js +129 -0
- package/dist/components/details.d.ts +12 -0
- package/dist/components/details.js +25 -0
- package/dist/components/divider.d.ts +4 -0
- package/dist/components/divider.js +80 -0
- package/dist/components/figure.d.ts +20 -0
- package/dist/components/figure.js +53 -0
- package/dist/components/index.d.ts +34 -0
- package/dist/components/index.js +109 -0
- package/dist/components/kbd.d.ts +7 -0
- package/dist/components/kbd.js +8 -0
- package/dist/components/layout-wrapper.d.ts +35 -0
- package/dist/components/layout-wrapper.js +62 -0
- package/dist/components/progress.d.ts +15 -0
- package/dist/components/progress.js +78 -0
- package/dist/components/rating.d.ts +9 -0
- package/dist/components/rating.js +28 -0
- package/dist/components/row.d.ts +26 -0
- package/dist/components/row.js +67 -0
- package/dist/components/stat.d.ts +13 -0
- package/dist/components/stat.js +79 -0
- package/dist/components/tab.d.ts +13 -0
- package/dist/components/tab.js +17 -0
- package/dist/components/table-grid.d.ts +34 -0
- package/dist/components/table-grid.js +124 -0
- package/dist/components/table.d.ts +16 -0
- package/dist/components/table.js +101 -0
- package/dist/components/tabs.d.ts +18 -0
- package/dist/components/tabs.js +30 -0
- package/dist/failure-presentation.d.ts +58 -0
- package/dist/failure-presentation.js +124 -0
- package/dist/href-resolve.d.ts +21 -0
- package/dist/href-resolve.js +25 -0
- package/dist/image-resolve.d.ts +41 -0
- package/dist/image-resolve.js +28 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +17 -0
- package/dist/layout.d.ts +73 -0
- package/dist/layout.js +144 -0
- package/dist/measure.d.ts +25 -0
- package/dist/measure.js +108 -0
- package/dist/registry.d.ts +227 -0
- package/dist/registry.js +121 -0
- package/dist/render.d.ts +69 -0
- package/dist/render.js +889 -0
- package/dist/resolve.d.ts +60 -0
- package/dist/resolve.js +152 -0
- package/dist/sanitize.d.ts +51 -0
- package/dist/sanitize.js +101 -0
- package/dist/style.d.ts +9 -0
- package/dist/style.js +13 -0
- package/dist/theme.d.ts +36 -0
- package/dist/theme.js +79 -0
- package/dist/url-resolve.d.ts +54 -0
- package/dist/url-resolve.js +82 -0
- package/dist/value-format.d.ts +13 -0
- package/dist/value-format.js +16 -0
- package/dist/value-types.d.ts +37 -0
- package/dist/value-types.js +17 -0
- package/package.json +61 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { formatValue } from '@markii/stdlib';
|
|
2
|
+
/**
|
|
3
|
+
* A thin, unformatted wrapper around `@markii/stdlib`'s `formatValue`
|
|
4
|
+
* (called with no `format`, i.e. `'plain'`), mirroring `@markii/html`'s
|
|
5
|
+
* `stringifyStoredValue`: this engine's name for "the `:value[...]`
|
|
6
|
+
* default coercion", used wherever a caller has no `format=`/`decimals=`
|
|
7
|
+
* attribute to thread through. Every engine's `:value[...]` and every
|
|
8
|
+
* `format=`-aware component calls `formatValue` directly instead, so a
|
|
9
|
+
* number, date, or percentage reads identically across all three
|
|
10
|
+
* (docs/format.md).
|
|
11
|
+
*
|
|
12
|
+
* Never throws, for the same reason `formatValue` itself never throws.
|
|
13
|
+
*/
|
|
14
|
+
export function stringifyStoredValue(value) {
|
|
15
|
+
return formatValue(value);
|
|
16
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@markii/ansi`'s own structural view of `@markii/runtime`'s value-store
|
|
3
|
+
* contract. This package's dependency list is deliberately minimal (exactly
|
|
4
|
+
* `@markii/core` and `@markii/stdlib`; see AGENTS.md and the batch brief),
|
|
5
|
+
* so it never imports `@markii/runtime` at runtime: declaring the shapes it
|
|
6
|
+
* needs here, rather than importing them, keeps a terminal render usable in
|
|
7
|
+
* a context that never pulled in the runtime package at all (a CLI that
|
|
8
|
+
* hands this engine values it read out of a bundle's cache directly, say).
|
|
9
|
+
*
|
|
10
|
+
* A real `@markii/runtime` `ValueStore`/`VaultStore` satisfies these
|
|
11
|
+
* interfaces structurally (TypeScript's structural typing needs no explicit
|
|
12
|
+
* relationship declared), so a host that already has one passes it straight
|
|
13
|
+
* in with no adapter. `value-types.drift.test.ts` is what keeps this copy
|
|
14
|
+
* honest: it imports the real runtime types as a devDependency, test-only,
|
|
15
|
+
* and fails if the two shapes ever diverge.
|
|
16
|
+
*/
|
|
17
|
+
/** Freshness of one stored value. Mirrors `@markii/runtime`'s `ValueStatus` exactly. */
|
|
18
|
+
export type ValueStatus = 'fresh' | 'stale' | 'error' | 'missing';
|
|
19
|
+
/** The closed script-failure taxonomy. Mirrors `@markii/runtime`'s `FailureKind` exactly. */
|
|
20
|
+
export type FailureKind = 'script-error' | 'capability-denied' | 'tier-blocked' | 'limit';
|
|
21
|
+
/** One named value plus its freshness bookkeeping. Mirrors `@markii/runtime`'s `StoredValue`'s readable fields. */
|
|
22
|
+
export interface StoredValue {
|
|
23
|
+
value: unknown;
|
|
24
|
+
status: ValueStatus;
|
|
25
|
+
error?: string;
|
|
26
|
+
failureKind?: FailureKind;
|
|
27
|
+
}
|
|
28
|
+
/** The read-only view this engine needs of a note's value store. A real `ValueStore` satisfies this structurally. */
|
|
29
|
+
export interface AnsiValueStore {
|
|
30
|
+
get(name: string): StoredValue | undefined;
|
|
31
|
+
has(name: string): boolean;
|
|
32
|
+
}
|
|
33
|
+
/** The read-only view this engine needs of the vault (cross-note) store. A real `VaultStore` satisfies this structurally. */
|
|
34
|
+
export interface AnsiVaultStore {
|
|
35
|
+
get(name: string): StoredValue | undefined;
|
|
36
|
+
has(name: string): boolean;
|
|
37
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@markii/ansi`'s own structural view of `@markii/runtime`'s value-store
|
|
3
|
+
* contract. This package's dependency list is deliberately minimal (exactly
|
|
4
|
+
* `@markii/core` and `@markii/stdlib`; see AGENTS.md and the batch brief),
|
|
5
|
+
* so it never imports `@markii/runtime` at runtime: declaring the shapes it
|
|
6
|
+
* needs here, rather than importing them, keeps a terminal render usable in
|
|
7
|
+
* a context that never pulled in the runtime package at all (a CLI that
|
|
8
|
+
* hands this engine values it read out of a bundle's cache directly, say).
|
|
9
|
+
*
|
|
10
|
+
* A real `@markii/runtime` `ValueStore`/`VaultStore` satisfies these
|
|
11
|
+
* interfaces structurally (TypeScript's structural typing needs no explicit
|
|
12
|
+
* relationship declared), so a host that already has one passes it straight
|
|
13
|
+
* in with no adapter. `value-types.drift.test.ts` is what keeps this copy
|
|
14
|
+
* honest: it imports the real runtime types as a devDependency, test-only,
|
|
15
|
+
* and fails if the two shapes ever diverge.
|
|
16
|
+
*/
|
|
17
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@markii/ansi",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "A framework-free terminal renderer for Markii (.mk.md): a registry-driven hast-to-ANSI-text engine. Zero React; for a terminal, a pipe, or any host that wants a plain string with optional color.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"markdown",
|
|
7
|
+
"markii",
|
|
8
|
+
"mk.md",
|
|
9
|
+
"ansi",
|
|
10
|
+
"terminal",
|
|
11
|
+
"renderer",
|
|
12
|
+
"cli",
|
|
13
|
+
"directive"
|
|
14
|
+
],
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"author": "sadigaxund",
|
|
17
|
+
"homepage": "https://github.com/markii-org/markii#readme",
|
|
18
|
+
"bugs": "https://github.com/markii-org/markii/issues",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/markii-org/markii.git",
|
|
22
|
+
"directory": "packages/platforms/markii-ansi"
|
|
23
|
+
},
|
|
24
|
+
"type": "module",
|
|
25
|
+
"main": "./dist/index.js",
|
|
26
|
+
"module": "./dist/index.js",
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"import": "./dist/index.js",
|
|
32
|
+
"default": "./dist/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./components": {
|
|
35
|
+
"types": "./dist/components/index.d.ts",
|
|
36
|
+
"import": "./dist/components/index.js",
|
|
37
|
+
"default": "./dist/components/index.js"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist"
|
|
42
|
+
],
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"test": "vitest run",
|
|
48
|
+
"build": "tsc --noEmit -p tsconfig.json",
|
|
49
|
+
"build:dist": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
50
|
+
"lint": "eslint .",
|
|
51
|
+
"regenerate:fixtures": "npm run build:dist && node scripts/regenerate-ansi-fixtures.ts"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@markii/core": "^0.15.0",
|
|
55
|
+
"@markii/stdlib": "^0.15.0"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@types/hast": "^3.0.4",
|
|
59
|
+
"@markii/runtime": "^0.15.0"
|
|
60
|
+
}
|
|
61
|
+
}
|