@cntrl-site/components 1.0.69-alpha.1 → 1.0.69-alpha.3
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/Components/Pretext/Pretext.d.ts +1 -28
- package/dist/Components/Pretext/PretextComponent.d.ts +1 -1
- package/dist/index.js +211 -587
- package/dist/index.mjs +5148 -5436
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CommonComponentProps } from '../props';
|
|
2
2
|
import { TextStyles } from '../utils/textStylesToCss';
|
|
3
|
-
export declare const SHAPE_IDS: readonly ["
|
|
3
|
+
export declare const SHAPE_IDS: readonly ["diamond", "parallelogram", "vase", "circle", "shield", "bobbin", "custom"];
|
|
4
4
|
export type ShapeId = typeof SHAPE_IDS[number];
|
|
5
5
|
type Align = 'left' | 'center' | 'right' | 'justify';
|
|
6
6
|
type PathFit = 'stretch' | 'viewbox';
|
|
@@ -40,10 +40,8 @@ type PretextSettings = {
|
|
|
40
40
|
dropCapLines?: number;
|
|
41
41
|
dropCapSize?: number;
|
|
42
42
|
image?: string | null;
|
|
43
|
-
/** Focal point of the image within the shape's mask, 0..1 (like object-position). Defaults to center. */
|
|
44
43
|
imageFocalX?: number;
|
|
45
44
|
imageFocalY?: number;
|
|
46
|
-
/** Extra zoom on top of the cover fit. 1 = just covers the mask. */
|
|
47
45
|
imageScale?: number;
|
|
48
46
|
backgroundColor?: string;
|
|
49
47
|
textColor?: string;
|
|
@@ -74,7 +72,6 @@ type Pt = {
|
|
|
74
72
|
y: number;
|
|
75
73
|
};
|
|
76
74
|
type Ring = Pt[];
|
|
77
|
-
/** One anchor plus the two cubic handles meeting on it. `null` handle = straight. */
|
|
78
75
|
export type VecNode = {
|
|
79
76
|
p: Pt;
|
|
80
77
|
in?: Pt | null;
|
|
@@ -84,32 +81,13 @@ export type VecContour = {
|
|
|
84
81
|
nodes: VecNode[];
|
|
85
82
|
closed: boolean;
|
|
86
83
|
};
|
|
87
|
-
/** Vector editing always happens in this coordinate space, so a drag is 1:1. */
|
|
88
84
|
export declare const EDIT_VIEW_BOX = "0 0 100 100";
|
|
89
85
|
export declare function mapContours(contours: VecContour[], transform: (point: Pt) => Pt): VecContour[];
|
|
90
|
-
/** Uniform (or axis-independent) scale about `origin` — keeps proportions when sx === sy. */
|
|
91
86
|
export declare function scaleContours(contours: VecContour[], origin: Pt, scaleX: number, scaleY?: number): VecContour[];
|
|
92
|
-
/**
|
|
93
|
-
* SVG path string → editable contours. Every command is normalized to cubic
|
|
94
|
-
* nodes, so what comes back can be dragged around and written out again.
|
|
95
|
-
*/
|
|
96
87
|
export declare function parsePathNodes(d: string): VecContour[];
|
|
97
|
-
/** Contours → an SVG path string, which is what the setting stores. */
|
|
98
88
|
export declare function serializeContours(contours: VecContour[]): string;
|
|
99
|
-
/** Contours → polygon rings, the form the text layout reads. */
|
|
100
89
|
export declare function flattenContours(contours: VecContour[]): Ring[];
|
|
101
|
-
/**
|
|
102
|
-
* Sampled rings → contours, so any preset can be picked up and dragged.
|
|
103
|
-
* Few points means a polygon: its corners are kept. Many points means a curve:
|
|
104
|
-
* it is thinned out and smoothed back, which lands within a hair of the original.
|
|
105
|
-
*/
|
|
106
90
|
export declare function ringsToContours(rings: Ring[]): VecContour[];
|
|
107
|
-
/**
|
|
108
|
-
* Turns a preset into the editable viewBox path the editor persists after a
|
|
109
|
-
* shape pick. Always maps into the full 0–100 edit space — carrying the
|
|
110
|
-
* previous path's bbox compounded smaller on every switch (presets with
|
|
111
|
-
* natural margins, then circle letterboxing, then the next pick…).
|
|
112
|
-
*/
|
|
113
91
|
export declare function settingsForEditablePreset(shape: ShapeId): {
|
|
114
92
|
shape: ShapeId;
|
|
115
93
|
customPath: string;
|
|
@@ -117,26 +95,21 @@ export declare function settingsForEditablePreset(shape: ShapeId): {
|
|
|
117
95
|
pathViewBox: string;
|
|
118
96
|
};
|
|
119
97
|
export declare function moveNodeTo(contours: VecContour[], contourIndex: number, nodeIndex: number, point: Pt): VecContour[];
|
|
120
|
-
/** Translates a set of selected anchors (and their handles) together, leaving the rest of the shape fixed. */
|
|
121
98
|
export declare function moveSelectedNodesBy(contours: VecContour[], selection: {
|
|
122
99
|
contour: number;
|
|
123
100
|
node: number;
|
|
124
101
|
}[], dx: number, dy: number): VecContour[];
|
|
125
|
-
/** Removes several nodes at once — descending per contour so earlier removals don't shift later indices. */
|
|
126
102
|
export declare function removeContourNodes(contours: VecContour[], selection: {
|
|
127
103
|
contour: number;
|
|
128
104
|
node: number;
|
|
129
105
|
}[]): VecContour[];
|
|
130
106
|
export declare function setNodeHandle(contours: VecContour[], contourIndex: number, nodeIndex: number, which: 'in' | 'out', point: Pt, mirror: boolean): VecContour[];
|
|
131
|
-
/** Pulls a handle back into its anchor, straightening that side of the node. */
|
|
132
107
|
export declare function clearNodeHandle(contours: VecContour[], contourIndex: number, nodeIndex: number, which: 'in' | 'out'): VecContour[];
|
|
133
|
-
/** Splits a segment at `t` (de Casteljau), so the new node sits on the curve. */
|
|
134
108
|
export declare function insertNodeOnSegment(contours: VecContour[], contourIndex: number, segmentIndex: number, t: number): {
|
|
135
109
|
contours: VecContour[];
|
|
136
110
|
nodeIndex: number;
|
|
137
111
|
};
|
|
138
112
|
export declare function removeContourNode(contours: VecContour[], contourIndex: number, nodeIndex: number): VecContour[];
|
|
139
|
-
/** Corner ⇄ smooth: drops both handles, or grows them from the neighbours. */
|
|
140
113
|
export declare function toggleNodeSmooth(contours: VecContour[], contourIndex: number, nodeIndex: number): VecContour[];
|
|
141
114
|
export declare function nearestSegmentHit(contours: VecContour[], point: Pt): {
|
|
142
115
|
contour: number;
|
|
@@ -6,7 +6,7 @@ export declare const PretextComponent: {
|
|
|
6
6
|
name: string;
|
|
7
7
|
category: string;
|
|
8
8
|
version: number;
|
|
9
|
-
normalizeLayoutSettingsUpdate: (nextSettings: Record<string, any>,
|
|
9
|
+
normalizeLayoutSettingsUpdate: (nextSettings: Record<string, any>, prevSettings: Record<string, any>) => Record<string, any>;
|
|
10
10
|
defaultSize: {
|
|
11
11
|
d: {
|
|
12
12
|
width: number;
|