sdocs 0.0.54 → 0.0.55
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/CHANGELOG.md +9 -0
- package/dist/language/parser.d.ts +2 -2
- package/dist/language/parser.js +4 -4
- package/dist/server/config.js +2 -2
- package/dist/server/snippet-compiler.d.ts +2 -2
- package/dist/server/snippet-compiler.js +4 -4
- package/dist/types.d.ts +7 -7
- package/dist/vite.js +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.0.55] - 2026-07-05
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- **Renamed the stage alignment attributes** `align`/`alignY` (added in
|
|
15
|
+
0.0.54) to **`contentX`**/**`contentY`** — for horizontal/vertical content
|
|
16
|
+
alignment on `[preview]`/`[example]` and their `content.docs` and `[DOCS]`
|
|
17
|
+
defaults. Values and direction-aware behavior are unchanged.
|
|
18
|
+
|
|
10
19
|
## [0.0.54] - 2026-07-05
|
|
11
20
|
|
|
12
21
|
### Added
|
|
@@ -14,9 +14,9 @@ export interface Sizing {
|
|
|
14
14
|
/** gap of preview/example stages */
|
|
15
15
|
gap: string | null;
|
|
16
16
|
/** horizontal alignment of preview/example stage contents */
|
|
17
|
-
|
|
17
|
+
contentX: string | null;
|
|
18
18
|
/** vertical alignment of preview/example stage contents */
|
|
19
|
-
|
|
19
|
+
contentY: string | null;
|
|
20
20
|
/** table-of-contents visibility (PAGE) */
|
|
21
21
|
toc: boolean | null;
|
|
22
22
|
}
|
package/dist/language/parser.js
CHANGED
|
@@ -50,8 +50,8 @@ const SIZING_ATTR_RULES = {
|
|
|
50
50
|
const STAGE_LAYOUT_ATTR_RULES = {
|
|
51
51
|
direction: { required: false, kind: 'string', hint: 'direction="column"' },
|
|
52
52
|
gap: { required: false, kind: 'string', hint: 'gap="16px"' },
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
contentX: { required: false, kind: 'string', hint: 'contentX="center"' },
|
|
54
|
+
contentY: { required: false, kind: 'string', hint: 'contentY="middle"' },
|
|
55
55
|
};
|
|
56
56
|
function sizingOf(attrs) {
|
|
57
57
|
const toc = stringAttr(attrs, 'toc');
|
|
@@ -60,8 +60,8 @@ function sizingOf(attrs) {
|
|
|
60
60
|
padding: stringAttr(attrs, 'padding'),
|
|
61
61
|
direction: stringAttr(attrs, 'direction'),
|
|
62
62
|
gap: stringAttr(attrs, 'gap'),
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
contentX: stringAttr(attrs, 'contentX'),
|
|
64
|
+
contentY: stringAttr(attrs, 'contentY'),
|
|
65
65
|
toc: toc === null ? null : toc === 'true',
|
|
66
66
|
};
|
|
67
67
|
}
|
package/dist/server/config.js
CHANGED
|
@@ -28,8 +28,8 @@ export declare function generateIframeComponent(scriptPrelude: string, snippetBo
|
|
|
28
28
|
padding: string;
|
|
29
29
|
direction?: string;
|
|
30
30
|
gap?: string;
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
contentX?: string;
|
|
32
|
+
contentY?: string;
|
|
33
33
|
}): string;
|
|
34
34
|
/** The JS that boots a preview page: mount the wrapper + parent-frame messaging. */
|
|
35
35
|
export declare function generateMountScript(iframeComponentId: string): string;
|
|
@@ -88,8 +88,8 @@ export function generateIframeComponent(scriptPrelude, snippetBody, stateNames =
|
|
|
88
88
|
// layout stages are flow-root blocks. Both contain child margins, so the
|
|
89
89
|
// height reported for iframe auto-sizing is exact.
|
|
90
90
|
//
|
|
91
|
-
//
|
|
92
|
-
// each drives depends on direction. The flow axis (main) takes
|
|
91
|
+
// contentX/contentY are *physical* (horizontal/vertical); which flex
|
|
92
|
+
// property each drives depends on direction. The flow axis (main) takes
|
|
93
93
|
// justify-content, the other (cross) takes align-items — and align-items
|
|
94
94
|
// has no distribution value, so a 'justify' that lands on the cross axis
|
|
95
95
|
// falls back to stretch.
|
|
@@ -106,8 +106,8 @@ export function generateIframeComponent(scriptPrelude, snippetBody, stateNames =
|
|
|
106
106
|
justify: 'space-between',
|
|
107
107
|
};
|
|
108
108
|
const flexStage = () => {
|
|
109
|
-
const h = H[stage.
|
|
110
|
-
const v = V[stage.
|
|
109
|
+
const h = H[stage.contentX ?? 'left'] ?? 'flex-start';
|
|
110
|
+
const v = V[stage.contentY ?? 'top'] ?? 'flex-start';
|
|
111
111
|
const isColumn = String(stage.direction).startsWith('column');
|
|
112
112
|
const justify = isColumn ? v : h;
|
|
113
113
|
let alignItems = isColumn ? h : v;
|
package/dist/types.d.ts
CHANGED
|
@@ -35,9 +35,9 @@ export interface SdocsConfig {
|
|
|
35
35
|
/** Stage gap. Default: '16px' */
|
|
36
36
|
gap?: string;
|
|
37
37
|
/** Horizontal alignment of stage contents: 'left'|'center'|'right'|'justify'. Default: 'left' */
|
|
38
|
-
|
|
38
|
+
contentX?: string;
|
|
39
39
|
/** Vertical alignment of stage contents: 'top'|'middle'|'bottom'. Default: 'top' */
|
|
40
|
-
|
|
40
|
+
contentY?: string;
|
|
41
41
|
};
|
|
42
42
|
/** [LAYOUT] stages. Defaults: maxWidth '100%', padding '0px'. */
|
|
43
43
|
layout?: ContentSizing;
|
|
@@ -52,13 +52,13 @@ export interface ContentSizing {
|
|
|
52
52
|
export interface StageLayout {
|
|
53
53
|
maxWidth: string;
|
|
54
54
|
padding: string;
|
|
55
|
-
/** flex-direction + gap +
|
|
55
|
+
/** flex-direction + gap + contentX; set for preview/example stages only */
|
|
56
56
|
direction?: string;
|
|
57
57
|
gap?: string;
|
|
58
58
|
/** horizontal ('left'|'center'|'right'|'justify') — mapped by direction */
|
|
59
|
-
|
|
59
|
+
contentX?: string;
|
|
60
60
|
/** vertical ('top'|'middle'|'bottom') — mapped by direction */
|
|
61
|
-
|
|
61
|
+
contentY?: string;
|
|
62
62
|
}
|
|
63
63
|
/** Resolved config with all defaults applied */
|
|
64
64
|
export interface ResolvedSdocsConfig {
|
|
@@ -79,8 +79,8 @@ export interface ResolvedSdocsConfig {
|
|
|
79
79
|
docs: Required<ContentSizing> & {
|
|
80
80
|
direction: string;
|
|
81
81
|
gap: string;
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
contentX: string;
|
|
83
|
+
contentY: string;
|
|
84
84
|
};
|
|
85
85
|
layout: Required<ContentSizing>;
|
|
86
86
|
};
|
package/dist/vite.js
CHANGED
|
@@ -308,13 +308,13 @@ export function sdocsPlugin(userConfig) {
|
|
|
308
308
|
maxWidth: block?.maxWidth ??
|
|
309
309
|
(entity.kind === 'LAYOUT' ? (entity.sizing.maxWidth ?? kindDefaults.maxWidth) : '100%'),
|
|
310
310
|
padding: block?.padding ?? entity.sizing.padding ?? kindDefaults.padding,
|
|
311
|
-
// direction/gap/
|
|
311
|
+
// direction/gap/contentX flex the preview/example stages only
|
|
312
312
|
...(entity.kind === 'DOCS' && block
|
|
313
313
|
? {
|
|
314
314
|
direction: block.direction ?? entity.sizing.direction ?? config.content.docs.direction,
|
|
315
315
|
gap: block.gap ?? entity.sizing.gap ?? config.content.docs.gap,
|
|
316
|
-
|
|
317
|
-
|
|
316
|
+
contentX: block.contentX ?? entity.sizing.contentX ?? config.content.docs.contentX,
|
|
317
|
+
contentY: block.contentY ?? entity.sizing.contentY ?? config.content.docs.contentY,
|
|
318
318
|
}
|
|
319
319
|
: {}),
|
|
320
320
|
});
|