Skip to content

Commit c929c8f

Browse files
committed
refactor(elements): add selectable field types and values.
1 parent 4c0df9e commit c929c8f

1 file changed

Lines changed: 125 additions & 0 deletions

File tree

  • packages/ducjs/src/types/elements

packages/ducjs/src/types/elements/index.ts

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,131 @@ export type DucElement =
176176

177177
export type DucElementTypes = DucElement["type"];
178178

179+
export type DucElementSelectableField =
180+
| keyof DucElement
181+
| keyof Extract<DucElement, { type: "model" }>
182+
| keyof Extract<DucElement, { type: "text" }>
183+
| keyof Extract<DucElement, { type: "line" }>
184+
| keyof Extract<DucElement, { type: "arrow" }>
185+
| keyof Extract<DucElement, { type: "freedraw" }>
186+
| keyof Extract<DucElement, { type: "ellipse" }>
187+
| keyof Extract<DucElement, { type: "polygon" }>
188+
| keyof Extract<DucElement, { type: "image" }>
189+
| keyof Extract<DucElement, { type: "frame" }>
190+
| keyof Extract<DucElement, { type: "plot" }>
191+
| keyof Extract<DucElement, { type: "doc" }>
192+
| keyof Extract<DucElement, { type: "pdf" }>
193+
| keyof Extract<DucElement, { type: "table" }>
194+
| keyof Extract<DucElement, { type: "embeddable" }>;
195+
196+
export const DUC_ELEMENT_SELECTABLE_FIELDS = [
197+
"id",
198+
"type",
199+
"label",
200+
"x",
201+
"y",
202+
"width",
203+
"height",
204+
"angle",
205+
"opacity",
206+
"isDeleted",
207+
"isVisible",
208+
"groupIds",
209+
"frameId",
210+
"scope",
211+
"layerId",
212+
"zIndex",
213+
"description",
214+
"customData",
215+
"roundness",
216+
"blending",
217+
"background",
218+
"stroke",
219+
"boundElements",
220+
"link",
221+
"locked",
222+
"regionIds",
223+
"blockIds",
224+
"instanceId",
225+
"index",
226+
"updated",
227+
"version",
228+
"versionNonce",
229+
"seed",
230+
"modelType",
231+
"fileIds",
232+
"code",
233+
"thumbnail",
234+
"viewerState",
235+
"text",
236+
"autoResize",
237+
"containerId",
238+
"originalText",
239+
"isLtr",
240+
"fontFamily",
241+
"bigFontFamily",
242+
"fontSize",
243+
"textAlign",
244+
"verticalAlign",
245+
"lineHeight",
246+
"lineSpacing",
247+
"obliqueAngle",
248+
"widthFactor",
249+
"isUpsideDown",
250+
"isBackwards",
251+
"points",
252+
"fileId",
253+
"status",
254+
"scaleFlip",
255+
"crop",
256+
"filter",
257+
"elbowed",
258+
"wipeoutBelow",
259+
"clip",
260+
"labelVisible",
261+
"layout",
262+
"gridConfig",
263+
"referencedFileIds",
264+
"sides",
265+
"ratio",
266+
"startAngle",
267+
"endAngle",
268+
"showAuxCrosshair",
269+
"size",
270+
"thinning",
271+
"smoothing",
272+
"streamline",
273+
"easing",
274+
"start",
275+
"end",
276+
"pressures",
277+
"simulatePressure",
278+
"lastCommittedPoint",
279+
"lines",
280+
"pathOverrides",
281+
"startBinding",
282+
"endBinding",
283+
"svgPath",
284+
] as const;
285+
286+
export const DUC_ELEMENT_TYPE_VALUES = [
287+
"rectangle",
288+
"polygon",
289+
"ellipse",
290+
"line",
291+
"arrow",
292+
"freedraw",
293+
"text",
294+
"image",
295+
"frame",
296+
"embeddable",
297+
"table",
298+
"model",
299+
"pdf",
300+
"doc",
301+
"plot",
302+
] as const;
303+
179304
export type NonDeleted<TElement extends DucElement> = TElement & {
180305
isDeleted: boolean;
181306
};

0 commit comments

Comments
 (0)