UNPKG

tldraw

Version:

A tiny little drawing editor.

801 lines (800 loc) • 28.7 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var buildFromV1Document_exports = {}; __export(buildFromV1Document_exports, { TLV1AlignStyle: () => TLV1AlignStyle, TLV1AssetType: () => TLV1AssetType, TLV1ColorStyle: () => TLV1ColorStyle, TLV1DashStyle: () => TLV1DashStyle, TLV1Decoration: () => TLV1Decoration, TLV1FontStyle: () => TLV1FontStyle, TLV1ShapeType: () => TLV1ShapeType, TLV1SizeStyle: () => TLV1SizeStyle, buildFromV1Document: () => buildFromV1Document }); module.exports = __toCommonJS(buildFromV1Document_exports); var import_editor = require("@tldraw/editor"); var import_shared = require("../../shapes/arrow/shared"); const TLDRAW_V1_VERSION = 15.5; function buildFromV1Document(editor, _document) { let document = _document; editor.run(() => { document = migrate(document, TLDRAW_V1_VERSION); editor.cancel().cancel().cancel().cancel(); const firstPageId = editor.getPages()[0].id; editor.setCurrentPage(firstPageId); for (const page of editor.getPages().slice(1)) { editor.deletePage(page.id); } editor.selectAll(); editor.deleteShapes(editor.getSelectedShapeIds()); const v1AssetIdsToV2AssetIds = /* @__PURE__ */ new Map(); Object.values(document.assets ?? {}).forEach((v1Asset) => { switch (v1Asset.type) { case TLV1AssetType.Image: { const assetId = import_editor.AssetRecordType.createId(); v1AssetIdsToV2AssetIds.set(v1Asset.id, assetId); const placeholderAsset = { id: assetId, typeName: "asset", type: "image", props: { w: coerceDimension(v1Asset.size[0]), h: coerceDimension(v1Asset.size[1]), name: v1Asset.fileName ?? "Untitled", isAnimated: false, mimeType: null, src: v1Asset.src }, meta: {} }; editor.createAssets([placeholderAsset]); tryMigrateAsset(editor, placeholderAsset); break; } case TLV1AssetType.Video: { const assetId = import_editor.AssetRecordType.createId(); v1AssetIdsToV2AssetIds.set(v1Asset.id, assetId); editor.createAssets([ { id: assetId, typeName: "asset", type: "video", props: { w: coerceDimension(v1Asset.size[0]), h: coerceDimension(v1Asset.size[1]), name: v1Asset.fileName ?? "Untitled", isAnimated: true, mimeType: null, src: v1Asset.src }, meta: {} } ]); } break; } }); const v1PageIdsToV2PageIds = /* @__PURE__ */ new Map(); Object.values(document.pages ?? {}).sort((a, b) => (a.childIndex ?? 1) < (b.childIndex ?? 1) ? -1 : 1).forEach((v1Page, i) => { if (i === 0) { v1PageIdsToV2PageIds.set(v1Page.id, editor.getCurrentPageId()); } else { const pageId = import_editor.PageRecordType.createId(); v1PageIdsToV2PageIds.set(v1Page.id, pageId); editor.createPage({ name: v1Page.name ?? "Page", id: pageId }); } }); Object.values(document.pages ?? {}).sort((a, b) => (a.childIndex ?? 1) < (b.childIndex ?? 1) ? -1 : 1).forEach((v1Page) => { editor.setCurrentPage(v1PageIdsToV2PageIds.get(v1Page.id)); const v1ShapeIdsToV2ShapeIds = /* @__PURE__ */ new Map(); const v1GroupShapeIdsToV1ChildIds = /* @__PURE__ */ new Map(); const v1Shapes = Object.values(v1Page.shapes ?? {}).sort((a, b) => a.childIndex < b.childIndex ? -1 : 1).slice(0, editor.options.maxShapesPerPage); v1Shapes.forEach((v1Shape) => { if (v1Shape.type !== TLV1ShapeType.Group) return; const shapeId = (0, import_editor.createShapeId)(); v1ShapeIdsToV2ShapeIds.set(v1Shape.id, shapeId); v1GroupShapeIdsToV1ChildIds.set(v1Shape.id, []); }); function decideNotToCreateShape(v1Shape) { v1ShapeIdsToV2ShapeIds.delete(v1Shape.id); const v1GroupParent = v1GroupShapeIdsToV1ChildIds.has(v1Shape.parentId); if (v1GroupParent) { const ids = v1GroupShapeIdsToV1ChildIds.get(v1Shape.parentId).filter((id) => id !== v1Shape.id); v1GroupShapeIdsToV1ChildIds.set(v1Shape.parentId, ids); } } v1Shapes.forEach((v1Shape) => { if (v1Shape.type === TLV1ShapeType.Group) { return; } const shapeId = (0, import_editor.createShapeId)(); v1ShapeIdsToV2ShapeIds.set(v1Shape.id, shapeId); if (v1Shape.parentId !== v1Page.id) { if (v1GroupShapeIdsToV1ChildIds.has(v1Shape.parentId)) { v1GroupShapeIdsToV1ChildIds.get(v1Shape.parentId).push(v1Shape.id); } else { console.warn("parent does not exist", v1Shape); } } const parentId = v1PageIdsToV2PageIds.get(v1Page.id); const inCommon = { id: shapeId, parentId, x: coerceNumber(v1Shape.point[0]), y: coerceNumber(v1Shape.point[1]), rotation: 0, isLocked: !!v1Shape.isLocked }; switch (v1Shape.type) { case TLV1ShapeType.Sticky: { editor.createShapes([ { ...inCommon, type: "note", props: { richText: (0, import_editor.toRichText)(v1Shape.text ?? ""), color: getV2Color(v1Shape.style.color), size: getV2Size(v1Shape.style.size), font: getV2Font(v1Shape.style.font), align: getV2Align(v1Shape.style.textAlign) } } ]); break; } case TLV1ShapeType.Rectangle: { editor.createShapes([ { ...inCommon, type: "geo", props: { geo: "rectangle", w: coerceDimension(v1Shape.size[0]), h: coerceDimension(v1Shape.size[1]), richText: (0, import_editor.toRichText)(v1Shape.label ?? ""), fill: getV2Fill(v1Shape.style.isFilled, v1Shape.style.color), labelColor: getV2Color(v1Shape.style.color), color: getV2Color(v1Shape.style.color), size: getV2Size(v1Shape.style.size), font: getV2Font(v1Shape.style.font), dash: getV2Dash(v1Shape.style.dash), align: "middle" } } ]); const pageBoundsBeforeLabel = editor.getShapePageBounds(inCommon.id); editor.updateShapes([ { id: inCommon.id, type: "geo", props: { richText: (0, import_editor.toRichText)(v1Shape.label ?? "") } } ]); if (pageBoundsBeforeLabel.width === pageBoundsBeforeLabel.height) { const shape = editor.getShape(inCommon.id); const { growY } = shape.props; const w = coerceDimension(shape.props.w); const h = coerceDimension(shape.props.h); const newW = w + growY / 2; const newH = h + growY / 2; editor.updateShapes([ { id: inCommon.id, type: "geo", x: coerceNumber(shape.x) - (newW - w) / 2, y: coerceNumber(shape.y) - (newH - h) / 2, props: { w: newW, h: newH } } ]); } break; } case TLV1ShapeType.Triangle: { editor.createShapes([ { ...inCommon, type: "geo", props: { geo: "triangle", w: coerceDimension(v1Shape.size[0]), h: coerceDimension(v1Shape.size[1]), fill: getV2Fill(v1Shape.style.isFilled, v1Shape.style.color), labelColor: getV2Color(v1Shape.style.color), color: getV2Color(v1Shape.style.color), size: getV2Size(v1Shape.style.size), font: getV2Font(v1Shape.style.font), dash: getV2Dash(v1Shape.style.dash), align: "middle" } } ]); const pageBoundsBeforeLabel = editor.getShapePageBounds(inCommon.id); editor.updateShapes([ { id: inCommon.id, type: "geo", props: { richText: (0, import_editor.toRichText)(v1Shape.label ?? "") } } ]); if (pageBoundsBeforeLabel.width === pageBoundsBeforeLabel.height) { const shape = editor.getShape(inCommon.id); const { growY } = shape.props; const w = coerceDimension(shape.props.w); const h = coerceDimension(shape.props.h); const newW = w + growY / 2; const newH = h + growY / 2; editor.updateShapes([ { id: inCommon.id, type: "geo", x: coerceNumber(shape.x) - (newW - w) / 2, y: coerceNumber(shape.y) - (newH - h) / 2, props: { w: newW, h: newH } } ]); } break; } case TLV1ShapeType.Ellipse: { editor.createShapes([ { ...inCommon, type: "geo", props: { geo: "ellipse", w: coerceDimension(v1Shape.radius[0]) * 2, h: coerceDimension(v1Shape.radius[1]) * 2, fill: getV2Fill(v1Shape.style.isFilled, v1Shape.style.color), labelColor: getV2Color(v1Shape.style.color), color: getV2Color(v1Shape.style.color), size: getV2Size(v1Shape.style.size), font: getV2Font(v1Shape.style.font), dash: getV2Dash(v1Shape.style.dash), align: "middle" } } ]); const pageBoundsBeforeLabel = editor.getShapePageBounds(inCommon.id); editor.updateShapes([ { id: inCommon.id, type: "geo", props: { richText: (0, import_editor.toRichText)(v1Shape.label ?? "") } } ]); if (pageBoundsBeforeLabel.width === pageBoundsBeforeLabel.height) { const shape = editor.getShape(inCommon.id); const { growY } = shape.props; const w = coerceDimension(shape.props.w); const h = coerceDimension(shape.props.h); const newW = w + growY / 2; const newH = h + growY / 2; editor.updateShapes([ { id: inCommon.id, type: "geo", x: coerceNumber(shape.x) - (newW - w) / 2, y: coerceNumber(shape.y) - (newH - h) / 2, props: { w: newW, h: newH } } ]); } break; } case TLV1ShapeType.Draw: { if (v1Shape.points.length === 0) { decideNotToCreateShape(v1Shape); break; } const points = v1Shape.points.map(getV2Point); const base64Points = import_editor.b64Vecs.encodePoints(points); editor.createShapes([ { ...inCommon, type: "draw", props: { fill: getV2Fill(v1Shape.style.isFilled, v1Shape.style.color), color: getV2Color(v1Shape.style.color), size: getV2Size(v1Shape.style.size), dash: getV2Dash(v1Shape.style.dash), isPen: false, isComplete: v1Shape.isComplete, segments: [{ type: "free", path: base64Points }], scale: 1, scaleX: 1, scaleY: 1 } } ]); break; } case TLV1ShapeType.Arrow: { const v1Bend = coerceNumber(v1Shape.bend); const v1Start = getV2Point(v1Shape.handles.start.point); const v1End = getV2Point(v1Shape.handles.end.point); const dist = import_editor.Vec.Dist(v1Start, v1End); const v2Bend = dist * -v1Bend / 2; editor.createShapes([ { ...inCommon, type: "arrow", props: { richText: (0, import_editor.toRichText)(v1Shape.label ?? ""), color: getV2Color(v1Shape.style.color), labelColor: getV2Color(v1Shape.style.color), size: getV2Size(v1Shape.style.size), font: getV2Font(v1Shape.style.font), dash: getV2Dash(v1Shape.style.dash), arrowheadStart: getV2Arrowhead(v1Shape.decorations?.start), arrowheadEnd: getV2Arrowhead(v1Shape.decorations?.end), start: { x: coerceNumber(v1Shape.handles.start.point[0]), y: coerceNumber(v1Shape.handles.start.point[1]) }, end: { x: coerceNumber(v1Shape.handles.end.point[0]), y: coerceNumber(v1Shape.handles.end.point[1]) }, bend: v2Bend } } ]); break; } case TLV1ShapeType.Text: { editor.createShapes([ { ...inCommon, type: "text", props: { richText: (0, import_editor.toRichText)(v1Shape.text ?? " "), color: getV2Color(v1Shape.style.color), size: getV2TextSize(v1Shape.style.size), font: getV2Font(v1Shape.style.font), textAlign: getV2TextAlign(v1Shape.style.textAlign), scale: v1Shape.style.scale ?? 1 } } ]); break; } case TLV1ShapeType.Image: { const assetId = v1AssetIdsToV2AssetIds.get(v1Shape.assetId); if (!assetId) { console.warn("Could not find asset id", v1Shape.assetId); return; } editor.createShapes([ { ...inCommon, type: "image", props: { w: coerceDimension(v1Shape.size[0]), h: coerceDimension(v1Shape.size[1]), assetId } } ]); break; } case TLV1ShapeType.Video: { const assetId = v1AssetIdsToV2AssetIds.get(v1Shape.assetId); if (!assetId) { console.warn("Could not find asset id", v1Shape.assetId); return; } editor.createShapes([ { ...inCommon, type: "video", props: { w: coerceDimension(v1Shape.size[0]), h: coerceDimension(v1Shape.size[1]), assetId } } ]); break; } } const rotation = coerceNumber(v1Shape.rotation); if (rotation !== 0) { editor.select(shapeId); editor.rotateShapesBy([shapeId], rotation); } }); v1GroupShapeIdsToV1ChildIds.forEach((v1ChildIds, v1GroupId) => { const v2ChildShapeIds = v1ChildIds.map((id) => v1ShapeIdsToV2ShapeIds.get(id)); const v2GroupId = v1ShapeIdsToV2ShapeIds.get(v1GroupId); editor.groupShapes(v2ChildShapeIds, { groupId: v2GroupId }); const v1Group = v1Page.shapes[v1GroupId]; const rotation = coerceNumber(v1Group.rotation); if (rotation !== 0) { editor.select(v2GroupId); editor.rotateShapesBy([v2GroupId], rotation); } }); v1Shapes.forEach((v1Shape) => { if (v1Shape.type !== TLV1ShapeType.Arrow) { return; } const v2ShapeId = v1ShapeIdsToV2ShapeIds.get(v1Shape.id); const util = editor.getShapeUtil("arrow"); editor.inputs.setCtrlKey(false); for (const handleId of ["start", "end"]) { const bindingId = v1Shape.handles[handleId].bindingId; if (bindingId) { const binding = v1Page.bindings[bindingId]; if (!binding) { continue; } const targetId = v1ShapeIdsToV2ShapeIds.get(binding.toId); const targetShape = editor.getShape(targetId); if (!targetShape) continue; if (targetId) { const bounds2 = editor.getShapePageBounds(targetId); const v2ShapeFresh = editor.getShape(v2ShapeId); const nx = (0, import_editor.clamp)((coerceNumber(binding.point[0]) + 0.5) / 2, 0.2, 0.8); const ny = (0, import_editor.clamp)((coerceNumber(binding.point[1]) + 0.5) / 2, 0.2, 0.8); const point = editor.getPointInShapeSpace(v2ShapeFresh, { x: bounds2.minX + bounds2.width * nx, y: bounds2.minY + bounds2.height * ny }); const handles = editor.getShapeHandles(v2ShapeFresh); const change = util.onHandleDrag(v2ShapeFresh, { handle: { ...handles.find((h) => h.id === handleId), x: point.x, y: point.y }, isPrecise: point.x !== 0.5 || point.y !== 0.5, isCreatingShape: true }); if (change) { editor.updateShape(change); } const freshBinding = (0, import_shared.getArrowBindings)( editor, editor.getShape(v2ShapeId) )[handleId]; if (freshBinding) { const updatedFreshBinding = (0, import_editor.structuredClone)(freshBinding); if (binding.distance === 0) { updatedFreshBinding.props.isExact = true; } if (updatedFreshBinding.toId !== targetId) { updatedFreshBinding.toId = targetId; updatedFreshBinding.props.normalizedAnchor = { x: nx, y: ny }; } editor.updateBinding(updatedFreshBinding); } } } } }); }); editor.setCurrentPage(firstPageId); editor.clearHistory(); editor.selectNone(); const bounds = editor.getCurrentPageBounds(); if (bounds) { editor.zoomToBounds(bounds, { targetZoom: 1 }); } }); } function coerceNumber(n) { if (typeof n !== "number") return 0; if (Number.isNaN(n)) return 0; if (!Number.isFinite(n)) return 0; return n; } function coerceDimension(d) { const n = coerceNumber(d); if (n <= 0) return 1; return n; } async function tryMigrateAsset(editor, placeholderAsset) { try { if (placeholderAsset.type === "bookmark" || !placeholderAsset.props.src) return; const response = await (0, import_editor.fetch)(placeholderAsset.props.src); if (!response.ok) return; const file = new File([await response.blob()], placeholderAsset.props.name, { type: response.headers.get("content-type") ?? placeholderAsset.props.mimeType ?? void 0 }); const newAsset = await editor.getAssetForExternalContent({ type: "file", file }); if (!newAsset) throw new Error("Could not get asset for external content"); if (newAsset.type === "bookmark") return; editor.updateAssets([ { id: placeholderAsset.id, type: placeholderAsset.type, props: { ...newAsset.props, name: placeholderAsset.props.name } } ]); } catch { } } function migrate(document, newVersion) { const { version = 0 } = document; if (!document.assets) { document.assets = {}; } const assetIdsInUse = /* @__PURE__ */ new Set(); Object.values(document.pages).forEach( (page) => Object.values(page.shapes).forEach((shape) => { const { parentId, children, assetId } = shape; if (assetId) { assetIdsInUse.add(assetId); } if (parentId !== page.id && !page.shapes[parentId]) { console.warn("Encountered a shape with a missing parent!"); shape.parentId = page.id; } if (shape.type === TLV1ShapeType.Group && children) { children.forEach((childId) => { if (!page.shapes[childId]) { console.warn("Encountered a parent with a missing child!", shape.id, childId); children?.splice(children.indexOf(childId), 1); } }); } }) ); Object.keys(document.assets).forEach((assetId) => { if (!assetIdsInUse.has(assetId)) { delete document.assets[assetId]; } }); if (version !== newVersion) { if (version < 14) { Object.values(document.pages).forEach((page) => { Object.values(page.shapes).filter((shape) => shape.type === TLV1ShapeType.Text).forEach((shape) => { if (shape.style.font === void 0) { ; shape.style.font = TLV1FontStyle.Script; } }); }); } if (version <= 13) { Object.values(document.pages).forEach((page) => { Object.values(page.bindings).forEach((binding) => { Object.assign(binding, binding.meta); }); Object.values(page.shapes).forEach((shape) => { Object.entries(shape.style).forEach(([id, style]) => { if (typeof style === "string") { shape.style[id] = style.toLowerCase(); } }); if (shape.type === TLV1ShapeType.Arrow) { if (shape.decorations) { Object.entries(shape.decorations).forEach(([id, decoration]) => { if (decoration === "Arrow") { shape.decorations = { ...shape.decorations, [id]: TLV1Decoration.Arrow }; } }); } } }); }); } if (version <= 13.1 && document.name == null) { document.name = "New Document"; } if (version < 15 && document.assets == null) { document.assets = {}; } Object.values(document.pages).forEach((page) => { Object.values(page.shapes).forEach((shape) => { if (version < 15.2) { if ((shape.type === TLV1ShapeType.Image || shape.type === TLV1ShapeType.Video) && shape.style.isFilled == null) { shape.style.isFilled = true; } } if (version < 15.3) { if (shape.type === TLV1ShapeType.Rectangle || shape.type === TLV1ShapeType.Triangle || shape.type === TLV1ShapeType.Ellipse || shape.type === TLV1ShapeType.Arrow) { if ("text" in shape && typeof shape.text === "string") { shape.label = shape.text; } if (!shape.label) { shape.label = ""; } if (!shape.labelPoint) { shape.labelPoint = [0.5, 0.5]; } } } }); }); } Object.values(document.pageStates).forEach((pageState) => { pageState.selectedIds = pageState.selectedIds.filter((id) => { return document.pages[pageState.id].shapes[id] !== void 0; }); pageState.bindingId = void 0; pageState.editingId = void 0; pageState.hoveredId = void 0; pageState.pointedId = void 0; }); document.version = newVersion; return document; } const TLV1ShapeType = { Sticky: "sticky", Ellipse: "ellipse", Rectangle: "rectangle", Triangle: "triangle", Draw: "draw", Arrow: "arrow", Text: "text", Group: "group", Image: "image", Video: "video" }; const TLV1ColorStyle = { White: "white", LightGray: "lightGray", Gray: "gray", Black: "black", Green: "green", Cyan: "cyan", Blue: "blue", Indigo: "indigo", Violet: "violet", Red: "red", Orange: "orange", Yellow: "yellow" }; const TLV1SizeStyle = { Small: "small", Medium: "medium", Large: "large" }; const TLV1DashStyle = { Draw: "draw", Solid: "solid", Dashed: "dashed", Dotted: "dotted" }; const TLV1AlignStyle = { Start: "start", Middle: "middle", End: "end", Justify: "justify" }; const TLV1FontStyle = { Script: "script", Sans: "sans", Serif: "serif", Mono: "mono" }; const TLV1Decoration = { Arrow: "arrow" }; const TLV1AssetType = { Image: "image", Video: "video" }; const v1ColorsToV2Colors = { [TLV1ColorStyle.White]: "black", [TLV1ColorStyle.Black]: "black", [TLV1ColorStyle.LightGray]: "grey", [TLV1ColorStyle.Gray]: "grey", [TLV1ColorStyle.Green]: "light-green", [TLV1ColorStyle.Cyan]: "green", [TLV1ColorStyle.Blue]: "light-blue", [TLV1ColorStyle.Indigo]: "blue", [TLV1ColorStyle.Orange]: "orange", [TLV1ColorStyle.Yellow]: "yellow", [TLV1ColorStyle.Red]: "red", [TLV1ColorStyle.Violet]: "light-violet" }; const v1FontsToV2Fonts = { [TLV1FontStyle.Mono]: "mono", [TLV1FontStyle.Sans]: "sans", [TLV1FontStyle.Script]: "draw", [TLV1FontStyle.Serif]: "serif" }; const v1AlignsToV2Aligns = { [TLV1AlignStyle.Start]: "start", [TLV1AlignStyle.Middle]: "middle", [TLV1AlignStyle.End]: "end", [TLV1AlignStyle.Justify]: "start" }; const v1TextAlignsToV2TextAligns = { [TLV1AlignStyle.Start]: "start", [TLV1AlignStyle.Middle]: "middle", [TLV1AlignStyle.End]: "end", [TLV1AlignStyle.Justify]: "start" }; const v1TextSizesToV2TextSizes = { [TLV1SizeStyle.Small]: "s", [TLV1SizeStyle.Medium]: "l", [TLV1SizeStyle.Large]: "xl" }; const v1SizesToV2Sizes = { [TLV1SizeStyle.Small]: "m", [TLV1SizeStyle.Medium]: "l", [TLV1SizeStyle.Large]: "xl" }; const v1DashesToV2Dashes = { [TLV1DashStyle.Solid]: "solid", [TLV1DashStyle.Dashed]: "dashed", [TLV1DashStyle.Dotted]: "dotted", [TLV1DashStyle.Draw]: "draw" }; function getV2Color(color) { return color ? v1ColorsToV2Colors[color] ?? "black" : "black"; } function getV2Font(font) { return font ? v1FontsToV2Fonts[font] ?? "draw" : "draw"; } function getV2Align(align) { return align ? v1AlignsToV2Aligns[align] ?? "middle" : "middle"; } function getV2TextAlign(align) { return align ? v1TextAlignsToV2TextAligns[align] ?? "middle" : "middle"; } function getV2TextSize(size) { return size ? v1TextSizesToV2TextSizes[size] ?? "m" : "m"; } function getV2Size(size) { return size ? v1SizesToV2Sizes[size] ?? "l" : "l"; } function getV2Dash(dash) { return dash ? v1DashesToV2Dashes[dash] ?? "draw" : "draw"; } function getV2Point(point) { return { x: coerceNumber(point[0]), y: coerceNumber(point[1]), z: point[2] == null ? 0.5 : coerceNumber(point[2]) }; } function getV2Arrowhead(decoration) { return decoration === TLV1Decoration.Arrow ? "arrow" : "none"; } function getV2Fill(isFilled, color) { return isFilled ? color === TLV1ColorStyle.Black || color === TLV1ColorStyle.White ? "semi" : "solid" : "none"; } //# sourceMappingURL=buildFromV1Document.js.map