@cntrl-site/components 1.0.68-alpha.1 → 1.0.68

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/components",
3
- "version": "1.0.68-alpha.1",
3
+ "version": "1.0.68",
4
4
  "description": "Custom components for control editor and public websites.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -1,148 +0,0 @@
1
- import { CommonComponentProps } from '../props';
2
- import { TextStyles } from '../utils/textStylesToCss';
3
- export declare const SHAPE_IDS: readonly ["bobbin", "circle", "shield", "vase", "parallelogram", "diamond", "custom"];
4
- export type ShapeId = typeof SHAPE_IDS[number];
5
- type Align = 'left' | 'center' | 'right' | 'justify';
6
- type PathFit = 'stretch' | 'viewbox';
7
- type RichLeaf = {
8
- text?: string;
9
- fontFamily?: string;
10
- fontWeight?: number;
11
- fontStyle?: string;
12
- textDecoration?: string;
13
- textTransform?: string;
14
- fontVariant?: string;
15
- verticalAlign?: string;
16
- };
17
- type RichLink = {
18
- type: 'link';
19
- value?: string;
20
- target?: string;
21
- children?: RichNode[];
22
- };
23
- type RichNode = RichLeaf | RichLink;
24
- type RichBlock = {
25
- type?: string;
26
- children?: RichNode[];
27
- };
28
- type PretextContentItem = {
29
- text?: RichBlock[];
30
- };
31
- type PretextSettings = {
32
- shape?: ShapeId;
33
- customPath?: string;
34
- pathFit?: PathFit;
35
- pathViewBox?: string;
36
- pathSnap?: number;
37
- shapeMode?: 'A' | 'B';
38
- overflowMode?: 'clip' | 'visible';
39
- fitText?: 'on' | 'off';
40
- dropCapLines?: number;
41
- dropCapSize?: number;
42
- image?: string | null;
43
- /** Focal point of the image within the shape's mask, 0..1 (like object-position). Defaults to center. */
44
- imageFocalX?: number;
45
- imageFocalY?: number;
46
- /** Extra zoom on top of the cover fit. 1 = just covers the mask. */
47
- imageScale?: number;
48
- backgroundColor?: string;
49
- textColor?: string;
50
- linkColor?: string;
51
- textFontFamily?: string;
52
- textFontSettings?: {
53
- fontWeight: number;
54
- fontStyle: string;
55
- };
56
- textFontSize?: number;
57
- textLineHeight?: number;
58
- textLetterSpacing?: number;
59
- textWordSpacing?: number;
60
- textAlign?: Align;
61
- textTextAppearance?: TextStyles['textAppearance'];
62
- };
63
- type PretextProps = {
64
- settings?: PretextSettings;
65
- content?: PretextContentItem[];
66
- isEditor?: boolean;
67
- isPreviewMode?: boolean;
68
- isEditMode?: boolean;
69
- isSelected?: boolean;
70
- onUpdateSettings?: (settings: PretextSettings) => void;
71
- } & CommonComponentProps;
72
- type Pt = {
73
- x: number;
74
- y: number;
75
- };
76
- type Ring = Pt[];
77
- /** One anchor plus the two cubic handles meeting on it. `null` handle = straight. */
78
- export type VecNode = {
79
- p: Pt;
80
- in?: Pt | null;
81
- out?: Pt | null;
82
- };
83
- export type VecContour = {
84
- nodes: VecNode[];
85
- closed: boolean;
86
- };
87
- /** Vector editing always happens in this coordinate space, so a drag is 1:1. */
88
- export declare const EDIT_VIEW_BOX = "0 0 100 100";
89
- 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
- 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
- export declare function parsePathNodes(d: string): VecContour[];
97
- /** Contours → an SVG path string, which is what the setting stores. */
98
- export declare function serializeContours(contours: VecContour[]): string;
99
- /** Contours → polygon rings, the form the text layout reads. */
100
- 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
- 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
- export declare function settingsForEditablePreset(shape: ShapeId): {
114
- shape: ShapeId;
115
- customPath: string;
116
- pathFit: 'viewbox';
117
- pathViewBox: string;
118
- };
119
- 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
- export declare function moveSelectedNodesBy(contours: VecContour[], selection: {
122
- contour: number;
123
- node: number;
124
- }[], dx: number, dy: number): VecContour[];
125
- /** Removes several nodes at once — descending per contour so earlier removals don't shift later indices. */
126
- export declare function removeContourNodes(contours: VecContour[], selection: {
127
- contour: number;
128
- node: number;
129
- }[]): VecContour[];
130
- 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
- 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
- export declare function insertNodeOnSegment(contours: VecContour[], contourIndex: number, segmentIndex: number, t: number): {
135
- contours: VecContour[];
136
- nodeIndex: number;
137
- };
138
- export declare function removeContourNode(contours: VecContour[], contourIndex: number, nodeIndex: number): VecContour[];
139
- /** Corner ⇄ smooth: drops both handles, or grows them from the neighbours. */
140
- export declare function toggleNodeSmooth(contours: VecContour[], contourIndex: number, nodeIndex: number): VecContour[];
141
- export declare function nearestSegmentHit(contours: VecContour[], point: Pt): {
142
- contour: number;
143
- segment: number;
144
- t: number;
145
- distance: number;
146
- } | null;
147
- export declare function Pretext({ settings, content, isEditor, isPreviewMode, isEditMode, isSelected, onUpdateSettings }: PretextProps): import("react/jsx-runtime").JSX.Element;
148
- export {};
@@ -1,46 +0,0 @@
1
- import { Pretext } from './Pretext';
2
- import { ComponentSchemaV1 } from '../../types/SchemaV1';
3
- export declare const PretextComponent: {
4
- element: typeof Pretext;
5
- id: string;
6
- name: string;
7
- category: string;
8
- version: number;
9
- normalizeLayoutSettingsUpdate: (nextSettings: Record<string, any>, _prevSettings: Record<string, any>) => Record<string, any>;
10
- defaultSize: {
11
- d: {
12
- width: number;
13
- height: number;
14
- };
15
- t: {
16
- width: number;
17
- height: number;
18
- };
19
- m: {
20
- width: number;
21
- height: number;
22
- };
23
- };
24
- preview: {
25
- type: "image";
26
- url: string;
27
- };
28
- schema: ComponentSchemaV1;
29
- sourceCode: string;
30
- assetsPaths: {
31
- content: never[];
32
- parameters: {
33
- path: string;
34
- placeholderEnabled: boolean;
35
- }[];
36
- };
37
- fontSettingsPaths: {
38
- content: never[];
39
- parameters: {
40
- path: string;
41
- }[];
42
- };
43
- fontRelations: {
44
- textFontSettings: string;
45
- };
46
- };