@markii/html 0.6.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.
Files changed (55) hide show
  1. package/dist/components/badge.d.ts +9 -0
  2. package/dist/components/badge.js +24 -0
  3. package/dist/components/callout.d.ts +10 -0
  4. package/dist/components/callout.js +29 -0
  5. package/dist/components/card.d.ts +9 -0
  6. package/dist/components/card.js +15 -0
  7. package/dist/components/cell.d.ts +9 -0
  8. package/dist/components/cell.js +10 -0
  9. package/dist/components/chart.d.ts +15 -0
  10. package/dist/components/chart.js +158 -0
  11. package/dist/components/details.d.ts +10 -0
  12. package/dist/components/details.js +16 -0
  13. package/dist/components/figure.d.ts +18 -0
  14. package/dist/components/figure.js +28 -0
  15. package/dist/components/index.d.ts +27 -0
  16. package/dist/components/index.js +91 -0
  17. package/dist/components/kbd.d.ts +7 -0
  18. package/dist/components/kbd.js +8 -0
  19. package/dist/components/layout-wrapper.d.ts +23 -0
  20. package/dist/components/layout-wrapper.js +45 -0
  21. package/dist/components/progress.d.ts +13 -0
  22. package/dist/components/progress.js +79 -0
  23. package/dist/components/rating.d.ts +9 -0
  24. package/dist/components/rating.js +33 -0
  25. package/dist/components/row.d.ts +9 -0
  26. package/dist/components/row.js +19 -0
  27. package/dist/components/stat.d.ts +18 -0
  28. package/dist/components/stat.js +81 -0
  29. package/dist/components/tab.d.ts +18 -0
  30. package/dist/components/tab.js +19 -0
  31. package/dist/components/tabs.d.ts +30 -0
  32. package/dist/components/tabs.js +33 -0
  33. package/dist/doc-css.generated.d.ts +2 -0
  34. package/dist/doc-css.generated.js +5 -0
  35. package/dist/document.d.ts +42 -0
  36. package/dist/document.js +44 -0
  37. package/dist/escape.d.ts +7 -0
  38. package/dist/escape.js +23 -0
  39. package/dist/failure-presentation.d.ts +14 -0
  40. package/dist/failure-presentation.js +56 -0
  41. package/dist/index.d.ts +8 -0
  42. package/dist/index.js +13 -0
  43. package/dist/layout.d.ts +31 -0
  44. package/dist/layout.js +75 -0
  45. package/dist/registry.d.ts +139 -0
  46. package/dist/registry.js +118 -0
  47. package/dist/render.d.ts +34 -0
  48. package/dist/render.js +417 -0
  49. package/dist/resolve.d.ts +59 -0
  50. package/dist/resolve.js +154 -0
  51. package/dist/test/html-context.d.ts +9 -0
  52. package/dist/test/html-context.js +21 -0
  53. package/dist/value-format.d.ts +12 -0
  54. package/dist/value-format.js +41 -0
  55. package/package.json +64 -0
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Ported from `@markii/react`'s `components/value-directive.tsx`: coerces a
3
+ * resolved store value to display text for `:value[...]`. Kept as its own
4
+ * tiny module because it has no dependency on hast/registry types and is
5
+ * useful in isolation (colocated test).
6
+ */
7
+ /**
8
+ * `String(value)` for a value that may be actively hostile — a revoked
9
+ * `Proxy`, an object with a throwing `toString`/`Symbol.toPrimitive`, an
10
+ * `Object.create(null)` with no `toString` at all. Degrades to the empty
11
+ * string rather than throwing.
12
+ */
13
+ function safeString(value) {
14
+ try {
15
+ return String(value);
16
+ }
17
+ catch {
18
+ return '';
19
+ }
20
+ }
21
+ /**
22
+ * Coerces a stored value to display text. Objects/arrays render as JSON;
23
+ * `null`/`undefined` render as an empty string. Never throws for any stored
24
+ * value.
25
+ */
26
+ export function stringifyStoredValue(value) {
27
+ if (typeof value === 'string')
28
+ return value;
29
+ if (value === null || value === undefined)
30
+ return '';
31
+ if (typeof value === 'number' || typeof value === 'boolean') {
32
+ return String(value);
33
+ }
34
+ try {
35
+ const json = JSON.stringify(value);
36
+ return json ?? '';
37
+ }
38
+ catch {
39
+ return safeString(value);
40
+ }
41
+ }
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@markii/html",
3
+ "version": "0.6.0",
4
+ "description": "A framework-free static HTML renderer for Markii (.mk.md): a registry-driven hast-to-HTML string engine. Zero React; for stopped-changing documents (publish, CI, email, archive).",
5
+ "keywords": [
6
+ "markdown",
7
+ "markii",
8
+ "mk.md",
9
+ "html",
10
+ "renderer",
11
+ "static",
12
+ "directive"
13
+ ],
14
+ "license": "MIT",
15
+ "author": "sadigaxund",
16
+ "homepage": "https://github.com/sadigaxund/markii#readme",
17
+ "bugs": "https://github.com/sadigaxund/markii/issues",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/sadigaxund/markii.git",
21
+ "directory": "packages/platforms/markii-html"
22
+ },
23
+ "type": "module",
24
+ "main": "./dist/index.js",
25
+ "module": "./dist/index.js",
26
+ "types": "./dist/index.d.ts",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "import": "./dist/index.js",
31
+ "default": "./dist/index.js"
32
+ },
33
+ "./components": {
34
+ "types": "./dist/components/index.d.ts",
35
+ "import": "./dist/components/index.js",
36
+ "default": "./dist/components/index.js"
37
+ }
38
+ },
39
+ "files": [
40
+ "dist"
41
+ ],
42
+ "publishConfig": {
43
+ "access": "public"
44
+ },
45
+ "scripts": {
46
+ "generate:doc-css": "node scripts/generate-doc-css.ts",
47
+ "pretest": "npm run generate:doc-css",
48
+ "test": "vitest run",
49
+ "prebuild": "npm run generate:doc-css",
50
+ "build": "tsc --noEmit -p tsconfig.json",
51
+ "prebuild:dist": "npm run generate:doc-css",
52
+ "build:dist": "rm -rf dist && tsc -p tsconfig.build.json",
53
+ "lint": "eslint ."
54
+ },
55
+ "dependencies": {
56
+ "hast-util-to-html": "^9.0.0",
57
+ "@markii/core": "0.6.0",
58
+ "@markii/runtime": "0.6.0",
59
+ "@markii/stdlib": "0.6.0"
60
+ },
61
+ "devDependencies": {
62
+ "@types/hast": "^3.0.4"
63
+ }
64
+ }