diff --git a/CHANGELOG.md b/CHANGELOG.md index f665b8f..a225e2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixed +- Fixed transparent variants and shade/tint counts for RAW colors that reference another variable, such as `var(--bg-body)`. Generated variants now follow the current source color, while manually edited swatches are preserved. Older saved swatches without edit history are left unchanged on load; use Reset on a stale swatch to return it to automatic generation, then save to update the site's CSS. - Fixed the block editor going blank with the Core Framework Gutenberg integration enabled. The editor script was loaded with an outdated, hard-coded dependency list that left out WordPress's `react-jsx-runtime`, so rendering the Core Framework class panel threw on an undefined `ReactJSXRuntime` and took the whole editor down. The script now loads the dependencies its build declares. - Fixed saving from the Figma plugin to a connected WordPress site, which waited 15 seconds and then reported "Failed to sync css with Figma" and "Failed to update project" even though the changes had reached the site. The plugin handed WordPress's reply back under the wrong message type, so the editor never recognised it. Builder synchronization now also waits for the stylesheet and project to finish saving, so Bricks global variables, color swatches and the Style Manager show the values you just saved, including on projects that define variables but no classes. An empty class list no longer creates a blank Oxygen selector. - Stopped disabled shades and tints from appearing as variables in the Oxygen and Bricks builders. The generated CSS already left out a color's shades or tints once you switched them off, but the builder variable dropdowns and Oxygen Classic's Alt-click variable panel still listed them, so picking one pointed at a custom property that did not exist. diff --git a/bun.lock b/bun.lock index 232f475..ce5d7a8 100644 --- a/bun.lock +++ b/bun.lock @@ -75,7 +75,7 @@ }, "packages/figma": { "name": "core-framework-figma", - "version": "2.0.0", + "version": "2.0.2", "dependencies": { "@fontsource-variable/inter": "^5.3.0", "colord": "^2.9.3", @@ -102,7 +102,7 @@ }, "packages/gutenberg": { "name": "coreframework-gutenberg-integration", - "version": "2.0.0", + "version": "2.0.2", "devDependencies": { "@wordpress/block-editor": "^16.1.0", "@wordpress/browserslist-config": "^6.53.0", @@ -119,7 +119,7 @@ }, "packages/wp": { "name": "coreframework", - "version": "2.0.0", + "version": "2.0.2", "dependencies": { "@adobe/react-spectrum": "^3.47.3", "@core-framework/core": "workspace:*", @@ -167,7 +167,7 @@ }, "packages/www": { "name": "core-framework", - "version": "2.0.0", + "version": "2.0.2", "dependencies": { "@adobe/react-spectrum": "^3.47.3", "@core-framework/core": "workspace:*", @@ -220,6 +220,7 @@ "fast-uri": "3.1.5", "flatted": "3.4.4", "follow-redirects": "1.16.0", + "handlebars": "4.7.10", "http-proxy-middleware": "2.0.10", "ip-address": "10.5.0", "js-yaml": "4.3.1", @@ -229,6 +230,8 @@ "micromatch": "4.0.8", "nanoid": "3.3.18", "postcss": "8.5.26", + "proxy-addr": "2.0.8", + "shell-quote": "1.11.0", "svgo": "3.3.4", "websocket-driver": "0.7.5", "yaml": "1.10.3", @@ -2338,7 +2341,7 @@ "handle-thing": ["handle-thing@2.0.1", "", {}, "sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg=="], - "handlebars": ["handlebars@4.7.9", "", { "dependencies": { "minimist": "^1.2.5", "neo-async": "^2.6.2", "source-map": "^0.6.1", "wordwrap": "^1.0.0" }, "optionalDependencies": { "uglify-js": "^3.1.4" }, "bin": { "handlebars": "bin/handlebars" } }, "sha512-4E71E0rpOaQuJR2A3xDZ+GM1HyWYv1clR58tC8emQNeQe3RH7MAzSbat+V0wG78LQBo6m6bzSG/L4pBuCsgnUQ=="], + "handlebars": ["handlebars@4.7.10", "", { "dependencies": { "minimist": "^1.2.8", "neo-async": "^2.6.2", "source-map": "^0.6.1", "wordwrap": "^1.0.0" }, "optionalDependencies": { "uglify-js": "^3.1.4" }, "bin": { "handlebars": "bin/handlebars" } }, "sha512-P5VJMVM7qgBn6vjXMw8WG9uVI+ncf2pi72j4de4yz5ZULLj2RGqLYaKOYGsgyrViQ0tePOVlN1tDCCXXtFqXKg=="], "hard-rejection": ["hard-rejection@2.1.0", "", {}, "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA=="], @@ -3178,7 +3181,7 @@ "prop-types": ["prop-types@15.8.1", "", { "dependencies": { "loose-envify": "^1.4.0", "object-assign": "^4.1.1", "react-is": "^16.13.1" } }, "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg=="], - "proxy-addr": ["proxy-addr@2.0.7", "", { "dependencies": { "forwarded": "0.2.0", "ipaddr.js": "1.9.1" } }, "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg=="], + "proxy-addr": ["proxy-addr@2.0.8", "", { "dependencies": { "forwarded": "0.2.0", "ipaddr.js": "1.9.1" } }, "sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ=="], "proxy-agent": ["proxy-agent@6.5.0", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "^4.3.4", "http-proxy-agent": "^7.0.1", "https-proxy-agent": "^7.0.6", "lru-cache": "^7.14.1", "pac-proxy-agent": "^7.1.0", "proxy-from-env": "^1.1.0", "socks-proxy-agent": "^8.0.5" } }, "sha512-TmatMXdr2KlRiA2CyDu8GqR8EjahTG3aY3nXjdzFyoZbmB8hrBsTyMezhULIXKnC0jpfjlmiZ3+EaCzoInSu/A=="], @@ -3386,7 +3389,7 @@ "shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="], - "shell-quote": ["shell-quote@1.9.0", "", {}, "sha512-Iov+JwFv/2HcTpcwNMKd8+IWNb8tboQJNQTkAY/LLVK7gGH9jy+LGkVqPxfekHl+yMmiqXszdGWXgkfml7hjqA=="], + "shell-quote": ["shell-quote@1.11.0", "", {}, "sha512-JdxDPD0DBTyu08pq0kPC0xSNet/qsU07qT6IsX1AS8oO2ICNRY4ldNa8OAI6PuwAH8tG3lxEhbqmyp4Dw4036g=="], "shimmer": ["shimmer@1.2.1", "", {}, "sha512-sQTKC1Re/rM6XyFM6fIAGHRPVGvyXfgzIDvzoq608vM+jeyVD0Tu1E6Np0Kc2zAIFWIj963V2800iF/9LPieQw=="], diff --git a/docs.md b/docs.md index b9da13e..0314b55 100644 --- a/docs.md +++ b/docs.md @@ -71,6 +71,8 @@ The project schema is defined in the shared core and describes: - breakpoints and responsive settings - project preferences and version information +Color shade/tint entries support an optional `isCustom` flag: `false` identifies an automatically generated swatch, `true` preserves a manual edit, and an absent flag represents older data with unknown edit history. Reset returns a swatch to automatic generation. Loading a preset refreshes known automatic variants of RAW variable references using the current color data, while preserving custom and unclassified older swatches. This normalization is independent of the existing versioned migrations; older presets remain valid without the new field, and color IDs and variant names are unchanged. + The usual load flow is: 1. Load project data from browser storage, WordPress, or an explicit import. diff --git a/package.json b/package.json index a9902c5..d28b20e 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "fast-uri": "3.1.5", "flatted": "3.4.4", "follow-redirects": "1.16.0", + "handlebars": "4.7.10", "http-proxy-middleware": "2.0.10", "ip-address": "10.5.0", "js-yaml": "4.3.1", @@ -35,6 +36,8 @@ "micromatch": "4.0.8", "nanoid": "3.3.18", "postcss": "8.5.26", + "proxy-addr": "2.0.8", + "shell-quote": "1.11.0", "svgo": "3.3.4", "websocket-driver": "0.7.5", "yaml": "1.10.3" diff --git a/packages/core/src/components/modules/colorSystem/components/ColorAdditionalVariations.tsx b/packages/core/src/components/modules/colorSystem/components/ColorAdditionalVariations.tsx index dbc19d7..03dff37 100644 --- a/packages/core/src/components/modules/colorSystem/components/ColorAdditionalVariations.tsx +++ b/packages/core/src/components/modules/colorSystem/components/ColorAdditionalVariations.tsx @@ -1,7 +1,8 @@ -import { ChangeEvent, memo, useCallback, useMemo, useState } from "react"; +import { ChangeEvent, memo, useCallback, useMemo } from "react"; import { Info } from "assets/icons/Info.icon"; import { NumberInput } from "components/basic/NumberInput"; import { Tooltip } from "components/ui/Tooltip"; +import { useGetColor } from "hooks/useGetColor"; import { getColorOnIndex } from "../functions/getColorOnIndex"; import { ColorFormatValue, ColorItem, DEFAULT_SHADES_COUNT, DEFAULT_TINTS_COUNT, Shade } from "../index"; import { Collapse, Switch } from "@mantine/core"; @@ -12,12 +13,12 @@ const getInitialVariation = (color: ColorItem, variant: Variant): VariantValues if (variant === "shade") { return { isActive: color.isShades ?? false, - number: color.shadesNumber || DEFAULT_SHADES_COUNT, + number: color.shadesNumber || color.shades?.length || DEFAULT_SHADES_COUNT, }; } else { return { isActive: color.isTints ?? false, - number: color.tintsNumber || DEFAULT_TINTS_COUNT, + number: color.tintsNumber || color.tints?.length || DEFAULT_TINTS_COUNT, }; } }; @@ -33,12 +34,13 @@ interface ColorAdditionalVariations { color: ColorItem; variant: Variant; onChange: (value: VariantValues) => void; - onUpdateColor: (value: string, index: number, isDark: boolean) => void; + onUpdateColor: (value: string, index: number, isDark: boolean, reset?: boolean) => void; } export const ColorAdditionalVariations = memo( ({ color, variant, onChange, onUpdateColor }) => { - const [variation, setVariation] = useState(() => getInitialVariation(color, variant)); + const variation = getInitialVariation(color, variant); + const { colorVariables } = useGetColor(); const items = useMemo(() => (variant === "shade" ? color.shades : color.tints), [color, variant]); const darkItems = useMemo(() => (variant === "shade" ? color.darkShades : color.darkTints), [color, variant]); @@ -46,7 +48,6 @@ export const ColorAdditionalVariations = memo( const handleSwitchChange = useCallback( ({ target: { checked } }: ChangeEvent) => { onChange({ ...variation, isActive: checked }); - setVariation((prev) => ({ ...prev, isActive: checked })); }, [onChange, variation], ); @@ -54,7 +55,6 @@ export const ColorAdditionalVariations = memo( const handleNumberChange = useCallback( (value: number | string) => { onChange({ ...variation, number: Number(value) }); - setVariation((prev) => ({ ...prev, number: Number(value) })); }, [onChange, variation], ); @@ -72,7 +72,7 @@ export const ColorAdditionalVariations = memo(