@markii/stdlib 0.8.0 → 0.9.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/dist/contracts.d.ts +1 -1
- package/dist/contracts.js +19 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/layout.d.ts +28 -0
- package/dist/layout.js +31 -0
- package/package.json +1 -1
package/dist/contracts.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ export interface ComponentContract {
|
|
|
49
49
|
/**
|
|
50
50
|
* The standard component set, seeded from the components that ship with
|
|
51
51
|
* `@markii/react` today (`packages/platforms/markii-react/src/components/
|
|
52
|
-
* {callout,kbd,rating,details,card,badge,figure,tabs,tab}.tsx`). Each
|
|
52
|
+
* {callout,kbd,rating,divider,details,card,badge,figure,tabs,tab}.tsx`). Each
|
|
53
53
|
* contract was written by reading the real implementation — `kind` from how
|
|
54
54
|
* the component is registered in `defaultRegistry`, `attributes` from
|
|
55
55
|
* exactly the props the component reads (no invented attributes).
|
package/dist/contracts.js
CHANGED
|
@@ -44,7 +44,7 @@ function layoutWrapperContract(name, whatItDoes) {
|
|
|
44
44
|
/**
|
|
45
45
|
* The standard component set, seeded from the components that ship with
|
|
46
46
|
* `@markii/react` today (`packages/platforms/markii-react/src/components/
|
|
47
|
-
* {callout,kbd,rating,details,card,badge,figure,tabs,tab}.tsx`). Each
|
|
47
|
+
* {callout,kbd,rating,divider,details,card,badge,figure,tabs,tab}.tsx`). Each
|
|
48
48
|
* contract was written by reading the real implementation — `kind` from how
|
|
49
49
|
* the component is registered in `defaultRegistry`, `attributes` from
|
|
50
50
|
* exactly the props the component reads (no invented attributes).
|
|
@@ -95,6 +95,24 @@ export const STANDARD_COMPONENTS = {
|
|
|
95
95
|
},
|
|
96
96
|
description: 'A leaf directive rendering a row of stars, e.g. `::rating{value=3 max=5}`. Has no body — both attributes are optional and degrade gracefully rather than throwing.',
|
|
97
97
|
},
|
|
98
|
+
divider: {
|
|
99
|
+
name: 'divider',
|
|
100
|
+
kind: 'leaf',
|
|
101
|
+
attributes: {
|
|
102
|
+
label: {
|
|
103
|
+
type: 'string',
|
|
104
|
+
required: false,
|
|
105
|
+
description: 'Optional short text shown centered in the line. Absent or empty means an unlabeled divider.',
|
|
106
|
+
},
|
|
107
|
+
variant: {
|
|
108
|
+
type: 'string',
|
|
109
|
+
required: false,
|
|
110
|
+
enum: ['line', 'dots', 'ornament'],
|
|
111
|
+
description: 'Which break to draw: a solid hairline, a dotted hairline, or a centered ornament with no hairline. Defaults to `line` when absent or not one of the allowed values.',
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
description: 'A leaf directive drawing a section break, e.g. `::divider{label="Part 2" variant="dots"}`. Has no body, and both attributes are optional. A plain `---` thematic break keeps its own CommonMark meaning; this directive is for a break that carries a label or a chosen look.',
|
|
115
|
+
},
|
|
98
116
|
details: {
|
|
99
117
|
name: 'details',
|
|
100
118
|
kind: 'container',
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/layout.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The neutral definition of docs/format.md's layout system: the two
|
|
3
|
+
* reserved attributes every block directive can carry (`width`, `align`)
|
|
4
|
+
* and their closed preset vocabularies. Zero dependency, matching this
|
|
5
|
+
* package's own posture — every renderer (`@markii/react`, `@markii/html`,
|
|
6
|
+
* and any future one) builds its class-mapping logic off these same value
|
|
7
|
+
* lists instead of hand-copying the literals, which is how the two
|
|
8
|
+
* existing renderers drifted into two near-identical copies in the first
|
|
9
|
+
* place.
|
|
10
|
+
*
|
|
11
|
+
* This module carries VALUES only (the attribute names, the preset lists,
|
|
12
|
+
* and the two attributes expressed as `AttributeSchema`s for a tool that
|
|
13
|
+
* documents or completes attributes). It says nothing about markup,
|
|
14
|
+
* classes, or rendering; see each renderer's own `layout.ts` for that.
|
|
15
|
+
*/
|
|
16
|
+
import type { AttributeSchema } from './contracts.js';
|
|
17
|
+
/** The two attribute names docs/format.md reserves on every block directive. */
|
|
18
|
+
export declare const LAYOUT_ATTRIBUTE_KEYS: readonly ["width", "align"];
|
|
19
|
+
/** The closed `width=` preset vocabulary (docs/format.md), in the order the docs list them. */
|
|
20
|
+
export declare const WIDTH_PRESETS: readonly ["normal", "narrow", "wide", "full"];
|
|
21
|
+
/** The closed `align=` preset vocabulary (docs/format.md), in the order the docs list them. */
|
|
22
|
+
export declare const ALIGN_PRESETS: readonly ["left", "center", "right"];
|
|
23
|
+
/**
|
|
24
|
+
* The two reserved layout attributes as `AttributeSchema`s, so a tool that
|
|
25
|
+
* completes or documents attributes reads them exactly like a component's
|
|
26
|
+
* own.
|
|
27
|
+
*/
|
|
28
|
+
export declare const LAYOUT_ATTRIBUTES: Readonly<Record<'width' | 'align', AttributeSchema>>;
|
package/dist/layout.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** The two attribute names docs/format.md reserves on every block directive. */
|
|
2
|
+
export const LAYOUT_ATTRIBUTE_KEYS = ['width', 'align'];
|
|
3
|
+
/** The closed `width=` preset vocabulary (docs/format.md), in the order the docs list them. */
|
|
4
|
+
export const WIDTH_PRESETS = ['normal', 'narrow', 'wide', 'full'];
|
|
5
|
+
/** The closed `align=` preset vocabulary (docs/format.md), in the order the docs list them. */
|
|
6
|
+
export const ALIGN_PRESETS = ['left', 'center', 'right'];
|
|
7
|
+
/**
|
|
8
|
+
* The two reserved layout attributes as `AttributeSchema`s, so a tool that
|
|
9
|
+
* completes or documents attributes reads them exactly like a component's
|
|
10
|
+
* own.
|
|
11
|
+
*/
|
|
12
|
+
export const LAYOUT_ATTRIBUTES = {
|
|
13
|
+
width: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
required: false,
|
|
16
|
+
enum: WIDTH_PRESETS,
|
|
17
|
+
description: 'Sets how wide the directive renders: `normal` (the default column ' +
|
|
18
|
+
'width), `narrow`, `wide`, or `full`. `normal` is the explicit ' +
|
|
19
|
+
'default and produces no class, the same as leaving `width` off ' +
|
|
20
|
+
'entirely. An invalid value is ignored as if absent; nothing errors.',
|
|
21
|
+
},
|
|
22
|
+
align: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
required: false,
|
|
25
|
+
enum: ALIGN_PRESETS,
|
|
26
|
+
description: 'Sets how the directive is aligned within the column: `left`, ' +
|
|
27
|
+
'`center`, or `right`. Only has a visible effect when the block is ' +
|
|
28
|
+
'narrower than the column; a full-width block has nothing to align. ' +
|
|
29
|
+
'An invalid value is ignored as if absent; nothing errors.',
|
|
30
|
+
},
|
|
31
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markii/stdlib",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Neutral, framework-agnostic standard component contracts for Mark (.mk.md) — the kind/attribute-schema seam every renderer (e.g. @markii/react) implements against. No React, zero dependencies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|