Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

Merge branch 'main' of github.com:webstudio-is/webstudio-designer into redesign-assets

Sara Vieira4d74341c9292
diff --cc apps/designer/app/routes/rest/assets.$projectId.ts
index 0000000000,0000000000..3ef2076b1b
new file mode 100644
--- /dev/null
+++ b/apps/designer/app/routes/rest/assets.$projectId.ts
@@@ -1,0 -1,0 +1,54 @@@
++import type { ActionFunction } from "@remix-run/node";
++
++import { uploadAssets } from "~/shared/db/misc.server";
++import { deleteAsset } from "@webstudio-is/asset-uploader/index.server";
++import { zfd } from "zod-form-data";
++import { Asset } from "@webstudio-is/prisma-client";
++
++const deleteAssetSchema = zfd.formData({
++ assetId: zfd.text(),
++ assetName: zfd.text(),
++});
++
++export const action: ActionFunction = async ({ params, request }) => {
++ if (params.projectId === undefined) throw new Error("Project id undefined");
++ try {
++ if (request.method === "DELETE") {
++ const { assetId, assetName } = deleteAssetSchema.parse(
++ await request.formData()
++ );
++ const deletedAsset = await deleteAsset({
++ id: assetId,
++ name: assetName,
++ });
++
++ return { deletedAsset };
++ }
++ } catch (error) {
++ if (error instanceof Error) {
++ return {
++ errors: error.message,
++ };
++ }
++ }
++ if (request.method === "POST") {
++ try {
++ const assets = await uploadAssets({
++ request,
++ projectId: params.projectId,
++ });
++ return {
++ uploadedAssets: assets.map((asset: Asset) => ({
++ ...asset,
++ status: "uploaded",
++ })),
++ };
++ } catch (error) {
++ if (error instanceof Error) {
++ return {
++ errors: error.message,
++ };
++ }
++ }
++ }
++};
diff --cc packages/design-system/src/components/text.tsx
index 5f23dc3f48,065fdb33d3..c0a26a52df
--- a/packages/design-system/src/components/text.tsx
+++ b/packages/design-system/src/components/text.tsx
@@@ -1,115 -1,51 +1,102 @@@
import { styled } from "../stitches.config";
+ /**
+ * For use as a standalone, single-line text element. If you need a multiline element - use Paragraph.
+ */
export const Text = styled("div", {
// Reset
- lineHeight: "1",
- margin: "0",
- fontWeight: 400,
- fontVariantNumeric: "tabular-nums",
- display: "block",
+ margin: 0,
+ lineHeight: 1,
userSelect: "none",
+ fontFamily: "$sans",
variants: {
- variant: {
- regular: {
- fontWeight: 400,
- fontSize: 12,
- letterSpacing: "0.005em",
- },
- label: {
- fontWeight: 500,
- fontSize: 12,
- letterSpacing: "0.005em",
- },
- tiny: {
- fontWeight: 400,
- fontSize: 8,
- letterSpacing: "0.01em",
- },
- title: {
- fontWeight: 700,
- fontSize: 12,
- letterSpacing: "0.01em",
- },
- mono: {
- fontFamily: "$mono",
- fontWeight: 400,
- fontSize: 12,
- textTransform: "uppercase",
- },
- unit: {
- fontWeight: 500,
- fontSize: 10,
- lineHeight: 12,
- textTransform: "uppercase",
+ size: {
+ "1": {
+ fontSize: "$1",
+ },
+ "2": {
+ fontSize: "$2",
+ },
+ "3": {
+ fontSize: "$3",
+ },
+ "4": {
+ fontSize: "$4",
+ },
+ "5": {
+ fontSize: "$5",
+ letterSpacing: "-.015em",
+ },
+ "6": {
+ fontSize: "$6",
+ letterSpacing: "-.016em",
+ },
+ "7": {
+ fontSize: "$7",
+ letterSpacing: "-.031em",
+ textIndent: "-.005em",
+ },
+ "8": {
+ fontSize: "$8",
+ letterSpacing: "-.034em",
+ textIndent: "-.018em",
+ },
+ "9": {
+ fontSize: "$9",
+ letterSpacing: "-.055em",
+ textIndent: "-.025em",
},
},
- weight: {
- "500": {
- fontWeight: 500,
- },
- "700": {
- fontWeight: 700,
- },
- "600": {
- fontWeight: 600,
- },
- "300": {
- fontWeight: 300,
- },
- },
- color: {
+ variant: {
+ red: {
+ color: "$red11",
+ },
+ crimson: {
+ color: "$crimson11",
+ },
+ pink: {
+ color: "$pink11",
+ },
+ purple: {
+ color: "$purple11",
+ },
+ violet: {
+ color: "$violet11",
+ },
+ indigo: {
+ color: "$indigo11",
+ },
+ blue: {
+ color: "$blue11",
+ },
+ cyan: {
+ color: "$cyan11",
+ },
+ teal: {
+ color: "$teal11",
+ },
+ green: {
+ color: "$green11",
+ },
+ lime: {
+ color: "$lime11",
+ },
+ yellow: {
+ color: "$yellow11",
+ },
+ orange: {
+ color: "$orange11",
+ },
+ gold: {
+ color: "$gold11",
+ },
+ bronze: {
+ color: "$bronze11",
+ },
+ gray: {
+ color: "$slate11",
+ },
contrast: {
color: "$hiContrast",
},
diff --cc packages/react-sdk/src/components/index.test.ts
index 0000000000,a2e3fd8cb3..a3b863d31f
mode 000000,100644..100644
--- a/packages/react-sdk/src/components/index.test.ts
+++ b/packages/react-sdk/src/components/index.test.ts
@@@ -1,0 -1,9 +1,12 @@@
+ import * as components from "./index";
+ import { WsComponentMetaSchema } from "./component-type";
+
-test.each(Object.entries(components))("validating meta definition of %s", (name, component) => {
- if (name === "default") {
- return;
++test.each(Object.entries(components))(
++ "validating meta definition of %s",
++ (name, component) => {
++ if (name === "default") {
++ return;
++ }
++ WsComponentMetaSchema.parse(component);
+ }
- WsComponentMetaSchema.parse(component);
-});
++);