diff --git a/apps/docs/CHANGELOG.md b/apps/docs/CHANGELOG.md new file mode 100644 index 00000000..abd0f141 --- /dev/null +++ b/apps/docs/CHANGELOG.md @@ -0,0 +1,10 @@ +# docs + +## 0.0.1 + +### Patch Changes + +- 159bfb1: Bump react and @types/react +- Updated dependencies [159bfb1] +- Updated dependencies [167af9a] + - @compai/css-gui@0.0.92 diff --git a/apps/docs/components/Header.tsx b/apps/docs/components/Header.tsx index a5c0b0aa..3824e190 100644 --- a/apps/docs/components/Header.tsx +++ b/apps/docs/components/Header.tsx @@ -12,8 +12,8 @@ export const Header = () => { fontFamily: 'body', borderBottom: 'thin solid', borderColor: 'border', + height: '54px', px: 3, - py: 3, position: 'sticky', width: '100%', backgroundColor: 'background', @@ -38,7 +38,7 @@ export const Header = () => { - + { - + + Docs + + + + @@ -76,7 +91,7 @@ export const Header = () => { sx={{ textDecoration: 'none', color: 'currentColor', - fontWeight: 600, + fontWeight: 700, transition: 'color .2s ease-in-out', px: 3, fontSize: [0, 1, 1], diff --git a/apps/docs/components/Nav.tsx b/apps/docs/components/Nav.tsx index 1017a4ba..f7f3d832 100644 --- a/apps/docs/components/Nav.tsx +++ b/apps/docs/components/Nav.tsx @@ -1,13 +1,12 @@ -import { HTMLAttributes } from 'react' +import { HTMLAttributes, ReactNode } from 'react' import Link, { LinkProps } from 'next/link' import { useRouter } from 'next/router' -interface NavItemProps extends HTMLAttributes {} export const NavItem = ({ children, href, ...props -}: NavItemProps & LinkProps) => { +}: LinkProps & { children: ReactNode }) => { const router = useRouter() const isActive = router.asPath === href return ( @@ -26,8 +25,8 @@ export const NavItem = ({ py: 2, transition: 'color .2s ease-in-out', ':hover': { - color: isActive? 'background' : 'primary' - } + color: isActive ? 'background' : 'primary', + }, }} > {children} @@ -36,8 +35,7 @@ export const NavItem = ({ ) } -interface NavSectionTitleProps extends HTMLAttributes {} -export const NavSectionTitle = (props: NavSectionTitleProps) => { +export const NavSectionTitle = (props: HTMLAttributes) => { return (

{
diff --git a/apps/docs/components/Sidebar.tsx b/apps/docs/components/Sidebar.tsx index abb7ebf8..069e8327 100644 --- a/apps/docs/components/Sidebar.tsx +++ b/apps/docs/components/Sidebar.tsx @@ -6,7 +6,7 @@ export const Sidebar = () => {
) diff --git a/apps/docs/components/examples/BoxShadowPreview.tsx b/apps/docs/components/examples/BoxShadowPreview.tsx index 9bfddd68..61f389d7 100644 --- a/apps/docs/components/examples/BoxShadowPreview.tsx +++ b/apps/docs/components/examples/BoxShadowPreview.tsx @@ -45,7 +45,7 @@ export function BoxShadowPreview() { display: 'flex', alignItems: 'center', justifyContent: 'center', - backgroundImage: 'url(https://source.unsplash.com/random/1920x1080)', + backgroundImage: 'url(https://dlu344star2bj.cloudfront.net/i/3090-0015.jpg)', backgroundSize: 'cover', backgroundPosition: 'center center', transition: 'all .2s ease-in-out', diff --git a/apps/docs/components/examples/CardPreview.tsx b/apps/docs/components/examples/CardPreview.tsx index f80d3a18..457067eb 100644 --- a/apps/docs/components/examples/CardPreview.tsx +++ b/apps/docs/components/examples/CardPreview.tsx @@ -10,7 +10,7 @@ export const CardPreview = () => { <>
- +

Heading

Body text

diff --git a/apps/docs/components/examples/ColorPicker.tsx b/apps/docs/components/examples/ColorPicker.tsx index 96753608..858545a1 100644 --- a/apps/docs/components/examples/ColorPicker.tsx +++ b/apps/docs/components/examples/ColorPicker.tsx @@ -1,13 +1,14 @@ import { useState } from 'react' import { ColorPopover } from '@compai/css-gui' +import { defaultTheme } from '../../data/default-theme' export const ColorPickerExample = () => { const [color, setColor] = useState('tomato') return ( <> - -

I am {color}!

+ +

I am {color}!

) } diff --git a/apps/docs/components/examples/Demo.tsx b/apps/docs/components/examples/Demo.tsx index 83571005..b0669101 100644 --- a/apps/docs/components/examples/Demo.tsx +++ b/apps/docs/components/examples/Demo.tsx @@ -90,7 +90,7 @@ export function Demo() {
-
+
 {
   const [value, setValue] = useState({
@@ -14,6 +10,7 @@ export const DimensionExample = () => {
     
- + diff --git a/apps/docs/components/examples/FlexDirectionPreview.tsx b/apps/docs/components/examples/FlexDirectionPreview.tsx new file mode 100644 index 00000000..d5cc4e6d --- /dev/null +++ b/apps/docs/components/examples/FlexDirectionPreview.tsx @@ -0,0 +1,139 @@ +import { useState } from 'react' +import Link from 'next/link' +import { Editor, Inputs, styled, codegen } from '@compai/css-gui' +import { initialStyles } from '../../data/initial-styles-flex-direction-preview' +import { defaultTheme } from '../../data/default-theme' + +export function FlexDirectionPreview() { + const [styles, setStyles] = useState(initialStyles) + + return ( + <> + + + ) +} diff --git a/apps/docs/components/examples/FlexGrowPreview.tsx b/apps/docs/components/examples/FlexGrowPreview.tsx new file mode 100644 index 00000000..346c002c --- /dev/null +++ b/apps/docs/components/examples/FlexGrowPreview.tsx @@ -0,0 +1,81 @@ +import { useState } from 'react' +import Link from 'next/link' +import { Editor, Inputs, styled, codegen } from '@compai/css-gui' +import { initialStyles } from '../../data/initial-styles-flex-grow-preview' +import { defaultTheme } from '../../data/default-theme' + +export function FlexGrowPreview() { + const [styles, setStyles] = useState(initialStyles) + + return ( + <> + + + ) +} diff --git a/apps/docs/components/examples/FlexShrinkPreview.tsx b/apps/docs/components/examples/FlexShrinkPreview.tsx new file mode 100644 index 00000000..9d68bb2a --- /dev/null +++ b/apps/docs/components/examples/FlexShrinkPreview.tsx @@ -0,0 +1,82 @@ +import { useState } from 'react' +import Link from 'next/link' +import { Editor, Inputs, styled, codegen } from '@compai/css-gui' +import { initialStyles } from '../../data/initial-styles-flex-shrink-preview' +import { defaultTheme } from '../../data/default-theme' + +export function FlexShrinkPreview() { + const [styles, setStyles] = useState(initialStyles) + + return ( + <> + + + ) +} diff --git a/apps/docs/components/examples/FlexWrapPreview.tsx b/apps/docs/components/examples/FlexWrapPreview.tsx new file mode 100644 index 00000000..0ca08093 --- /dev/null +++ b/apps/docs/components/examples/FlexWrapPreview.tsx @@ -0,0 +1,82 @@ +import { useState } from 'react' +import Link from 'next/link' +import { Editor, Inputs, styled, codegen } from '@compai/css-gui' +import { initialStyles } from '../../data/initial-styles-flex-wrap-preview' +import { defaultTheme } from '../../data/default-theme' + +export function FlexWrapPreview() { + const [styles, setStyles] = useState(initialStyles) + + return ( + <> + + + ) +} diff --git a/apps/docs/components/examples/FontSizePreview.tsx b/apps/docs/components/examples/FontSizePreview.tsx index da0c0351..1eae57c7 100644 --- a/apps/docs/components/examples/FontSizePreview.tsx +++ b/apps/docs/components/examples/FontSizePreview.tsx @@ -1,5 +1,4 @@ import { useState } from 'react' -import Link from 'next/link' import { Editor, Inputs, styled, codegen } from '@compai/css-gui' import { initialStyles } from '../../data/initial-styles-font-size-preview' import { defaultTheme } from '../../data/default-theme' @@ -9,69 +8,84 @@ export function FontSizePreview() { return ( <> - ) diff --git a/apps/docs/components/examples/JustifyContentPreview.tsx b/apps/docs/components/examples/JustifyContentPreview.tsx new file mode 100644 index 00000000..a6cf528a --- /dev/null +++ b/apps/docs/components/examples/JustifyContentPreview.tsx @@ -0,0 +1,82 @@ +import { useState } from 'react' +import Link from 'next/link' +import { Editor, Inputs, styled, codegen } from '@compai/css-gui' +import { initialStyles } from '../../data/initial-styles-justify-content-preview' +import { defaultTheme } from '../../data/default-theme' + +export function JustifyContentPreview() { + const [styles, setStyles] = useState(initialStyles) + + return ( + <> + + + ) +} diff --git a/apps/docs/components/examples/LinkPreview.tsx b/apps/docs/components/examples/LinkPreview.tsx index 1e4d32ee..a1505c55 100644 --- a/apps/docs/components/examples/LinkPreview.tsx +++ b/apps/docs/components/examples/LinkPreview.tsx @@ -9,26 +9,37 @@ export function LinkPreview() { return ( <> -
-
-
- {codegen.css(styles)} -
-
+
+            {codegen.css(styles)}
+          
+
) diff --git a/apps/docs/components/examples/MixBlendModePreview.tsx b/apps/docs/components/examples/MixBlendModePreview.tsx index 6096e437..1fc83291 100644 --- a/apps/docs/components/examples/MixBlendModePreview.tsx +++ b/apps/docs/components/examples/MixBlendModePreview.tsx @@ -36,7 +36,7 @@ export function MixBlendModePreview() { }}>
{ - const [value, setValue] = useState({ - value: 16, - unit: 'px', - }) - return ( -
-
- -
-
-        {JSON.stringify(value, null, 2)}
-      
-
- ) -} diff --git a/apps/docs/components/examples/Space.tsx b/apps/docs/components/examples/Space.tsx index 34842366..c0e6d1ff 100644 --- a/apps/docs/components/examples/Space.tsx +++ b/apps/docs/components/examples/Space.tsx @@ -1,17 +1,25 @@ import { useState } from 'react' -import { codegen, Editor, styled } from '@compai/css-gui' +import { + codegen, + Editor, + parseStyles, + styled, + toCSSObject, +} from '@compai/css-gui' export const SpaceExample = () => { - const [styles, setStyles] = useState({ - marginTop: { value: 1, unit: 'rem' }, - marginBottom: { value: 1, unit: 'rem' }, - marginLeft: { value: 1, unit: 'rem' }, - marginRight: { value: 1, unit: 'rem' }, - paddingTop: { value: 1, unit: 'rem' }, - paddingBottom: { value: 1, unit: 'rem' }, - paddingLeft: { value: 1, unit: 'rem' }, - paddingRight: { value: 1, unit: 'rem' }, - }) + const [styles, setStyles] = useState( + parseStyles({ + marginTop: '1rem', + marginBottom: '1rem', + marginLeft: '1rem', + marginRight: '1rem', + paddingTop: '1rem', + paddingBottom: '1rem', + paddingLeft: '1rem', + paddingRight: '1rem', + }) + ) return (
@@ -27,9 +35,9 @@ export const SpaceExample = () => {
- +

Fun with space! - +

{/** @ts-ignore */}
{codegen.css(styles)}
diff --git a/apps/docs/components/examples/TransitionPreview.tsx b/apps/docs/components/examples/TransitionPreview.tsx index 8efce0fb..768cb8e5 100644 --- a/apps/docs/components/examples/TransitionPreview.tsx +++ b/apps/docs/components/examples/TransitionPreview.tsx @@ -60,7 +60,7 @@ export function TransitionPreview() { alignItems: 'center', justifyContent: 'center', backgroundImage: - 'url(https://source.unsplash.com/random/1920x1080)', + 'url(https://dlu344star2bj.cloudfront.net/i/3090-0015.jpg)', backgroundSize: 'cover', backgroundPosition: 'center center', transition: 'all .2s ease-in-out', diff --git a/apps/docs/components/examples/TypographyGroup.tsx b/apps/docs/components/examples/TypographyGroup.tsx index b0a31862..e8e721d2 100644 --- a/apps/docs/components/examples/TypographyGroup.tsx +++ b/apps/docs/components/examples/TypographyGroup.tsx @@ -1,6 +1,7 @@ import { useState } from 'react' import { Editor, styled, Fieldset, Inputs, codegen } from '@compai/css-gui' +// This page isn't used right now so just comment it out to get it to build export const TypographyGroupExample = () => { const [styles, setStyles] = useState({}) @@ -12,19 +13,19 @@ export const TypographyGroupExample = () => {
<>

Heading

- + {/* */}
<>

Body

- + {/* */}
<>

Code

- + {/* */}
diff --git a/apps/docs/components/playground/Layout.tsx b/apps/docs/components/playground/Layout.tsx index f0caa7b5..08d14df5 100644 --- a/apps/docs/components/playground/Layout.tsx +++ b/apps/docs/components/playground/Layout.tsx @@ -9,8 +9,7 @@ export const Layout = (props: Props) => {
diff --git a/apps/docs/components/playground/Sidebar.tsx b/apps/docs/components/playground/Sidebar.tsx index cc8f2487..ee95640e 100644 --- a/apps/docs/components/playground/Sidebar.tsx +++ b/apps/docs/components/playground/Sidebar.tsx @@ -23,7 +23,8 @@ export const Sidebar = ({ borderLeftWidth: '1px', borderLeftStyle: 'solid', borderLeftColor: 'border', - py: [2, 3], + pt: [2, 3], + pb: 4, overflowY: 'auto', top: 0, right: 0, diff --git a/apps/docs/data/default-theme.ts b/apps/docs/data/default-theme.ts index 8bb9d15a..13b3167e 100644 --- a/apps/docs/data/default-theme.ts +++ b/apps/docs/data/default-theme.ts @@ -1,1282 +1,286 @@ -import { Theme } from '@compai/css-gui' - // https://components.ai/theme/asa9lvO69pQGyRn8ZAXL -export const defaultTheme: Theme = { - space: [ - { - unit: 'px', - id: '58d5c0a0-6a75-4392-bfdc-e8dfeeda70ef', - value: 0, - }, - { - id: '974b2e01-3213-4b1f-95b0-f878802cc9ff', - value: 2, - unit: 'px', - }, - { - unit: 'px', - value: 4, - id: 'ecdf306e-3251-4004-9af5-809a6a1038b1', - }, - { - id: '83b4c40c-af21-42b7-b9e8-51f2e5340d8f', - value: 8, - unit: 'px', - }, - { - id: '5faef71c-4826-460d-9da4-ca67dbc3338d', - unit: 'px', - value: 16, - }, - { - unit: 'px', - value: 32, - id: 'e9825590-d1ff-4e07-aec5-d205e69897a9', - }, - { - id: '938993bb-27a0-45d0-94e9-d420587acb5e', - value: 64, - unit: 'px', - }, - { - id: '23b9eb4b-b6c0-4052-8340-0c730e6a413c', - value: 128, - unit: 'px', - }, - { - unit: 'px', - value: 256, - id: '337abd5e-282f-4fcb-b3d9-1001c9e58b51', - }, - { - id: '36be9986-a610-41d6-9263-9a713e9f9ee0', - unit: 'px', - value: 512, - }, - ], - lineHeights: [ - { - id: 'd7bc4a9b-2d57-4dc2-9452-89f8ae1009e5', - name: 'solid', - value: 1, - unit: 'number', - }, - { - value: 1.2, - id: '8c5d8db3-6126-4ad7-bb8e-80f147fd0694', - name: 'heading', - unit: 'number', - }, - { - name: 'body', - value: 1.4, - id: '77c1d900-f4fc-4f44-bcd7-1f3fa8c3fbd2', - unit: 'number', - }, - ], - borderWidths: [ - { - id: 'ba623e1e-efb0-4763-9c08-1087d9ff6314', - unit: 'px', - value: 1, - }, - { - value: 2, - unit: 'px', - id: '0c18d989-9abb-4935-8976-8be94b5ce64a', - }, - { - unit: 'px', - id: '4597893f-545e-4b83-bf32-be446b6232e3', - value: 4, - }, - { - value: 8, - id: '15698313-6770-4fb2-8d36-390f0597b419', - unit: 'px', - }, - ], +export const defaultTheme: any = { fontSizes: [ - { - id: '8a31d12c-5d8c-421d-a566-5a1b16d9633c', - unit: 'px', - value: 12, - }, - { - id: '982efd46-1bb5-447e-8e38-ff48170253c4', - value: 16, - unit: 'px', - }, - { - unit: 'px', - value: 24, - id: '97235cbe-e6a3-4f6a-bce9-18b6f5d0b551', - }, - { - value: 32, - unit: 'px', - id: 'd86f8c8b-1f99-4969-86e8-c28066b3db0d', - }, - { - value: 48, - unit: 'px', - id: '13729569-4cd7-49f8-aaf9-9f28d632508c', - }, - { - value: 64, - unit: 'px', - id: '8498c94f-066c-4186-b3aa-3120a15b4921', - }, - { - id: '037f7093-27e7-4a7b-b14a-722687d955c0', - value: 96, - unit: 'px', - }, - { - unit: 'px', - value: 128, - id: '98fd3a6e-bc02-4839-be76-2cc9cf7b117f', - }, - { - value: 256, - unit: 'px', - id: '6c57d38d-fe4e-481c-becd-0f963d2f9885', - }, + '12px', + '16px', + '24px', + '32px', + '48px', + '64px', + '96px', + '128px', + '256px', ], + name: 'Subtle', + space: [ + 0, + '2px', + '4px', + '8px', + '16px', + '32px', + '64px', + '128px', + '256px', + '512px', + ], + letterSpacings: { tracked: '0.1em', negative: '-0.05em', large: '0.25em' }, + lineHeights: { solid: 1, heading: 1.2, body: 1.4 }, + borderWidths: ['1px', '2px', '4px', '8px'], + fonts: { + heading: + "-apple-system, BlinkMacSystemFont, 'avenir next', avenir, 'helvetica neue', helvetica, Ubuntu, roboto, noto, segoe ui, arial, sans-serif", + code: '"SFMono-Regular",Consolas,"Liberation Mono",Menlo,Courier,monospace', + body: 'Inter', + }, + borderRadius: [0, '4px', '8px', '16px', '32px', '64px', '9999999px'], + breakpoints: [], borderStyles: [], - fonts: [ - { - meta: { - primaryFont: '-apple-system', - weights: [ - { - active: false, - id: 'ceb718ee-f0d0-4aad-8363-68b7e3c952d1', - weight: '100', - }, - { - active: false, - weight: '200', - id: 'da2ef064-b0d4-48f1-a07b-453412003d64', - }, - { - weight: '300', - id: '6cf90307-8150-49b6-8825-18978b6fffed', - active: false, - }, - { - weight: '400', - id: '13bd1b78-6de0-4837-8a35-e223a1f58be2', - active: false, - }, - { - id: '78a808c5-5ebf-4103-b354-bf9ec64d78cb', - weight: '500', - active: false, - }, - { - weight: '600', - id: 'caf20cec-d4bb-4a80-8140-3bdf4c3070ca', - active: false, - }, - { - weight: '700', - id: '6aa934ed-0518-4fc7-a9c5-910db661f92e', - active: false, - }, - { - weight: '800', - id: 'aa173be6-add9-4add-8b57-1e9b8110ec57', - active: false, - }, - { - id: '93a5138a-b7a4-4c16-8dd1-5c7ca645487c', - weight: '900', - active: false, - }, - ], + colors: { + gray: [ + '#000000', + '#1c1c1c', + '#303030', + '#474747', + '#5d5d5d', + '#757575', + '#8c8c8c', + '#a3a3a3', + '#bababa', + '#d1d1d1', + '#e8e8e8', + '#ffffff', + ], + 'blue-gray': [ + '#0e0e11', + '#21222a', + '#343544', + '#484a5e', + '#5c5f78', + '#717490', + '#8789a6', + '#9c9eba', + '#b1b3cb', + '#c6c8db', + '#dcdce9', + '#f1f1f6', + ], + blue: [ + '#0d0e1a', + '#182142', + '#1e336d', + '#254797', + '#325bbd', + '#476fde', + '#6284f6', + '#809aff', + '#9fb0ff', + '#bcc6ff', + '#d9deff', + '#f4f5ff', + ], + indigo: [ + '#120c1d', + '#211b4d', + '#2f297f', + '#3e38b0', + '#5049dd', + '#675bff', + '#8170ff', + '#9d87ff', + '#b7a0ff', + '#d0baff', + '#e5d6ff', + '#f7f1ff', + ], + violet: [ + '#170a1b', + '#321545', + '#501b71', + '#6d239d', + '#8a2fc5', + '#a641e7', + '#be58ff', + '#d374ff', + '#e392ff', + '#f0b1ff', + '#f9d0ff', + '#fef0ff', + ], + magenta: [ + '#170915', + '#381436', + '#5b1859', + '#7f1e7c', + '#a0289d', + '#bf3abb', + '#d853d2', + '#ea70e4', + '#f78ff0', + '#ffaef8', + '#ffcefc', + '#ffeefe', + ], + red: [ + '#19090a', + '#3e131a', + '#651829', + '#8d1d38', + '#b22749', + '#d23a5b', + '#ec5370', + '#ff7086', + '#ff909e', + '#ffb0b9', + '#ffd0d4', + '#fff0f1', + ], + orange: [ + '#200d02', + '#431706', + '#691e0a', + '#8e280d', + '#b13514', + '#d14721', + '#ea5e36', + '#fd7950', + '#ff9670', + '#ffb495', + '#ffd2be', + '#fff0e9', + ], + gold: [ + '#160f05', + '#402e11', + '#6e4d14', + '#9c6c18', + '#c68a20', + '#eba62e', + '#ffbe44', + '#ffd15e', + '#ffe07c', + '#ffeb9b', + '#fff3bc', + '#fffade', + ], + yellow: [ + '#0d0c04', + '#332f11', + '#585315', + '#7f7719', + '#a49a20', + '#c5ba2c', + '#e1d43f', + '#f6e857', + '#fff673', + '#fffe90', + '#ffffae', + '#ffffcc', + ], + lime: [ + '#161708', + '#323711', + '#505a15', + '#6e7c19', + '#8b9c22', + '#a6b932', + '#bed049', + '#d1e264', + '#e1ee83', + '#edf6a3', + '#f6fbc4', + '#fcfee6', + ], + green: [ + '#071209', + '#102816', + '#133f21', + '#18572d', + '#216f3b', + '#32864b', + '#499c60', + '#66b178', + '#85c492', + '#a7d6af', + '#cae7cf', + '#eef7ef', + ], + teal: [ + '#07110f', + '#102722', + '#133d35', + '#18544a', + '#216b5e', + '#328173', + '#499789', + '#65ac9e', + '#85c0b3', + '#a7d3c9', + '#cae5de', + '#eef7f4', + ], + cyan: [ + '#081111', + '#112627', + '#143c3e', + '#185356', + '#226a6d', + '#338084', + '#4b969a', + '#67abae', + '#87bfc1', + '#a8d2d4', + '#cbe4e5', + '#eef6f7', + ], + modes: { + default: { + background: '#ffffff', + text: '#000000', + border: '#d1d1d1', + primary: '#325bbd', + accent: '#000000', + muted: '#757575', }, - name: 'heading', - stack: - "-apple-system, BlinkMacSystemFont, 'avenir next', avenir, 'helvetica neue', helvetica, Ubuntu, roboto, noto, segoe ui, arial, sans-serif", - id: '70a1e9d0-0311-4164-80cb-c091f10d841f', - }, - { - stack: - "-apple-system, BlinkMacSystemFont, 'avenir next', avenir, 'helvetica neue', helvetica, Ubuntu, roboto, noto, segoe ui, arial, sans-serif", - name: 'body', - id: 'f237d226-cf79-4045-8c13-9591f68de238', - meta: { - weights: [ - { - id: '56d63179-f2f6-4987-8a85-4ff65b469787', - active: false, - weight: '100', - }, - { - weight: '200', - active: false, - id: '3ceb1359-b3ea-40dd-a364-d5560c93576e', - }, - { - weight: '300', - id: '7fb7abbd-c13f-47ac-8939-725681e1e57d', - active: false, - }, - { - weight: '400', - active: false, - id: '75b860fb-bc8b-40d4-95b7-e1c30071d073', - }, - { - weight: '500', - id: 'e0451c68-e9e7-40f7-b621-3394530dbb22', - active: false, - }, - { - id: '282c9d38-035b-4bc7-b196-912dd419001c', - active: false, - weight: '600', - }, - { - id: '34326a88-b6ed-4b60-8172-10e207f01a3b', - active: false, - weight: '700', - }, - { - weight: '800', - id: '7c94f91a-75ec-4586-a41e-76aaf8441feb', - active: false, - }, - { - id: '660e63aa-935a-461e-95e5-550dff750905', - weight: '900', - active: false, - }, - ], - primaryFont: '-apple-system', + dark: { + background: '#000000', + text: '#ffffff', + border: '#000000', + primary: '#476fde', + accent: '#ffffff', + muted: '#bababa', }, - }, - { - id: '3b997853-0e0d-42e9-9a70-6000a5963470', - meta: { - weights: [ - { - id: '96d11324-7d14-4671-bc37-5099806b43a5', - active: false, - weight: '100', - }, - { - weight: '200', - id: '7a112329-a269-41f0-a209-c2321c316aa3', - active: false, - }, - { - weight: '300', - active: false, - id: '2c20a725-77a4-400a-a711-3d8cc29e8b8d', - }, - { - id: '26d9bbe4-d472-4bc9-8d1e-1958f492c873', - weight: '400', - active: false, - }, - { - weight: '500', - id: '24215864-0fb0-4909-9e25-8e70b75a6244', - active: false, - }, - { - id: 'fadc3efb-bddb-4c8d-8154-794c963ee749', - weight: '600', - active: false, - }, - { - active: false, - id: 'bf23b5c9-0f08-4ee0-9f34-4f7a91588520', - weight: '700', - }, - { - weight: '800', - active: false, - id: 'b38d3098-5b52-46d2-ae25-4afe4e231dd8', - }, - { - id: '4c8e7059-6cf5-4681-9ac5-7ebd3730bb23', - active: false, - weight: '900', - }, - ], - primaryFont: 'SFMono-Regular', + dim: { + background: '#474747', + text: '#bababa', + border: '#303030', + primary: '#bababa', + accent: '#5d5d5d', + muted: '#bababa', }, - stack: - '"SFMono-Regular",Consolas,"Liberation Mono",Menlo,Courier,monospace', - name: 'mono', - }, - { - id: 'a866c078-4042-4583-94b4-8f28f94a159c', - name: 'Fenix', - stack: 'Fenix', - meta: { - primaryFont: 'Fenix', - weights: [ - { - active: false, - id: 'c482bed0-d789-49d9-9949-5c8751197fdf', - weight: '100', - }, - { - weight: '200', - id: 'd27455d4-da9c-47a1-940e-8c321d120706', - active: false, - }, - { - active: false, - id: '01bee9d4-fb6c-4c02-93aa-680bad91c5dd', - weight: '300', - }, - { - id: 'ac8c58f7-2c15-4a71-8281-ce5f2c1894b5', - weight: '400', - active: true, - }, - { - active: false, - id: 'c96fd4f3-bc87-4650-a57c-7f4b192be050', - weight: '500', - }, - { - active: false, - weight: '600', - id: '2f14dba8-4432-40e5-8eec-69f1796ffdf6', - }, - { - active: false, - weight: '700', - id: '512a3a2a-5cb8-4ea3-9a7c-7c1184da2ad0', - }, - { - active: false, - weight: '800', - id: '42fdcc76-7d57-4ab3-9324-6e28333d56b1', - }, - { - weight: '900', - id: '67a33239-83fc-4c10-8c59-52a914e6cca8', - active: false, - }, - ], - }, - }, - { - id: 'b390ca43-d5f3-4394-a802-fd366dc9c05c', - meta: { - primaryFont: 'Inter', - weights: [ - { - id: 'cb067b2e-a25f-4cfb-b16e-34a2333b20c0', - active: true, - weight: '100', - }, - { - weight: '200', - active: true, - id: '97152545-389a-4b6c-9b89-fff51e68c214', - }, - { - active: true, - id: 'fed420fb-290a-477b-8f30-eb6c5a845392', - weight: '300', - }, - { - weight: '400', - active: true, - id: '3c10c797-e07d-4b38-9f26-382f91a3eb4a', - }, - { - id: '8d9254f5-5a63-4ec8-b21c-77ec0ab8cace', - weight: '500', - active: true, - }, - { - weight: '600', - id: '45938ec5-807c-46cf-b2b8-517b0f459e6a', - active: true, - }, - { - id: '8ce95333-9aae-460b-a937-1efbd8d634dd', - active: true, - weight: '700', - }, - { - id: '55bf06a8-b931-4b8a-96a3-909842da28a0', - active: true, - weight: '800', - }, - { - weight: '900', - active: true, - id: 'e6bd057f-6d7a-473c-b29f-caeac5963dc9', - }, - ], + tomato: { + background: '#ffffff', + text: '#000000', + border: 'tomato', + primary: 'tomato', + accent: '#ff9670', + muted: '#757575', }, - name: 'Inter', - stack: 'Inter', - }, - ], - colors: [ - { - id: '676f89ae-fae2-431a-8576-bcac2ae60684', - name: 'gray', - colors: [ - { - value: '#000000', - id: '994f7c8f-aef5-489b-a544-d88a40ceb13d', - }, - { - id: 'e378c407-4949-4623-8e6d-46b51b1c801e', - value: '#1c1c1c', - }, - { - value: '#303030', - id: '85ac4df4-9025-4eaf-ae9d-b552dd63245e', - }, - { - id: 'bb5b9e33-0d96-470e-a836-b78a57e0f0b1', - value: '#474747', - }, - { - id: 'e33ef1f2-e24b-4d58-b54a-3326219c8a1b', - value: '#5d5d5d', - }, - { - id: 'ad0a1bff-23cd-44ed-9c62-e366b0bfd4c1', - value: '#757575', - }, - { - value: '#8c8c8c', - id: 'ea8cac04-081d-454f-ad4d-aae4be5d4683', - }, - { - id: '382d108d-a19d-4f3a-8d60-b530493a8ffc', - value: '#a3a3a3', - }, - { - value: '#bababa', - id: 'be8f6fbe-5ac1-4289-9c50-2e576408e0f1', - }, - { - id: '9d6fcc0d-baae-4c5e-8c03-ec0977be7e5d', - value: '#d1d1d1', - }, - { - id: '94918e4c-bd26-4325-b1e1-c1ac34bd55ca', - value: '#e8e8e8', - }, - { - value: '#ffffff', - id: '01806302-31fc-48d1-aa95-ab59c2019557', - }, - ], - }, - { - colors: [ - { - id: 'ebc22887-ad18-449e-9dac-74090c4c361a', - value: '#0e0e11', - }, - { - id: 'a14b6760-ce4e-48c8-a0d0-53cb20afe964', - value: '#21222a', - }, - { - id: 'ab087c80-4eed-4f0e-a21c-92aadafa2646', - value: '#343544', - }, - { - value: '#484a5e', - id: '7f3cf506-f63e-4985-b039-7992f0614fef', - }, - { - value: '#5c5f78', - id: 'd6618749-954b-412e-8fcf-59f3a2147766', - }, - { - id: 'd619306e-cbfd-43b8-acc5-5b3c27cdd37b', - value: '#717490', - }, - { - id: '73c8c94f-c738-42c4-9a71-3fd1e1624259', - value: '#8789a6', - }, - { - value: '#9c9eba', - id: 'fc5bbe63-1a36-431f-8482-a08ea1d8e387', - }, - { - id: 'be220929-ef59-4ae8-9d8c-d3cd6aa977d1', - value: '#b1b3cb', - }, - { - id: '88143b5d-f9a4-4311-8db6-82f7cb3462bf', - value: '#c6c8db', - }, - { - value: '#dcdce9', - id: '6c414d57-6aff-4759-a05a-5884082cc853', - }, - { - id: 'dbab9712-54e3-4923-8d37-8167f3c6a604', - value: '#f1f1f6', - }, - ], - name: 'blueGray', - id: 'ede541e8-f47a-49a1-986c-e94561f5ab6e', - }, - { - colors: [ - { - id: '22951c33-c96b-4e31-ba3a-018ebc86ebb0', - value: '#0d0e1a', - }, - { - value: '#182142', - id: '32ecb274-dc20-48e7-8122-73d825b85bde', - }, - { - id: 'add83b2e-d6b4-4452-bbc3-218bf3a9d83a', - value: '#1e336d', - }, - { - id: 'df432569-9c0d-4a2e-9d52-13be85f44ffa', - value: '#254797', - }, - { - id: '55863c15-36b1-4ce0-851c-03d69442aa28', - value: '#325bbd', - }, - { - id: 'b06e4108-57be-4313-b0c1-4fb957979762', - value: '#476fde', - }, - { - id: 'c0ae9fcc-922b-4dd3-aca5-444f0f76b9e8', - value: '#6284f6', - }, - { - id: '5c519758-18eb-449f-a7d9-41ff2b4572de', - value: '#809aff', - }, - { - value: '#9fb0ff', - id: '00087aae-03bb-4df5-9371-5c5fdcdc01a6', - }, - { - value: '#bcc6ff', - id: 'd521c703-de49-4d93-b452-f379eef24677', - }, - { - value: '#d9deff', - id: '33e7b08d-1c36-444a-a285-98a040859e21', - }, - { - value: '#f4f5ff', - id: '82716009-7f2f-463e-a956-614fe2909494', - }, - ], - id: 'faf999a6-b94b-49d9-9d76-849c1f27405a', - name: 'blue', - }, - { - id: '46099834-dc24-4836-b6bb-694af3484f81', - name: 'indigo', - colors: [ - { - value: '#120c1d', - id: '5fa282c2-583d-4452-9877-c90d1ea6c7ca', - }, - { - id: 'a508ddc5-3e98-4eb3-ab2c-202b03e6ac45', - value: '#211b4d', - }, - { - value: '#2f297f', - id: '42b92b7c-1279-4fca-930e-50851539dd20', - }, - { - id: '89c53ffb-4c04-44f5-9a46-fcf30dd05703', - value: '#3e38b0', - }, - { - value: '#5049dd', - id: '2b188162-6854-4bd9-8250-5f05c396bf50', - }, - { - value: '#675bff', - id: 'ec8f3796-51fc-4774-b834-e584579dba30', - }, - { - id: 'd35fc8e8-f557-4fad-b9cb-181ad1a3b671', - value: '#8170ff', - }, - { - id: '042ba1cc-1f16-4916-a819-c86658028bc3', - value: '#9d87ff', - }, - { - id: '3cbd0c05-fde7-481b-9816-3776434c6a24', - value: '#b7a0ff', - }, - { - id: 'f9a64b57-c430-4ded-a80e-1b5e4187411b', - value: '#d0baff', - }, - { - value: '#e5d6ff', - id: '4b35430f-f4a8-4386-958c-14139efdea89', - }, - { - value: '#f7f1ff', - id: 'c4db62f0-6aac-4aa5-a93f-bce970e4c648', - }, - ], - }, - { - name: 'violet', - colors: [ - { - id: '21e2165c-e503-4a31-96e0-bf2e55ef439b', - value: '#170a1b', - }, - { - id: '3ee72903-29dc-4d83-b78c-013b4908279b', - value: '#321545', - }, - { - value: '#501b71', - id: '254178dd-c278-42d8-ba9d-9264b23e2299', - }, - { - id: '1527bf46-5fd3-4ca4-9358-660a285aa963', - value: '#6d239d', - }, - { - id: 'd20756fb-c78f-4a43-835b-d8be92f411f4', - value: '#8a2fc5', - }, - { - value: '#a641e7', - id: 'f8327841-cb8f-4113-81ab-739b79652636', - }, - { - value: '#be58ff', - id: '0e245f0d-5d12-44c3-9098-ec93c2ca9c62', - }, - { - value: '#d374ff', - id: '9a31e914-5eee-41a9-bf7f-c1cb03f2b50d', - }, - { - id: 'a7e693a4-8aa4-48f2-8143-d7d4b0c4e4d0', - value: '#e392ff', - }, - { - value: '#f0b1ff', - id: 'b219c525-70bd-4b3d-929a-b447754a2fe6', - }, - { - value: '#f9d0ff', - id: 'd24fd0b2-0fde-4b13-b360-fa0c2bf01fb4', - }, - { - value: '#fef0ff', - id: '423ecf33-a980-487a-9428-48af043491cc', - }, - ], - id: '976722da-7882-4e0c-90fd-9dd4c1162057', - }, - { - id: '537d5e87-dd99-4210-bed9-af732d4d15b1', - colors: [ - { - id: '1b474ed6-b774-4339-a237-777884a9cb68', - value: '#170915', - }, - { - value: '#381436', - id: '333ac691-622c-418d-aff9-061b032270d5', - }, - { - id: '72bfde86-7b1f-4a31-b5c6-26921a35bea7', - value: '#5b1859', - }, - { - value: '#7f1e7c', - id: 'd7d8cd1c-f22a-455a-812b-c17a8004d9dc', - }, - { - id: '9f1a8f1f-02d1-4193-9b27-52b83d35eddd', - value: '#a0289d', - }, - { - value: '#bf3abb', - id: '26eb724e-fde5-47f8-8079-20cae82af85e', - }, - { - value: '#d853d2', - id: '4c16844b-6727-4fdd-a3aa-b5b2fa2c8c1b', - }, - { - value: '#ea70e4', - id: '536d5e5b-dfd0-47a2-96d1-118cf6608260', - }, - { - id: '6d47122e-d3e0-4d1a-8e05-1a0d81e4c723', - value: '#f78ff0', - }, - { - value: '#ffaef8', - id: 'd36cac2a-aa79-489c-ab77-b5477ac7826b', - }, - { - id: '84057845-db4b-4760-a067-50684320b38e', - value: '#ffcefc', - }, - { - value: '#ffeefe', - id: '74cd8468-6fe0-43e0-889d-46b621bc2c83', - }, - ], - name: 'magenta', - }, - { - name: 'red', - id: 'bf8f1a8f-fcaf-4bdd-a22a-1bac8a3c5956', - colors: [ - { - id: '6657684c-b22c-420c-b93e-0536532cc2b9', - value: '#19090a', - }, - { - id: '81e22113-dde3-453f-861d-6e7a854b1fc5', - value: '#3e131a', - }, - { - id: 'c919f6bb-b52f-4910-90fd-0f8788e09fcd', - value: '#651829', - }, - { - value: '#8d1d38', - id: 'c88e73af-9897-4ad9-a781-a10802ce1bf8', - }, - { - value: '#b22749', - id: '5ecec09b-9b68-4773-a5f0-203ed38f28fd', - }, - { - id: '64e7ed64-d29b-4edf-98c1-651cd35dee75', - value: '#d23a5b', - }, - { - id: '278faedc-4f31-458f-b045-eb0e666c972b', - value: '#ec5370', - }, - { - id: '91abfadb-c46f-4bb7-9f6f-d79d6e806d57', - value: '#ff7086', - }, - { - id: '6a493b21-6b82-477c-885e-85fa6798152f', - value: '#ff909e', - }, - { - id: 'ae728c4c-0db2-4213-8475-29967d269b1d', - value: '#ffb0b9', - }, - { - value: '#ffd0d4', - id: '35465458-b911-40b4-9a44-4547b9f27d2c', - }, - { - value: '#fff0f1', - id: '74fe8217-e90c-4548-a952-963d5615d04d', - }, - ], - }, - { - colors: [ - { - value: '#200d02', - id: '62de84dc-8b55-4d21-a907-df2b7e648972', - }, - { - id: '0e44d39a-d7cd-4717-b79d-1d8847b588e3', - value: '#431706', - }, - { - value: '#691e0a', - id: '01fc4564-a995-4536-898d-ed15b96ae4da', - }, - { - value: '#8e280d', - id: '8071d43e-7c2c-4eb2-80ca-1492068dac19', - }, - { - id: '56f73d5b-ea15-4226-8848-f7253b9d3d1b', - value: '#b13514', - }, - { - value: '#d14721', - id: '659fbf48-0845-47e1-8d02-9577ea410281', - }, - { - value: '#ea5e36', - id: 'bf9d17d5-4b0d-4ad4-9056-fa6286d16244', - }, - { - id: '2f229011-4cb3-4c1d-9993-882338eb37df', - value: '#fd7950', - }, - { - id: '1297d1de-4ac1-4d90-a452-a887699a854d', - value: '#ff9670', - }, - { - id: '3ce7b3eb-dc76-4cfc-b1cb-b869fc8153f1', - value: '#ffb495', - }, - { - id: '6e7d0c64-724d-4ad2-84c7-458602db0077', - value: '#ffd2be', - }, - { - id: '1c729b9f-2c09-4098-90da-c07fc4dd6fda', - value: '#fff0e9', - }, - ], - name: 'orange', - id: '4d5c2c0a-1782-4c74-a549-9437ea09e472', - }, - { - colors: [ - { - id: 'fa181129-4e85-4b2e-a12e-3283fa4154e8', - value: '#160f05', - }, - { - id: '79c72fba-0af8-4950-8210-13889bd6a8e0', - value: '#402e11', - }, - { - value: '#6e4d14', - id: 'c2ad3cfa-0116-4e61-94a9-f0256f44c22b', - }, - { - id: '0f352443-fbfd-42eb-96dd-79e462b99eb3', - value: '#9c6c18', - }, - { - id: 'c1325599-ce71-452b-b102-b630f9879fb4', - value: '#c68a20', - }, - { - id: '8712e418-d874-4c11-ad4d-a7d0d4cede86', - value: '#eba62e', - }, - { - id: 'bbc049ae-60ec-4649-8e11-147aba4e7c99', - value: '#ffbe44', - }, - { - value: '#ffd15e', - id: '35b05e85-ec88-41e4-b74a-33b9d6457114', - }, - { - value: '#ffe07c', - id: '3b736565-e325-4acc-8c58-f6065ef5c8ba', - }, - { - id: '8404df34-3da1-45c0-ad35-fc92b83926b2', - value: '#ffeb9b', - }, - { - id: '7ec762d1-33e3-4e58-9a91-3d7a8df98f2c', - value: '#fff3bc', - }, - { - value: '#fffade', - id: '0462ddb0-1538-43d9-90a3-cc11e0177dc7', - }, - ], - name: 'gold', - id: '09a65ee0-c8d9-4983-8f11-bb91a43fd423', - }, - { - colors: [ - { - id: 'fef27661-9135-4e7d-86ab-17520d665b54', - value: '#0d0c04', - }, - { - value: '#332f11', - id: '47a73e4a-fb2c-4c69-aefe-1f096e5805a0', - }, - { - value: '#585315', - id: 'e6a22935-c247-4114-838e-2524e449a60d', - }, - { - value: '#7f7719', - id: 'fa29b2e4-199c-4ac1-a9d0-372dc2606ad3', - }, - { - id: '9103bab7-b07e-4265-ad7d-9a7edac95559', - value: '#a49a20', - }, - { - id: '037029c3-aba5-4363-970c-d9a3bc3ec76e', - value: '#c5ba2c', - }, - { - id: 'e202afb8-cb2e-4b01-97ec-ff81530b0bba', - value: '#e1d43f', - }, - { - id: 'd62cb6e7-1212-453d-ab08-11286ae7da77', - value: '#f6e857', - }, - { - value: '#fff673', - id: '709802e6-310a-43db-953a-33bc10d9f556', - }, - { - value: '#fffe90', - id: 'c8dd03cb-5642-4ef2-b7f1-4ba882c79239', - }, - { - id: '548dac3d-1d4b-43a8-ad1e-9d4b476f7bd2', - value: '#ffffae', - }, - { - id: '7689ec0d-4c8f-47a4-af4a-bb30789a8231', - value: '#ffffcc', - }, - ], - id: '1176151b-839e-425c-9e49-cab3b85b6ae2', - name: 'yellow', - }, - { - id: 'b972212e-9a08-4944-9660-a9576fbbf288', - colors: [ - { - id: '210da771-db2e-4a69-9050-d93dbc6cf8b4', - value: '#161708', - }, - { - id: '16d94297-1828-4563-b44f-061d2aa8b31f', - value: '#323711', - }, - { - id: 'ab5bbf28-8895-4cae-8e49-c48c9933b966', - value: '#505a15', - }, - { - id: '5adaf95e-0a94-459a-b1c5-6142f77009ff', - value: '#6e7c19', - }, - { - value: '#8b9c22', - id: '40130f30-6f4d-45eb-971c-dcfab284942f', - }, - { - value: '#a6b932', - id: '6b72830d-c3eb-4b5a-a22a-61bb0254d48b', - }, - { - id: '141ce1b7-35f3-4efe-9f87-3a94b8eefd77', - value: '#bed049', - }, - { - value: '#d1e264', - id: 'fa5b7910-2496-4221-8abd-9f0155d6c7da', - }, - { - value: '#e1ee83', - id: 'dc154a93-646e-4bfc-a163-3a9a8111311c', - }, - { - value: '#edf6a3', - id: '7eae4872-7d2a-4c01-a0d3-81d4fac0faab', - }, - { - id: '6fbaa168-763a-4768-9a93-a072cdfbd38b', - value: '#f6fbc4', - }, - { - id: 'e9dc8a9d-b5ff-4808-94ab-6005d9c576e3', - value: '#fcfee6', - }, - ], - name: 'lime', - }, - { - id: 'b94db715-3882-474f-a890-c88aac4a1534', - name: 'green', - colors: [ - { - value: '#071209', - id: '4e9f3f19-f0f3-49c2-9c63-a93956e25f35', - }, - { - value: '#102816', - id: 'ef6f06e7-0d90-4bd5-a770-dbc5f9346848', - }, - { - id: 'c788fc76-c704-48a0-8cb9-9b3c161affdd', - value: '#133f21', - }, - { - id: 'febeecb1-48fd-4789-9a00-a45a86e8caaf', - value: '#18572d', - }, - { - id: 'b8a18152-01d3-432a-9961-bdfa0b9ceeef', - value: '#216f3b', - }, - { - value: '#32864b', - id: '788ba587-643c-42a8-9d13-ec1719c95733', - }, - { - value: '#499c60', - id: '05c5b798-4cc9-456b-aec0-20144f444369', - }, - { - id: 'd51bad40-05b0-4188-9e5e-c07e002e27b6', - value: '#66b178', - }, - { - id: '6073c2ef-28cf-4f69-aba0-a2d69cc6c17f', - value: '#85c492', - }, - { - value: '#a7d6af', - id: 'b85c1013-2265-4ae4-a595-1c608f4e627d', - }, - { - id: '05d744ab-2a0c-4425-b1ac-d726df3227e7', - value: '#cae7cf', - }, - { - value: '#eef7ef', - id: '34e2d535-845d-4bce-bd47-3dd5bb11da26', - }, - ], - }, - { - id: '972ef60e-e7aa-484b-b651-4ab19659099c', - colors: [ - { - id: '4c15e14a-0803-4101-931f-3d501b7b3aba', - value: '#07110f', - }, - { - id: '30486ca0-3607-4dd6-b381-8615ee631450', - value: '#102722', - }, - { - value: '#133d35', - id: '607dcf2c-18b6-4800-a916-cf0cf8f44836', - }, - { - id: '2308379d-543b-4a60-8239-b5247306c294', - value: '#18544a', - }, - { - value: '#216b5e', - id: '43884516-f64d-4448-94cf-e5ce7690a05c', - }, - { - id: 'a6c56f5f-e506-492f-9a87-bf07a77f547d', - value: '#328173', - }, - { - id: '59639620-0d23-4db5-8c29-c02fc9b91709', - value: '#499789', - }, - { - id: '48058a9f-0148-41fc-b9f0-e3e820683277', - value: '#65ac9e', - }, - { - value: '#85c0b3', - id: 'e67295e1-9860-4173-8534-274efa611930', - }, - { - value: '#a7d3c9', - id: '26e4af86-28ec-4e55-a4a5-593651a28362', - }, - { - id: '63aa7c56-d270-472e-a80b-5ab1d06d813c', - value: '#cae5de', - }, - { - id: 'd2a4fb79-f99b-4eca-95c5-67d702681f79', - value: '#eef7f4', - }, - ], - name: 'teal', }, - { - colors: [ - { - value: '#081111', - id: '66a2f872-37ea-44fa-927a-a0aa88c554f0', - }, - { - value: '#112627', - id: 'fa0313ed-4236-41f2-8797-19e5a1a06c01', - }, - { - id: '5748eac7-d905-4cfa-a1e9-2b3f867b03a3', - value: '#143c3e', - }, - { - id: 'da91f19d-71d2-42a4-b69b-8c7fcb145e6e', - value: '#185356', - }, - { - value: '#226a6d', - id: 'a464fe50-17ea-4731-8b17-2c89ec1eaf3d', - }, - { - value: '#338084', - id: 'a7503d87-4919-47cb-bdbf-4b1fbf334d79', - }, - { - id: '6bff1c61-8a6e-416f-b9a8-e662573aec1c', - value: '#4b969a', - }, - { - value: '#67abae', - id: 'cffdc97b-794a-40b8-b320-9729e6468df7', - }, - { - value: '#87bfc1', - id: 'eae73c5a-37dc-44ef-857d-d0da7e72bf49', - }, - { - id: '8b7c24a0-08e5-4981-9bd8-0ba211499c4d', - value: '#a8d2d4', - }, - { - id: '987fa1b0-0dd9-4f57-af88-fcb8b6b61016', - value: '#cbe4e5', - }, - { - id: '62682a6a-1b54-4262-a5db-6bc714d00ace', - value: '#eef6f7', - }, - ], - id: '795d336e-6e9b-4510-b3a8-4f85230a75c4', - name: 'cyan', - }, - ], - text: [ - { - name: 'heading', - id: '81522f2c-555a-4080-8f74-4c3ed90cff30', - styles: [ - { - value: 'body', - aliasId: 'f237d226-cf79-4045-8c13-9591f68de238', - id: '4330b346-a5c9-445b-be3c-07c5282350b1', - name: 'fontFamily', - }, - { - value: 700, - name: 'fontWeight', - id: '33014b4a-6ab4-4939-b9da-b2b45a9f921c', - }, - { - aliasId: 'd7bc4a9b-2d57-4dc2-9452-89f8ae1009e5', - unit: 'raw', - value: 1, - name: 'lineHeight', - id: 'fcf9c66b-d7de-450f-b64f-07f633ad4aaa', - }, - { - aliasId: '48c0dff6-0ba7-49f1-9961-8d78b43893d7', - name: 'letterSpacing', - unit: 'raw', - value: 2, - id: '647bbc4e-9bc8-4c03-8634-719253128616', - }, - { - value: 1, - unit: 'raw', - aliasId: '982efd46-1bb5-447e-8e38-ff48170253c4', - name: 'fontSize', - id: 'e09f4822-c782-4dd0-81e4-876fabd6c2ee', - }, - ], - }, - ], - borderRadius: [ - { - value: 0, - unit: 'px', - id: 'd3a18eec-caa5-4820-a38b-be1f965fd2f4', - }, - { - value: 4, - unit: 'px', - id: 'ba1db5fd-7072-42aa-9a13-d191334ae84a', - }, - { - unit: 'px', - value: 8, - id: '570a2b2a-7418-44ec-b8cb-5d46927a713f', - }, - { - unit: 'px', - id: '17acdfc2-32d3-4114-bfb4-562987fbd2b6', - value: 16, - }, - { - value: 32, - unit: 'px', - id: '980bf6c0-c74c-497b-b6c6-9101e47c1c08', - }, - { - value: 64, - unit: 'px', - id: '62de8f22-203a-40f1-a152-4a2c26c57e86', - }, - { - value: 9999999, - id: '9bc38b2b-dec8-4947-8137-fbbec8f5f219', - unit: 'px', - }, - ], - letterSpacings: [ - { - id: '0186ef74-ee18-46bf-adc1-53866c3ef91b', - value: 0.1, - unit: 'em', - name: 'tracked', - }, - { - id: '33e0203c-1c02-44d7-b484-c749b9bfc283', - name: 'negative', - unit: 'em', - value: -0.05, - }, - { - value: 0.25, - id: '48c0dff6-0ba7-49f1-9961-8d78b43893d7', - name: 'large', - unit: 'em', - }, - ], + }, + description: '', + durations: [], + boxShadows: { + 0: '0px 3px 6px 0px rgba(0, 0, 0, 0.16), 0px 3px 6px 0px rgba(0, 0, 0, 0.23)', + 1: '0px 14px 28px 0px rgba(0, 0, 0, 0.25), 0px 10px 10px 0px rgba(0, 0, 0, 0.22)', + 2: '0px 1px 1px 0px rgba(0, 0, 0, 0.11), 0px 2px 2px 0px rgba(0, 0, 0, 0.11), 0px 4px 4px 0px rgba(0, 0, 0, 0.11), 0px 6px 8px 0px rgba(0, 0, 0, 0.11), 0px 8px 16px 0px rgba(0, 0, 0, 0.11)', + 3: '0px 1px 1px 0px rgba(0, 0, 0, 0.15), 0px 2px 2px 0px rgba(0, 0, 0, 0.15), 0px 4px 4px 0px rgba(0, 0, 0, 0.15), 0px 8px 8px 0px rgba(0, 0, 0, 0.15)', + 4: '0px 3px 6px 0px rgba(0, 0, 0, 0.16), 0px 3px 6px 0px rgba(0, 0, 0, 0.23)', + 5: '0px 1px 1px 0px rgba(0, 0, 0, 0.08), 0px 2px 2px 0px rgba(0, 0, 0, 0.12), 0px 4px 4px 0px rgba(0, 0, 0, 0.16), 0px 8px 8px 0px rgba(0, 0, 0, 0.20)', + 6: '0px 14px 28px 0px rgba(0, 0, 0, 0.25), 0px 10px 10px 0px rgba(0, 0, 0, 0.22)', + 7: '0px 10px 20px 0px rgba(0, 0, 0, 0.19), 0px 6px 6px 0px rgba(0, 0, 0, 0.23)', + }, + textShadows: {}, + easingFunctions: {}, + gradients: {}, } diff --git a/apps/docs/data/elements/a.ts b/apps/docs/data/elements/a.ts index bc284a85..7fe31707 100644 --- a/apps/docs/data/elements/a.ts +++ b/apps/docs/data/elements/a.ts @@ -1,9 +1,9 @@ export const initialStyles: any = { color: 'tomato', - textDecoration: 'none', + textDecorationLine: 'none', ':hover': { color: 'rebeccapurple', - textDecoration: 'underline', + textDecorationLine: 'underline', }, ':visited': { color: 'tomato', diff --git a/apps/docs/data/initial-html-editor-data.ts b/apps/docs/data/initial-html-editor-data.ts new file mode 100644 index 00000000..d00cc2ec --- /dev/null +++ b/apps/docs/data/initial-html-editor-data.ts @@ -0,0 +1,1733 @@ +export const initialValue: any = { + tagName: 'div', + style: { + paddingTop: { + value: 128, + unit: 'px', + }, + paddingBottom: { + value: 128, + unit: 'px', + }, + }, + children: [ + { + tagName: 'header', + style: { + paddingLeft: { + value: 64, + unit: 'px', + }, + paddingRight: { + value: 64, + unit: 'px', + }, + }, + children: [ + { + tagName: 'h1', + attributes: {}, + style: { + color: '#4e4fec', + fontSize: { + type: 'responsive', + values: [ + { + value: 4, + unit: 'rem', + }, + { + value: 6, + unit: 'rem', + }, + { + value: 10, + unit: 'rem', + }, + ], + }, + fontWeight: '900', + fontFamily: 'Inter', + letterSpacing: { value: -8, unit: 'px' }, + marginTop: { + value: 0, + unit: 'px', + }, + marginBottom: { + value: 0, + unit: 'px', + }, + lineHeight: { + value: 1.25, + unit: 'number', + }, + }, + children: [{ type: 'text', value: 'CSS.GUI' }], + }, + { + tagName: 'h2', + attributes: {}, + style: { + marginBottom: { + value: 0, + unit: 'px', + }, + fontSize: { + value: 48, + unit: 'px', + }, + maxWidth: { + value: 40, + unit: 'em', + }, + lineHeight: { + value: 1.25, + unit: 'number', + }, + }, + children: [ + { + type: 'text', + value: + 'Quickly build components with custom styling panels. No coding required.', + }, + ], + }, + { + tagName: 'p', + style: { + marginBottom: { + value: 96, + unit: 'px', + }, + fontSize: { + value: 20, + unit: 'px', + }, + maxWidth: { + value: 40, + unit: 'em', + }, + }, + children: [ + { + type: 'text', + value: + 'Click anywhere on the canvas to start. Go ahead. Click away.', + }, + ], + }, + ], + }, + { + tagName: 'section', + style: { + borderTopWidth: { value: 1, unit: 'px' }, + borderTopStyle: 'solid', + borderTopColor: { type: 'theme', path: 'border' }, + marginTop: { value: 128, unit: 'px' }, + paddingTop: { value: 128, unit: 'px' }, + paddingBottom: { value: 128, unit: 'px' }, + paddingLeft: { value: 64, unit: 'px' }, + paddingRight: { value: 64, unit: 'px' }, + display: 'grid', + gap: [{ value: 2, unit: 'em' }], + justifyContent: 'space-between', + gridTemplateColumns: [ + { + name: 'repeat', + arguments: { + count: 4, + trackList: [{ value: 1, unit: 'fr' }], + }, + }, + ], + boxSizing: 'border-box', + }, + children: [ + { + tagName: 'img', + attributes: { + src: 'https://dlu344star2bj.cloudfront.net/i/3090-0015.jpg', + title: 'Image - ', + }, + style: { + display: 'block', + width: { value: 100, unit: '%' }, + maxWidth: { value: 100, unit: '%' }, + height: 'auto', + borderRadius: { value: 0, unit: 'px' }, + mixBlendMode: 'normal', + }, + }, + { + tagName: 'video', + attributes: { + title: 'Video -

' }, + // style: { + // color: { type: 'theme', path: 'text' }, + // backgroundColor: { type: 'theme', path: 'background' }, + // fontSize: { value: 1, unit: 'em', }, + // fontFamily: 'Inter', + // marginTop: { value: 0, unit: 'px' }, + // marginBottom: { value: 0, unit: 'px' }, + // lineHeight: { + // value: 1.5, unit: 'number', + // }, + // maxWidth: { + // value: 40, + // unit: 'em', + // }, + // }, + // children: [ + // { type: 'text', value: 'Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.' } + // ] + // }, + ], + }, + { + tagName: 'label', + attributes: { title: 'Label: ' }, + style: { + color: { type: 'theme', path: 'text' }, + backgroundColor: { type: 'theme', path: 'background' }, + fontWeight: 'inherit', + textDecoration: { + color: 'currentcolor', + line: 'underline', + style: 'solid', + thickness: { value: 1, unit: 'px' }, + }, + }, + children: [{ type: 'text', value: 'A text link' }], + }, + { + tagName: 'time', + children: [{ type: 'text', value: '5 OCT 2048' }], + }, + { + tagName: 'code', + children: [ + { type: 'text', value: 'const x = 1024;' }, + { tagName: 'br' }, + { type: 'text', value: 'const y = 512;' }, + { tagName: 'br' }, + { type: 'text', value: 'const coordinate = [x,y];' }, + ], + }, + { + tagName: 'ul', + attributes: { + title: 'Unordered list:

    ', + }, + children: [ + { + tagName: 'li', + children: [{ type: 'text', value: 'Oranges' }], + }, + { + tagName: 'li', + children: [{ type: 'text', value: 'Apples' }], + }, + { + tagName: 'li', + children: [{ type: 'text', value: 'Peaches' }], + }, + { + tagName: 'li', + children: [{ type: 'text', value: 'Plums' }], + }, + { + tagName: 'li', + children: [{ type: 'text', value: 'Mangos' }], + }, + ], + }, + { + tagName: 'ol', + attributes: { + title: 'Ordered list:
      ', + }, + children: [ + { + tagName: 'li', + attributes: { + title: 'List item:
    1. ', + }, + children: [{ type: 'text', value: 'Item 1' }], + }, + { + tagName: 'li', + children: [{ type: 'text', value: 'Item 2' }], + }, + { + tagName: 'li', + children: [{ type: 'text', value: 'Item 3' }], + }, + { + tagName: 'li', + children: [{ type: 'text', value: 'Item 4' }], + }, + { + tagName: 'li', + children: [{ type: 'text', value: 'Item 5' }], + }, + ], + }, + { + tagName: 'dl', + attributes: { + title: 'Definition List:
      ', + }, + children: [ + { + attributes: { + title: 'Definition term:
      ', + }, + tagName: 'dt', + style: { + color: 'inherit', + backgroundColor: 'inherit', + fontSize: { value: 1, unit: 'rem' }, + fontWeight: '400', + }, + children: [{ type: 'text', value: 'Generated designs' }], + }, + { + tagName: 'dd', + attributes: { + title: 'Definition description:
      ', + }, + style: { + color: 'inherit', + backgroundColor: 'inherit', + fontSize: { value: 2, unit: 'rem' }, + fontWeight: '600', + marginLeft: { value: 0, unit: 'px' }, + }, + children: [{ type: 'text', value: '3.4 Million' }], + }, + ], + }, + { + tagName: 'blockquote', + style: { + borderLeftWidth: { value: 4, unit: 'px' }, + borderLeftColor: '#4e4fec', + borderLeftStyle: 'solid', + marginLeft: { value: 0, unit: 'px' }, + paddingLeft: { value: 32, unit: 'px' }, + }, + attributes: { + title: 'Blockquote:
      ', + }, + children: [ + { + type: 'text', + value: + '"The aim of every typographic work - the delivery of a message in the shortest, most efficient manner." - Jan Tschichold', + }, + ], + }, + { + tagName: 'abbr', + attributes: { + title: 'Abbreviation: ', + }, + children: [{ type: 'text', value: 'Abbr' }], + }, + { + tagName: 'cite', + attributes: { + title: 'Cited text: cite', + }, + children: [{ type: 'text', value: 'Cite element' }], + }, + { + tagName: 'mark', + attributes: { + title: 'Marked text: ', + }, + style: { + color: 'inherit', + backgroundColor: '#6465ff', + fontStyle: 'normal', + fontWeight: 'inherit', + }, + children: [{ type: 'text', value: 'This text is marked' }], + }, + { + tagName: 'table', + style: { + gridColumn: 'span 3', + }, + children: [ + { + tagName: 'thead', + children: [ + { + tagName: 'tr', + children: [ + { + tagName: 'th', + style: { + textAlign: 'left', + }, + children: [{ type: 'text', value: 'Name' }], + }, + { + tagName: 'th', + style: { + textAlign: 'left', + }, + children: [{ type: 'text', value: 'Email' }], + }, + { + tagName: 'th', + style: { + textAlign: 'left', + }, + children: [{ type: 'text', value: 'Favorite typeface' }], + }, + ], + }, + ], + }, + { + tagName: 'tfoot', + children: [], + }, + { + tagName: 'tbody', + children: [ + { + tagName: 'tr', + children: [ + { + tagName: 'td', + style: { + textAlign: 'left', + }, + children: [{ type: 'text', value: 'Tanner' }], + }, + { + tagName: 'td', + style: { + textAlign: 'left', + }, + children: [{ type: 'text', value: 'tanner@example.com' }], + }, + { + tagName: 'td', + style: { + textAlign: 'left', + }, + children: [{ type: 'text', value: 'Garamond' }], + }, + ], + }, + { + tagName: 'tr', + children: [ + { + tagName: 'td', + style: { + textAlign: 'left', + }, + children: [{ type: 'text', value: 'Finley' }], + }, + { + tagName: 'td', + style: { + textAlign: 'left', + }, + children: [{ type: 'text', value: 'finley@example.com' }], + }, + { + tagName: 'td', + style: { + textAlign: 'left', + }, + children: [{ type: 'text', value: 'Space Mono' }], + }, + ], + }, + { + tagName: 'tr', + children: [ + { + tagName: 'td', + style: { + textAlign: 'left', + }, + children: [{ type: 'text', value: 'Payton' }], + }, + { + tagName: 'td', + style: { + textAlign: 'left', + }, + children: [{ type: 'text', value: 'payton@example.com' }], + }, + { + tagName: 'td', + style: { + textAlign: 'left', + }, + children: [{ type: 'text', value: 'Bodini' }], + }, + ], + }, + ], + }, + ], + }, + ], + }, + { + tagName: 'section', + children: [{}], + }, + ], +} + +export const initialComponents: any = [ + { + type: 'component', + id: '123abc', + tagName: 'Heading', + swappableComponentIds: ['456def', '789ghi'], + value: { + tagName: 'h1', + attributes: { + title: { + type: 'slot', + name: 'title', + value: 'The title for heading 1', + }, + }, + style: { + color: '#4e4fec', + fontSize: { + type: 'responsive', + values: [ + { + value: 4, + unit: 'rem', + }, + { + value: 6, + unit: 'rem', + }, + { + value: 10, + unit: 'rem', + }, + ], + }, + fontWeight: '900', + fontFamily: 'Inter', + letterSpacing: { value: -8, unit: 'px' }, + marginTop: { + value: 0, + unit: 'px', + }, + marginBottom: { + value: 0, + unit: 'px', + }, + lineHeight: { + value: 1.25, + unit: 'number', + }, + }, + children: [{ type: 'slot', name: 'children', value: 'CSS.GUI' }], + }, + }, + { + type: 'component', + id: '456def', + tagName: 'Heading2', + swappableComponentIds: ['123abc', '789ghi'], + value: { + tagName: 'h1', + attributes: { + title: { + type: 'slot', + name: 'title', + value: 'The title for heading 2', + }, + }, + style: { + color: 'tomato', + fontSize: { + type: 'responsive', + values: [ + { + value: 4, + unit: 'rem', + }, + { + value: 6, + unit: 'rem', + }, + { + value: 10, + unit: 'rem', + }, + ], + }, + fontWeight: '900', + fontFamily: 'Inter', + letterSpacing: { value: -8, unit: 'px' }, + marginTop: { + value: 0, + unit: 'px', + }, + marginBottom: { + value: 0, + unit: 'px', + }, + lineHeight: { + value: 1.25, + unit: 'number', + }, + }, + children: [{ type: 'slot', name: 'children', value: 'CSS.GUI' }], + }, + }, + { + type: 'component', + id: '789ghi', + tagName: 'Heading3', + swappableComponentIds: ['123abc', '456def'], + value: { + tagName: 'h1', + attributes: { + title: { + type: 'slot', + name: 'title', + value: 'The title for heading 2', + }, + }, + style: { + color: 'papayawhip', + fontSize: { + type: 'responsive', + values: [ + { + value: 4, + unit: 'rem', + }, + { + value: 6, + unit: 'rem', + }, + { + value: 10, + unit: 'rem', + }, + ], + }, + fontWeight: '900', + fontFamily: 'Inter', + letterSpacing: { value: -8, unit: 'px' }, + marginTop: { + value: 0, + unit: 'px', + }, + marginBottom: { + value: 0, + unit: 'px', + }, + lineHeight: { + value: 1.25, + unit: 'number', + }, + }, + children: [{ type: 'slot', name: 'children', value: 'CSS.GUI' }], + }, + }, + { + type: 'component', + id: 'aabbcc', + tagName: 'NavLink', + value: { + tagName: 'a', + attributes: { + href: '#!', + title: { + type: 'slot', + name: 'title', + value: 'A nav link', + }, + }, + style: { + color: 'tomato', + fontWeight: '500', + lineHeight: { + value: 1, + unit: 'number', + }, + }, + children: [{ type: 'slot', name: 'children', value: 'CSS.GUI' }], + }, + }, + { + type: 'component', + id: 'ddeeff', + tagName: 'Footer', + value: { + tagName: 'footer', + attributes: {}, + style: {}, + children: [ + { + type: 'element', + tagName: 'h1', + attributes: {}, + style: {}, + children: [{ type: 'text', value: 'A footer!!!!' }], + }, + ], + }, + }, + { + type: 'component', + id: 'ddeeff123', + tagName: 'Input', + attributes: {}, + value: { + type: 'element', + tagName: 'input', + attributes: {}, + style: {}, + }, + }, + { + type: 'component', + id: 'ddeeff456', + tagName: 'Email Input', + attributes: {}, + value: { + tagName: 'label', + attributes: {}, + style: {}, + children: [ + { + type: 'element', + tagName: 'span', + attributes: {}, + children: [{ type: 'text', value: 'Email' }], + }, + { + type: 'component', + tagName: 'Input', + attributes: {}, + value: { + type: 'element', + tagName: 'input', + attributes: {}, + style: {}, + }, + }, + ], + }, + }, +] diff --git a/apps/docs/data/initial-styles-accent-color-preview.ts b/apps/docs/data/initial-styles-accent-color-preview.ts index 47b8d4f1..ace51027 100644 --- a/apps/docs/data/initial-styles-accent-color-preview.ts +++ b/apps/docs/data/initial-styles-accent-color-preview.ts @@ -1,3 +1,3 @@ export const initialStyles: any = { - accentColor: '#6465ff', + accentColor: { value: '#6465ff' }, } diff --git a/apps/docs/data/initial-styles-align-content-preview.ts b/apps/docs/data/initial-styles-align-content-preview.ts new file mode 100644 index 00000000..16aec088 --- /dev/null +++ b/apps/docs/data/initial-styles-align-content-preview.ts @@ -0,0 +1,60 @@ +export const initialStyles: any = { + fontFamily: 'Recursive', + fontSize: { value: 16, unit: 'px' }, + lineHeight: { value: 1.5, unit: 'number' }, + textAlign: 'inherit', + color: '#000', + backgroundColor: '#fff', + margin: { + value: 0, + unit: 'px', + }, + height: { + value: 'auto', + unit: 'keyword', + }, + minHeight: { + value: '0', + unit: 'px', + }, + maxHeight: { + value: 'auto', + unit: 'keyword', + }, + width: { + value: '100', + unit: '%', + }, + maxWidth: { + value: '42', + unit: 'em', + }, + borderStyle: 'solid', + borderWidth: { + value: 0, + unit: 'px', + }, + borderColor: 'transparent', + borderRadius: { + value: 0, + unit: 'px', + }, + borderImageSlice: { + value: 1, + unit: 'number', + }, + borderImageWidth: { + value: 64, + unit: 'px', + }, + borderImageSource: [ + { + type: 'url', + arguments: ['https://dlu344star2bj.cloudfront.net/i/3090-0015.jpg'], + }, + ], + padding: { + value: '128', + unit: 'px', + }, +} diff --git a/apps/docs/data/initial-styles-align-items-preview.ts b/apps/docs/data/initial-styles-align-items-preview.ts new file mode 100644 index 00000000..fa6be170 --- /dev/null +++ b/apps/docs/data/initial-styles-align-items-preview.ts @@ -0,0 +1,3 @@ +export const initialStyles: any = { + alignItems: 'center', +} diff --git a/apps/docs/data/initial-styles-background-blend-mode-preview.ts b/apps/docs/data/initial-styles-background-blend-mode-preview.ts index 41cc741d..8b349d72 100644 --- a/apps/docs/data/initial-styles-background-blend-mode-preview.ts +++ b/apps/docs/data/initial-styles-background-blend-mode-preview.ts @@ -1,3 +1,3 @@ export const initialStyles: any = { - backgroundBlendMode: 'overlay' + backgroundBlendMode: ['overlay'], } diff --git a/apps/docs/data/initial-styles-background-image-preview.ts b/apps/docs/data/initial-styles-background-image-preview.ts index 0234466b..288d177a 100644 --- a/apps/docs/data/initial-styles-background-image-preview.ts +++ b/apps/docs/data/initial-styles-background-image-preview.ts @@ -1,6 +1,8 @@ export const initialStyles: any = { - backgroundImage: [{ - type: 'url', - arguments: ['https://source.unsplash.com/random'] - }] + backgroundImage: [ + { + name: 'url', + arguments: 'https://dlu344star2bj.cloudfront.net/i/3090-0015.jpg', + }, + ], } diff --git a/apps/docs/data/initial-styles-background-preview.ts b/apps/docs/data/initial-styles-background-preview.ts index 51889140..c33548e6 100644 --- a/apps/docs/data/initial-styles-background-preview.ts +++ b/apps/docs/data/initial-styles-background-preview.ts @@ -2,19 +2,12 @@ export const initialStyles: any = { background: [ { image: { - type: 'url', - arguments: ['https://source.unsplash.com/random'], - }, - position: { - x: { value: 'center', unit: 'keyword' }, - y: { value: 'center', unit: 'keyword' }, - }, - repeat: { x: 'no-repeat', y: 'no-repeat' }, - size: { - type: 'dimensions', - x: { value: 100, unit: '%' }, - y: { value: 100, unit: '%' }, + name: 'url', + arguments: 'https://dlu344star2bj.cloudfront.net/i/3090-0015.jpg', }, + position: { x: 'center', y: 'center' }, + repeat: ['no-repeat'], + size: [{ value: 100, unit: '%' }], attachment: 'fixed', origin: 'border-box', clip: 'border-box', diff --git a/apps/docs/data/initial-styles-border-color-preview.ts b/apps/docs/data/initial-styles-border-color-preview.ts index c92b5144..3c6423de 100644 --- a/apps/docs/data/initial-styles-border-color-preview.ts +++ b/apps/docs/data/initial-styles-border-color-preview.ts @@ -1,3 +1,5 @@ export const initialStyles: any = { - borderColor: '#6465ff', + borderColor: { + top: '#6465ff', + }, } diff --git a/apps/docs/data/initial-styles-border-style-preview.ts b/apps/docs/data/initial-styles-border-style-preview.ts index 4c17adab..822dbf69 100644 --- a/apps/docs/data/initial-styles-border-style-preview.ts +++ b/apps/docs/data/initial-styles-border-style-preview.ts @@ -1,3 +1,8 @@ export const initialStyles: any = { - borderStyle: 'double', + borderStyle: { + top: 'double', + bottom: 'double', + left: 'double', + right: 'double', + } } diff --git a/apps/docs/data/initial-styles-border-width-preview.ts b/apps/docs/data/initial-styles-border-width-preview.ts index 72c24cec..3424ba57 100644 --- a/apps/docs/data/initial-styles-border-width-preview.ts +++ b/apps/docs/data/initial-styles-border-width-preview.ts @@ -1,6 +1,8 @@ export const initialStyles: any = { borderWidth: { - value: 8, - unit: 'px', - } + top: { + value: 8, + unit: 'px', + }, + }, } diff --git a/apps/docs/data/initial-styles-filter-preview.ts b/apps/docs/data/initial-styles-filter-preview.ts index df01b670..40c84e18 100644 --- a/apps/docs/data/initial-styles-filter-preview.ts +++ b/apps/docs/data/initial-styles-filter-preview.ts @@ -1,3 +1,3 @@ export const initialStyles: any = { - filter: [{ type: 'blur', radius: { value: 4, unit: 'px' } }], + filter: [{ name: 'blur', arguments: { value: 4, unit: 'px' } }], } diff --git a/apps/docs/data/initial-styles-flex-direction-preview.ts b/apps/docs/data/initial-styles-flex-direction-preview.ts new file mode 100644 index 00000000..30be546e --- /dev/null +++ b/apps/docs/data/initial-styles-flex-direction-preview.ts @@ -0,0 +1,3 @@ +export const initialStyles: any = { + flexDirction: 'column-reverse' +} diff --git a/apps/docs/data/initial-styles-flex-grow-preview.ts b/apps/docs/data/initial-styles-flex-grow-preview.ts new file mode 100644 index 00000000..85297be8 --- /dev/null +++ b/apps/docs/data/initial-styles-flex-grow-preview.ts @@ -0,0 +1,3 @@ +export const initialStyles: any = { + flexGrow: 4 +} diff --git a/apps/docs/data/initial-styles-flex-shrink-preview.ts b/apps/docs/data/initial-styles-flex-shrink-preview.ts new file mode 100644 index 00000000..21f20f61 --- /dev/null +++ b/apps/docs/data/initial-styles-flex-shrink-preview.ts @@ -0,0 +1,3 @@ +export const initialStyles: any = { + flexShrink: 2 +} diff --git a/apps/docs/data/initial-styles-flex-wrap-preview.ts b/apps/docs/data/initial-styles-flex-wrap-preview.ts new file mode 100644 index 00000000..cc034b8e --- /dev/null +++ b/apps/docs/data/initial-styles-flex-wrap-preview.ts @@ -0,0 +1,3 @@ +export const initialStyles: any = { + flexWrap: 'nowrap', +} diff --git a/apps/docs/data/initial-styles-justify-content-preview.ts b/apps/docs/data/initial-styles-justify-content-preview.ts new file mode 100644 index 00000000..f32f450b --- /dev/null +++ b/apps/docs/data/initial-styles-justify-content-preview.ts @@ -0,0 +1,3 @@ +export const initialStyles: any = { + justifyContent: 'center', +} diff --git a/apps/docs/data/initial-styles-link-preview.tsx b/apps/docs/data/initial-styles-link-preview.tsx index 575a4384..21a6cf87 100644 --- a/apps/docs/data/initial-styles-link-preview.tsx +++ b/apps/docs/data/initial-styles-link-preview.tsx @@ -33,27 +33,24 @@ export const initialStyles: any = { }, borderColor: 'transparent', boxSizing: 'border-box', -// borderRadius: { -// value: 9999, -// unit: 'px', -// }, - borderImageSlice: { - value: 1, - unit: 'number', - }, - borderImageWidth: { - value: 64, + borderRadius: { + value: 9999, unit: 'px', }, + // borderImageSlice: { top: { value: 1, unit: 'number' } }, + // borderImageWidth: { + // value: 64, + // unit: 'px', + // }, overflow: 'hidden', - borderImageSource: [ - { - type: 'url', - arguments: ['https://source.unsplash.com/random'], - }, - ], + borderImageSource: { + name: 'url', + arguments: 'https://dlu344star2bj.cloudfront.net/i/3090-0015.jpg', + }, padding: { - value: '128', - unit: 'px', + top: { + value: '128', + unit: 'px', + }, }, } diff --git a/apps/docs/data/initial-styles-outline-offset-preview.ts b/apps/docs/data/initial-styles-outline-offset-preview.ts index 8218e7a6..0a9caa18 100644 --- a/apps/docs/data/initial-styles-outline-offset-preview.ts +++ b/apps/docs/data/initial-styles-outline-offset-preview.ts @@ -2,5 +2,5 @@ export const initialStyles: any = { outlineOffset: { value: 6, unit: 'px', - } + }, } diff --git a/apps/docs/data/initial-styles.ts b/apps/docs/data/initial-styles.ts index 79235e8f..93ed8306 100644 --- a/apps/docs/data/initial-styles.ts +++ b/apps/docs/data/initial-styles.ts @@ -49,8 +49,8 @@ export const initialStyles: any = { }, borderImageSource: [ { - type: 'url', - arguments: ['https://source.unsplash.com/random'], + name: 'url', + arguments: 'https://dlu344star2bj.cloudfront.net/i/3090-0015.jpg', }, ], padding: { diff --git a/apps/docs/next.config.mjs b/apps/docs/next.config.mjs index cf6bb40e..87d64d60 100644 --- a/apps/docs/next.config.mjs +++ b/apps/docs/next.config.mjs @@ -15,6 +15,6 @@ const withMDX = nextMDX({ export default withMDX({ reactStrictMode: true, - basePath: '/open-source/css-gui', + basePath: '/css-gui', pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'], }) diff --git a/apps/docs/package.json b/apps/docs/package.json index 363dbc3a..5825c9fd 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -1,6 +1,6 @@ { "name": "docs", - "version": "0.0.0", + "version": "0.0.1", "private": true, "scripts": { "dev": "next dev --port 3001", @@ -13,23 +13,22 @@ "@compai/css-gui": "*", "@compai/logo": "^0.1.0", "@emotion/react": "^11.9.0", - "@mdx-js/loader": "^2.1.1", - "@next/mdx": "^12.1.5", - "@segment/snippet": "^4.15.3", - "next": "12.1.5", - "react": "18.0.0", + "@mdx-js/loader": "^2.1.2", + "@next/mdx": "^12.2.5", + "next": "12.3.1", + "react": "18.1.0", "react-dom": "18.0.0", "rehype-autolink-headings": "^6.1.1", "rehype-slug": "^5.0.1", "remark-gfm": "^3.0.1", "remark-prism": "^1.3.6", - "theme-ui": "^0.14.5" + "theme-ui": "^0.14.7" }, "devDependencies": { - "@types/node": "^17.0.31", - "@types/react": "18.0.5", + "@types/node": "^18.11.9", + "@types/react": "18.0.10", "config": "*", - "eslint": "8.13.0", + "eslint": "8.26.0", "tsconfig": "*", "typescript": "^4.6.4" } diff --git a/apps/docs/pages/404.tsx b/apps/docs/pages/404.tsx index 96889690..0ce10f42 100644 --- a/apps/docs/pages/404.tsx +++ b/apps/docs/pages/404.tsx @@ -4,7 +4,7 @@ const Page = () => { const router = useRouter() if (router.asPath === '/') { - router.push('/home') + router.push('/html-editor') } return

      404: We couldn't find that page

      diff --git a/apps/docs/pages/_app.tsx b/apps/docs/pages/_app.tsx index 9def8e7c..678e182d 100644 --- a/apps/docs/pages/_app.tsx +++ b/apps/docs/pages/_app.tsx @@ -1,8 +1,12 @@ import { AppProps } from 'next/app' -import Router, { NextRouter, useRouter } from 'next/router' +import { NextRouter, useRouter } from 'next/router' import { ReactChild } from 'react' import { ThemeProvider } from 'theme-ui' -import { theme } from '@compai/css-gui' +import { + ThemeProvider as EditorThemeProvider, + theme, + importTheme, +} from '@compai/css-gui' import { Sidebar } from '../components/Sidebar' import { PageWrap } from '../components/PageWrap' import { Layout } from '../components/Layout' @@ -10,16 +14,16 @@ import { Layout as PlaygroundLayout } from '../components/playground/Layout' import { Head } from '../components/Head' import '../public/code-styles.css' -Router.events.on('routeChangeComplete', (url) => { - // @ts-ignore - window?.analytics?.page(url) -}) - const NO_NAV_PAGES: Record = { '/playground': true, - '/components/html-editor': true, + '/html-editor': true, + '/dev': true, } const isNoNavPage = (router: NextRouter) => { + if (router.pathname.startsWith('/library')) { + return true + } + return NO_NAV_PAGES[router.pathname] ?? false } @@ -41,10 +45,12 @@ const App = ({ Component, pageProps }: AppProps) => { return ( - - - - + + + + + + ) } diff --git a/apps/docs/pages/_document.tsx b/apps/docs/pages/_document.tsx index 9db5cb78..6824866d 100644 --- a/apps/docs/pages/_document.tsx +++ b/apps/docs/pages/_document.tsx @@ -5,12 +5,6 @@ import Document, { NextScript, DocumentContext, } from 'next/document' -import * as snippet from '@segment/snippet' - -const ANALYTICS_WRITE_KEY = - process.env.NODE_ENV === 'development' - ? 'l2esDJDa92SQGAtVN9yZY5ByGKYbXhf5' - : 'RMUHme5teZLiDPnqWE6z27snMAHmpFei' export default class CustomDocument extends Document { static async getInitialProps(ctx: DocumentContext) { @@ -18,25 +12,10 @@ export default class CustomDocument extends Document { return { ...initialProps } } - renderSnippet() { - const opts = { - apiKey: ANALYTICS_WRITE_KEY, - page: true, - } - - if (process.env.NODE_ENV === 'development') { - return snippet.max(opts) - } - - return snippet.min(opts) - } - render() { return ( - - - +
      diff --git a/apps/docs/pages/components/html-editor.tsx b/apps/docs/pages/components/html-editor.tsx deleted file mode 100644 index 4d731749..00000000 --- a/apps/docs/pages/components/html-editor.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { HtmlEditor, HtmlRenderer, htmlToEditorSchema } from '@compai/css-gui' -import { useState } from 'react' - -// TODO: Handle style attrs -const initialValue = htmlToEditorSchema(` - -`) - -export default function HtmlEditorExample() { - const [html, setHtml] = useState(initialValue) - return ( -
      - - -
      - ) -} diff --git a/apps/docs/pages/dev.tsx b/apps/docs/pages/dev.tsx new file mode 100644 index 00000000..d61fc2cd --- /dev/null +++ b/apps/docs/pages/dev.tsx @@ -0,0 +1,171 @@ +import { HtmlEditor, HtmlRenderer, HtmlEditorProvider } from '@compai/css-gui' +import { useState } from 'react' +import { defaultTheme } from '../data/default-theme' +import { initialComponents } from '../data/initial-html-editor-data' + +const initialValue: any = { + tagName: 'div', + style: { + paddingTop: { + value: 128, + unit: 'px', + }, + paddingBottom: { + value: 128, + unit: 'px', + }, + }, + children: [ + { + tagName: 'header', + style: { + paddingLeft: { + value: 64, + unit: 'px', + }, + paddingRight: { + value: 64, + unit: 'px', + }, + }, + children: [ + { + tagName: 'h1', + attributes: {}, + style: { + color: '#4e4fec', + fontSize: { + type: 'responsive', + values: [ + { + value: 4, + unit: 'rem', + }, + { + value: 6, + unit: 'rem', + }, + { + value: 10, + unit: 'rem', + }, + ], + }, + fontWeight: '900', + fontFamily: 'Inter', + letterSpacing: { value: -8, unit: 'px' }, + marginTop: { + value: 0, + unit: 'px', + }, + marginBottom: { + value: 0, + unit: 'px', + }, + lineHeight: { + value: 1.25, + unit: 'number', + }, + }, + children: [{ type: 'text', value: 'CSS.GUI' }], + }, + { + tagName: 'h2', + attributes: {}, + style: { + marginBottom: { + value: 0, + unit: 'px', + }, + fontSize: { + value: 48, + unit: 'px', + }, + maxWidth: { + value: 40, + unit: 'em', + }, + lineHeight: { + value: 1.25, + unit: 'number', + }, + }, + children: [ + { + type: 'text', + value: + 'Quickly build components with custom styling panels. No coding required.', + }, + ], + }, + { + tagName: 'p', + style: { + marginBottom: { + value: 96, + unit: 'px', + }, + fontSize: { + value: 20, + unit: 'px', + }, + maxWidth: { + value: 40, + unit: 'em', + }, + }, + children: [ + { + type: 'text', + value: + 'Click anywhere on the canvas to start. Go ahead. Click away.', + }, + ], + }, + ], + }, + ], +} + +export default function HtmlEditorExample() { + const [html, setHtml] = useState(initialValue) + + return ( + + + + ) +} diff --git a/apps/docs/pages/examples/animations.tsx b/apps/docs/pages/examples/animations.tsx index e1177622..be646828 100644 --- a/apps/docs/pages/examples/animations.tsx +++ b/apps/docs/pages/examples/animations.tsx @@ -7,16 +7,10 @@ const initialStyles = { animation: [ { name: 'backOutRight', - timingFunction: { - type: 'cubic-bezier', - p1: 0.42, - p2: 0, - p3: .58, - p4: 1, - }, + timingFunction: 'ease-in-out', duration: { value: 2000, unit: 'ms' }, delay: { value: 0, unit: 'ms' }, - iterationCount: { value: 'infinite', type: 'keyword' }, + iterationCount: 'infinite', fillMode: 'none', direction: 'normal', playState: 'running', @@ -38,7 +32,7 @@ export default function AnimationExample() {
      <>
      -
      +
      <>
             
      - - - - - - + + +
      @@ -85,7 +90,7 @@ export default function BorderImage() {
      -
      +
      
                   

      Radius

      - - - - +
      @@ -60,7 +66,7 @@ export default function BorderRadius() {
      -
      +
      <>
             
      -
      +
      “The parameters comprise sequences which are theoretically infinite but limits are, of course, set to them in practice. There is an @@ -68,37 +99,45 @@ export default function BorderImage() {
      - -
      -

      Borders

      -
      - - - - - - - - - - - - -
      -
      -

      Radius

      - - - - -
      -
      -

      Spacing

      - - -
      -
      -
      + +
      +

      Borders

      +
      + + + + + + + + + + + + +
      +
      +

      Radius

      + + + + +
      +
      +

      Spacing

      + + +
      +
      +
      (initialStyles)
      -
      -  return (
      -    
      - -
      -
      - fun with ✂️ -
      -
      -
      - ) -} diff --git a/apps/docs/pages/examples/filters.tsx b/apps/docs/pages/examples/filters.tsx index 8a7124a4..68ca6a3a 100644 --- a/apps/docs/pages/examples/filters.tsx +++ b/apps/docs/pages/examples/filters.tsx @@ -1,47 +1,48 @@ -import { Editor, styled } from '@compai/css-gui' +import { Editor, Inputs, styled, toCSSObject } from '@compai/css-gui' import { useState } from 'react' import { Container } from '../../components/Container' -const initialStyles = { - filter: [{ type: 'sepia', amount: { value: 50, unit: '%' } }], -} - export default function Filters() { - const [styles, setStyles] = useState(initialStyles) + const [styles, setStyles] = useState({ + filter: [ + { + name: 'blur', + arguments: { value: 8, unit: 'px' }, + }, + ], + }) + return (
      - - -
      - + + + +
      - Fun with filters - -
      +
      + Fun with filters +
      +
      ) diff --git a/apps/docs/pages/examples/flex.tsx b/apps/docs/pages/examples/flex.tsx index ff3a28e6..d22d99f8 100644 --- a/apps/docs/pages/examples/flex.tsx +++ b/apps/docs/pages/examples/flex.tsx @@ -1,8 +1,6 @@ import { useState } from 'react' -import Link from 'next/link' import { Editor, Inputs, styled, codegen } from '@compai/css-gui' import { defaultTheme } from '../../data/default-theme' -import { Container } from '../../components/Container' const initialStyles = { display: 'flex', @@ -35,7 +33,7 @@ export default function TextDecoration() {
      @@ -72,23 +70,94 @@ export default function TextDecoration() {
      - -
      One
      -
      Two
      -
      Three
      -
      Four
      -
      Five
      -
      Six
      -
      Seven
      -
      Eight
      -
      Nine
      -
      Ten
      -
      Eleven
      -
      Twelve
      +
      + + One +
      +
      + + Two +
      +
      + + Three +
      +
      + + Four +
      +
      + + Five +
      +
      + + Six +
      +
      + + Seven +
      +
      + + Eight +
      +
      + + Nine +
      +
      + + Ten +
      +
      + + Eleven +
      +
      + + Twelve +
      -
      +
       ({
       
       const initialStyles = {
         transform: [
      -    { type: 'perspective', amount: { value: 512, unit: 'px' } },
      -    { type: 'rotateX', amount: { value: 15, unit: 'deg' } },
      -    { type: 'rotateY', amount: { value: 15, unit: 'deg' } },
      +    { name: 'perspective', arguments: { value: 512, unit: 'px' } },
      +    { name: 'rotateX', arguments: { value: 15, unit: 'deg' } },
      +    { name: 'rotateY', arguments: { value: 15, unit: 'deg' } },
         ],
       }
       
      diff --git a/apps/docs/pages/examples/grid.tsx b/apps/docs/pages/examples/grid.tsx.tmp
      similarity index 100%
      rename from apps/docs/pages/examples/grid.tsx
      rename to apps/docs/pages/examples/grid.tsx.tmp
      diff --git a/apps/docs/pages/examples/masks.tsx b/apps/docs/pages/examples/masks.tsx
      index e51cffcd..909918c7 100644
      --- a/apps/docs/pages/examples/masks.tsx
      +++ b/apps/docs/pages/examples/masks.tsx
      @@ -8,23 +8,19 @@ const initialStyles = {
           {
             clip: 'border-box',
             image: {
      -        type: 'url',
      -        arguments: ['https://source.unsplash.com/random'],
      +        name: 'url',
      +        arguments: 'https://dlu344star2bj.cloudfront.net/i/3090-0015.jpg',
             },
             origin: 'border-box',
             position: {
      -        x: { value: 0, type: '%' },
      -        y: { value: 0, type: '%' },
      -      },
      -      repeat: {
      -        x: 'no-repeat',
      -        y: 'no-repeat',
      -      },
      -      size: {
      -        type: 'dimensions',
      -        x: { value: 100, unit: '%' },
      -        y: { value: 100, unit: '%' },
      +        x: { value: 0, unit: '%' },
      +        y: { value: 0, unit: '%' },
             },
      +      repeat: ['no-repeat', 'no-repeat'],
      +      size: [
      +        { value: 100, unit: '%' },
      +        { value: 100, unit: '%' },
      +      ],
             composite: 'add',
             mode: 'luminance',
           },
      @@ -35,13 +31,16 @@ export default function MaskExample() {
         const [styles, setStyles] = useState(initialStyles)
         return (
           
      - -
      img': {maxWidth: '100%', display: 'block'} }}> - -
      - - - + +
      img': { maxWidth: '100%', display: 'block' } }}> + +
      + + +
      ) diff --git a/apps/docs/pages/examples/offset.tsx b/apps/docs/pages/examples/offset.tsx index feb434ad..67c926f6 100644 --- a/apps/docs/pages/examples/offset.tsx +++ b/apps/docs/pages/examples/offset.tsx @@ -2,20 +2,25 @@ import { Editor, toCSSObject } from '@compai/css-gui' import { useState } from 'react' const initialStyles = { - offsetPath: { - shape: { - type: 'path', - path: 'M 10 80 C 40 10, 65 10, 95 80 S 150 150, 180 80', + offset: { + path: { + type: 'shape', + shape: { + name: 'path', + arguments: 'M 10 80 C 40 10, 65 10, 95 80 S 150 150, 180 80', + }, + box: 'margin-box', + }, + anchor: { x: 'center', y: 'center' }, + distance: { value: 50, unit: '%' }, + rotate: { value: 0, unit: 'deg' }, + position: { + x: { value: 50, unit: '%' }, + y: { value: 50, unit: '%' }, }, - box: 'margin-box', - }, - offsetAnchor: { - x: { value: 'center', unit: 'keyword' }, - y: { value: 'center', unit: 'keyword' }, }, - offsetDistance: { value: 50, unit: '%' }, - offsetRotate: { value: 0, unit: 'deg' }, } + export default function OffsetExample() { const [styles, setStyles] = useState(initialStyles) return ( diff --git a/apps/docs/pages/examples/shadows.tsx b/apps/docs/pages/examples/shadows.tsx index f4664d89..da9860ea 100644 --- a/apps/docs/pages/examples/shadows.tsx +++ b/apps/docs/pages/examples/shadows.tsx @@ -1,4 +1,4 @@ -import { Editor, styled } from '@compai/css-gui' +import { Editor, styled, toCSSObject } from '@compai/css-gui' import { useState } from 'react' import { Container } from '../../components/Container' @@ -45,8 +45,8 @@ export default function Shadows() { justifyContent: 'center', }} > -
      Fun with shadows - +
      -
      +
      diff --git a/apps/docs/pages/examples/shape-outside.tsx b/apps/docs/pages/examples/shape-outside.tsx index 5776ca53..4b4aea2e 100644 --- a/apps/docs/pages/examples/shape-outside.tsx +++ b/apps/docs/pages/examples/shape-outside.tsx @@ -5,12 +5,11 @@ const initialStyles = { shapeOutside: { type: 'shape', shape: { - type: 'inset', - top: { value: 2, unit: 'px' }, - right: { value: 2, unit: 'px' }, - bottom: { value: 2, unit: 'px' }, - left: { value: 2, unit: 'px' }, - borderRadius: { value: 16, unit: 'px' }, + name: 'inset', + arguments: { + offset: { top: { value: 2, unit: 'px' } }, + borderRadius: { value: 16, unit: 'px' }, + }, }, box: 'margin-box', }, @@ -29,7 +28,7 @@ export default function ShapeOutsideExample() { return (
      -
      +
      {text}
      -
      - -
      +
      + +
      ) } diff --git a/apps/docs/pages/examples/simple-button.tsx b/apps/docs/pages/examples/simple-button.tsx index 7c3c8046..097d01ec 100644 --- a/apps/docs/pages/examples/simple-button.tsx +++ b/apps/docs/pages/examples/simple-button.tsx @@ -11,11 +11,13 @@ const initialStyles = { }, appearance: 'none', borderWidth: { - value: 0, - unit: 'px', + top: { + value: 0, + unit: 'px', + }, }, - fontWeight: '600', - fontSize: '16px', + fontWeight: 600, + fontSize: { value: 16, unit: 'px' }, outlineWidth: { value: 0, unit: 'px', @@ -25,12 +27,12 @@ const initialStyles = { value: 0, unit: 'px', }, - 'hover': { + hover: { color: '#ffffff', backgroundColor: '#3e38b0', outlineColor: '#3e38b0', }, - 'focus': { + focus: { color: '#ffffff', backgroundColor: '#3e38b0', outlineWidth: { @@ -42,9 +44,9 @@ const initialStyles = { outlineOffset: { value: 4, unit: 'px', - } + }, }, - 'active': { + active: { color: '#ffffff', backgroundColor: '#8170ff', outlineColor: '#8170ff', @@ -54,45 +56,68 @@ const initialStyles = { export default function SimpleButton() { const [styles, setStyles] = useState(initialStyles) return ( -
      -
      +
      + boxShadow: + 'inset 0 0 0 1px rgba(0,0,0,.2), inset 0 0 0 1px rgba(255,255,255,.2)', + }} + > -
      +
      -
      +
      -
      -

      Hover

      -
      +
      +

      + Hover +

      +
      -
      -

      Focus

      -
      +
      +

      + Focus +

      +
      -
      +
      -
      -

      Active

      -
      +
      +

      + Active +

      +
      @@ -100,9 +125,7 @@ export default function SimpleButton() {
      -
      +
      -
      - -
      -            {codegen.css(styles)}
      -          
      -
      +
      + +
      {codegen.css(styles)}
      +
      ) } diff --git a/apps/docs/pages/examples/svg.tsx b/apps/docs/pages/examples/svg.tsx index e5ffbd6c..69c141e7 100644 --- a/apps/docs/pages/examples/svg.tsx +++ b/apps/docs/pages/examples/svg.tsx @@ -1,46 +1,17 @@ -import { codegen, Editor, toCSSObject } from '@compai/css-gui' +import { Editor, parseStyles, toCSSObject } from '@compai/css-gui' import { useState } from 'react' import { defaultTheme } from '../../data/default-theme' -import { Container } from '../../components/Container' -const initialStyles = { +const initialStyles = parseStyles({ stroke: '#fff', fill: 'none', - strokeAlignment: { - value: 'center', - unit: 'keyword', - }, - strokeWidth: { - value: 8, - unit: 'px', - }, - strokeLinejoin: { - value: 'round', - unit: 'keyword', - }, - strokeLinecap: { - value: 'square', - unit: 'keyword', - }, - strokeDashadjust: { - value: 'dashed', - unit: 'keyword', - }, - strokeDashcorner: { - value: 0, - unit: 'px', - }, - strokeDashoffset: { - value: 0, - unit: 'px', - }, - strokeDasharray: [ - { value: 0, unit: 'number' }, - { value: 8, unit: 'number' }, - { value: 0, unit: 'number' }, - { value: 24, unit: 'number' }, - ], -} + strokeAlignment: 'center', + strokeWidth: '8px', + strokeLinejoin: 'round', + strokeLinecap: 'square', + strokeDashadjust: 'dashed', + strokeDasharray: '1, 20, 1, 15', +}) export default function SvgExample() { const [styles, setStyles] = useState(initialStyles) diff --git a/apps/docs/pages/examples/text-decoration.tsx b/apps/docs/pages/examples/text-decoration.tsx index cf5ca3ab..b89b0ffb 100644 --- a/apps/docs/pages/examples/text-decoration.tsx +++ b/apps/docs/pages/examples/text-decoration.tsx @@ -1,32 +1,17 @@ import { useState } from 'react' import Link from 'next/link' -import { Editor, Inputs, styled, codegen } from '@compai/css-gui' +import { Editor, Inputs, styled, codegen, parseStyles } from '@compai/css-gui' import { defaultTheme } from '../../data/default-theme' import { Container } from '../../components/Container' -const initialStyles = { - textDecorationColor: 'primary', - textDecorationThickness: { - value: 8, - unit: 'px', - }, - textDecorationLine: 'underline', - textDecorationStyle: 'wavy', +const initialStyles = parseStyles({ + textDecoration: 'tomato 8px underline wavy', // Font - fontSize: { - value: 3, - unit: 'rem', - }, - letterSpacing: { - value: 'initial', - unit: 'keyword', - }, - lineHeight: { - value: '1.25', - unit: 'number', - }, - fontFamily: 'Space Mono', -} + fontSize: '3rem', + letterSpacing: 'initial', + lineHeight: '1.25', + // fontFamily: 'Space Mono', +}) export default function TextDecoration() { const [styles, setStyles] = useState(initialStyles) @@ -34,7 +19,6 @@ export default function TextDecoration() { return ( <>
      <>

      Text Decoration

      - - + {/* + + */} + -

      Font

      @@ -66,7 +51,7 @@ export default function TextDecoration() { “The parameters comprise sequences which are theoretically infinite but limits are, of course, set to them in practice.“ -
      +
      In{' '}
      -
      +
      -
      Fun with transforms - +
      (initialStyles) return ( -
      -
      -
      - -
      +
      +
      +
      + +
      div': { display: 'grid', gap: '1em' } }}>
      diff --git a/apps/docs/pages/examples/typography.tsx b/apps/docs/pages/examples/typography.tsx index 59f7be1b..29bb9666 100644 --- a/apps/docs/pages/examples/typography.tsx +++ b/apps/docs/pages/examples/typography.tsx @@ -2,39 +2,35 @@ import { useState } from 'react' import Link from 'next/link' import { Editor, Inputs, styled, codegen } from '@compai/css-gui' import { defaultTheme } from '../../data/default-theme' -import { Container } from '../../components/Container' const initialStyles = { - color: 'text', - backgroundColor: 'background', + color: { type: 'theme', path: 'text' }, + backgroundColor: { type: 'theme', path: 'background' }, fontFamily: 'Recursive', fontSize: { value: 3, unit: 'rem', }, - letterSpacing: { - value: 'initial', - unit: 'keyword', - }, + letterSpacing: 'initial', lineHeight: { - value: '1.5', + value: 1.5, unit: 'number', }, - textDecorationColor: 'primary', + textDecorationColor: { type: 'theme', path: 'primary' }, textDecorationThickness: { value: 0, unit: 'px', }, textDecorationLine: 'none', - textDecorationStyle: 'none', + textDecorationStyle: 'solid', width: { value: 100, - unit: '%' + unit: '%', }, maxWidth: { value: 42, - unit: 'em' - } + unit: 'em', + }, } export default function Typography() { @@ -47,8 +43,15 @@ export default function Typography() { display: 'flex', }} > - -
      +
      “The parameters comprise sequences which are theoretically infinite but limits are, of course, set to them in practice. There is an @@ -69,67 +72,77 @@ export default function Typography() {
      - - <> -

      Typography

      -
      -
      -
      - - -
      - -
      -
      - - - - - - - - - - -
      -
      - - - - - - - - - - - - - - -
      -
      - - - - - - - - - - - - - - - - -
      -
      - -
      -
      + + <> +

      Typography

      +
      +
      +
      + + +
      + +
      +
      + + + + + + + + + + +
      +
      + + + + + + + + + + + + + + +
      +
      + + + + + + + + + + + + + + + + +
      +
      + +
      +
      -
      -

      +
      +

      CSS GUI v{pkg.version}

      - A composable, extensible, and themeable controls for visually editing CSS. + A composable, extensible, and themeable controls for visually editing + CSS.

      -

      - Everyone should be able to explore the creative potential of CSS. - This project is a growing set of parametric controls for rapidly editing CSS properties. - Designed for composability, mix and match any combination of properties - to create custom components and tap into the vast and beautiful world of CSS. -

      +

      + Everyone should be able to explore the creative potential of CSS. This + project is a growing set of parametric controls for rapidly editing + CSS properties. Designed for composability, mix and match any + combination of properties to create custom components and tap into the + vast and beautiful world of CSS. +

      Install

      Demo

      - - + Codesandbox -

      Features

      -
        -
      • Controls for 280 CSS properties
      • -
      • +1000 Google Fonts
      • -
      • Full variable fonts support
      • -
      • Responsive value arrays
      • -
      • Theme aware inputs
      • -
      • Scrubbable number inputs
      • -
      • Supports all CSS units
      • -
      • Advanced layer based gradient editor
      • -
      • Nested elements
      • -
      • Cubic bezier editor for custom easings
      • -
      • Style pseudo-elements and pseudo-classes
      • -
      • Completely open source
      • -
      +

      Features

      +
        +
      • Controls for 280 CSS properties
      • +
      • +1000 Google Fonts
      • +
      • Full variable fonts support
      • +
      • Responsive value arrays
      • +
      • Theme aware inputs
      • +
      • Scrubbable number inputs
      • +
      • Supports all CSS units
      • +
      • Advanced layer based gradient editor
      • +
      • Nested elements
      • +
      • Cubic bezier editor for custom easings
      • +
      • Style pseudo-elements and pseudo-classes
      • +
      • Completely open source
      • +

      Demo

      -

      Previews of CSS controls

      +

      + Previews of CSS controls +

      -
      +
      @@ -119,9 +141,8 @@ export default function Docs() { -
      - + - - View more properties - + View more properties
      -
      + {/*

      Composable

      -

      - Mix and match controls to create your own custom component design interfaces. +

      + Mix and match controls to create your own custom component design + interfaces.

      -
      +
      - -
      + +
      */}

      ) } diff --git a/apps/docs/pages/html-editor.tsx b/apps/docs/pages/html-editor.tsx new file mode 100644 index 00000000..79ffd9b4 --- /dev/null +++ b/apps/docs/pages/html-editor.tsx @@ -0,0 +1,42 @@ +import { HtmlEditor, HtmlRenderer, HtmlEditorProvider } from '@compai/css-gui' +import { useState } from 'react' +import { defaultTheme } from '../data/default-theme' +import { initialValue } from '../data/initial-html-editor-data' + +export default function HtmlEditorExample() { + const [html, setHtml] = useState(initialValue) + + return ( + + + + ) +} diff --git a/apps/docs/pages/inputs/responsive.mdx b/apps/docs/pages/inputs/responsive.mdx deleted file mode 100644 index 3f688426..00000000 --- a/apps/docs/pages/inputs/responsive.mdx +++ /dev/null @@ -1,54 +0,0 @@ -import { FirstParagraph } from '../../components/FirstParagraph' -import { ResponsiveExample } from '../../components/examples/Responsive' -import { Container } from '../../components/Container' - - - -# Responsive Input - - - A responsive utility for creating dynamic inputs based on breakpoints. - - -Use this component to expose controls that target breakpoints or a single, global -value. Responsive outputs contain an array of values based on the number of breakpoints -in the theme. - -## Example - - - -## Usage - -```ts -import { useState } from 'react' -import { - Length, - ResponsiveLength, - LengthInput, - ResponsiveInput, -} from '@compai/css-gui' - -const DEFAULT_VALUE = { - value: 16, - unit: 'px', -} -export const ResponsiveExample = () => { - const [value, setValue] = useState(DEFAULT_VALUE) - - return ( - <> - -
      {JSON.stringify(value, null, 2)}
      - - ) -} -``` - -
      diff --git a/apps/docs/pages/library/card.tsx b/apps/docs/pages/library/card.tsx new file mode 100644 index 00000000..0b29287f --- /dev/null +++ b/apps/docs/pages/library/card.tsx @@ -0,0 +1,174 @@ +import { + HtmlEditor, + HtmlRenderer, + HtmlEditorProvider, + htmlToEditorSchema, +} from '@compai/css-gui' +import { useState } from 'react' + +const initialValue: any = { + tagName: 'a', + href: '#', + style: { + position: 'relative', + display: 'flex', + alignItems: 'stretch', + flexDirection: 'column', + // textDecoration: 'none', + overflow: ['hidden'], + height: 'auto', + }, + children: [ + { + tagName: 'section', + style: { + overflow: ['hidden'], + maxHeight: { value: 40, unit: 'vh' }, + minHeight: { + type: 'responsive', + values: [ + { value: 160, unit: 'px' }, + { value: 256, unit: 'px' }, + { value: 256, unit: 'px' }, + ], + }, + }, + children: [ + { + tagName: 'img', + style: { + width: { value: 100, unit: '%' }, + display: 'block', + }, + attributes: { + src: 'https://dlu344star2bj.cloudfront.net/i/3090-0015.jpg', + }, + children: [], + }, + ], + }, + { + tagName: 'div', + style: { + height: { value: 100, unit: '%' }, + display: 'flex', + flexDirection: 'column', + paddingTop: { value: 32, unit: 'px' }, + paddingBottom: { value: 32, unit: 'px' }, + }, + children: [ + { + tagName: 'h2', + style: { + marginTop: { value: 0, unit: 'px' }, + marginBottom: { value: 0, unit: 'px' }, + fontWeight: '900', + fontSize: { + type: 'responsive', + values: [ + { value: 24, unit: 'px' }, + { value: 32, unit: 'px' }, + { value: 48, unit: 'px' }, + ], + }, + lineHeight: { value: 1.25, unit: 'number' }, + }, + children: ['Hello, world!'], + }, + { + tagName: 'h3', + style: { + marginTop: { value: 8, unit: 'px' }, + marginBottom: { value: 0, unit: 'px' }, + fontWeight: '600', + opacity: { value: 0.7, unit: '%' }, + fontSize: { + type: 'responsive', + values: [ + { value: 14, unit: 'px' }, + { value: 16, unit: 'px' }, + { value: 20, unit: 'px' }, + ], + }, + lineHeight: { value: 1.25, unit: 'number' }, + }, + children: ['This is a subtitle'], + }, + { + tagName: 'p', + style: { + fontSize: { + type: 'responsive', + values: [ + { value: 14, unit: 'px' }, + { value: 16, unit: 'px' }, + { value: 16, unit: 'px' }, + ], + }, + lineHeight: { value: 1.5, unit: 'number' }, + marginTop: { value: 16, unit: 'px' }, + marginBottom: { value: 24, unit: 'px' }, + }, + children: [ + `Lorem ipsum dolor sit amet, consectetur adipiscing elit. + Fusce pellentesque varius molestie. Integer viverra dui at + mauris tempus, a posuere turpis tincidunt. Etiam vitae aliquet + nunc.`, + ], + }, + { + tagName: 'section', + style: {}, + children: [ + { + tagName: 'button', + style: { + all: 'unset', + backgroundColor: 'tomato', + color: '#fff', + display: 'inline-flex', + fontSize: { + type: 'responsive', + values: [ + { value: 14, unit: 'px' }, + { value: 16, unit: 'px' }, + { value: 16, unit: 'px' }, + ], + }, + fontWeight: '800', + justifyContent: 'center', + maxWidth: { + value: 100, + unit: 'px', + }, + textAlign: 'center', + // textDecoration: 'none', + whiteSpace: 'nowrap', + paddingLeft: { value: 16, unit: 'px' }, + paddingRight: { value: 16, unit: 'px' }, + paddingTop: { value: 4, unit: 'px' }, + paddingBottom: { value: 4, unit: 'px' }, + }, + children: ['Click me!'], + }, + ], + }, + ], + }, + ], +} + +export default function HtmlEditorExample() { + const [html, setHtml] = useState(initialValue) + + return ( +
      + + +
      + +
      +
      +
      + ) +} diff --git a/apps/docs/pages/properties/index.tsx b/apps/docs/pages/properties/index.tsx index a74b04c1..0d1b97e5 100644 --- a/apps/docs/pages/properties/index.tsx +++ b/apps/docs/pages/properties/index.tsx @@ -12,6 +12,13 @@ import { BorderColorPreview } from '../../components/examples/BorderColorPreview import { BorderWidthPreview } from '../../components/examples/BorderWidthPreview' import { BorderStylePreview } from '../../components/examples/BorderStylePreview' +import { AlignItemsPreview } from '../../components/examples/AlignItemsPreview' +import { JustifyContentPreview } from '../../components/examples/JustifyContentPreview' +import { FlexWrapPreview } from '../../components/examples/FlexWrapPreview' +import { FlexGrowPreview } from '../../components/examples/FlexGrowPreview' +import { FlexShrinkPreview } from '../../components/examples/FlexShrinkPreview' +import { FlexDirectionPreview } from '../../components/examples/FlexDirectionPreview' + import { OutlineColorPreview } from '../../components/examples/OutlineColorPreview' import { OutlineWidthPreview } from '../../components/examples/OutlineWidthPreview' import { OutlineStylePreview } from '../../components/examples/OutlineStylePreview' @@ -64,7 +71,7 @@ export default function Docs() {
      @@ -77,6 +84,12 @@ export default function Docs() { + + + + + + diff --git a/package.json b/package.json index 74aaa70e..7a7c1bd9 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ }, "engines": { "npm": ">=7.0.0", - "node": ">=14.0.0" + "node": ">=24.0.0" }, "prettier": { "singleQuote": true, @@ -31,10 +31,10 @@ }, "packageManager": "yarn@1.22.18", "dependencies": { - "@changesets/cli": "^2.22.0", + "@changesets/cli": "^2.26.0", "@manypkg/cli": "^0.19.1", - "prettier": "^2.6.2", - "tsup": "^5.12.6", - "turbo": "^1.2.6" + "prettier": "^2.7.1", + "tsup": "^6.2.3", + "turbo": "^1.3.1" } } diff --git a/packages/config/package.json b/packages/config/package.json index d599929c..f8db14b5 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -8,8 +8,8 @@ "eslint-preset.js" ], "dependencies": { - "eslint-config-next": "^12.1.5", + "eslint-config-next": "^13.2.3", "eslint-config-prettier": "^8.5.0", - "eslint-plugin-react": "7.29.4" + "eslint-plugin-react": "7.30.0" } } diff --git a/packages/gui/CHANGELOG.md b/packages/gui/CHANGELOG.md index 727e22dd..ed89bf96 100644 --- a/packages/gui/CHANGELOG.md +++ b/packages/gui/CHANGELOG.md @@ -1,5 +1,1147 @@ # @compai/css-gui +## 0.0.247 + +### Patch Changes + +- 2c1bbde9: Bump @radix-ui/react-dropdown-menu from 1.0.0 to 2.0.3 + +## 0.0.246 + +### Patch Changes + +- 95540fca: Adds Astro support for export + +## 0.0.245 + +### Patch Changes + +- debd3b89: Properly handle pseudos when stringifying CSS object + +## 0.0.244 + +### Patch Changes + +- d543091c: Changes color to be more accessible in editor +- fd7865c8: Fixes typo + +## 0.0.243 + +### Patch Changes + +- bb2079e3: New design styles +- e116b855: Ensure theme is passed to style element stringification + +## 0.0.242 + +### Patch Changes + +- 1f758bed: Fixes to two small design bugs + +## 0.0.241 + +### Patch Changes + +- 4be2253e: Copy over emotion's hash code, faux ESM makes it tricky to use as dep + +## 0.0.240 + +### Patch Changes + +- 3d312157: Add style element to enhance export + +## 0.0.239 + +### Patch Changes + +- 8db98565: Use style string and don't destructure slots as attrs + +## 0.0.238 + +### Patch Changes + +- 700259d1: Make sure all code generators are passed theme in export + +## 0.0.237 + +### Patch Changes + +- 263b9b23: Move getAttrSyntax to util + +## 0.0.236 + +### Patch Changes + +- 38996b16: Include attributes in enhance export + +## 0.0.235 + +### Patch Changes + +- b0c58514: Implement first pass of enhance output + +## 0.0.234 + +### Patch Changes + +- 63cc6ff4: Add initial support for selector functions + +## 0.0.233 + +### Patch Changes + +- adea2803: Add filter element attributes + +## 0.0.232 + +### Patch Changes + +- 08e07226: Bump @radix-ui/react-slider from 0.1.4 to 1.0.0 +- d48ae3bf: Bump copy-to-clipboard from 3.3.1 to 3.3.2 + +## 0.0.231 + +### Patch Changes + +- 294beec5: Adds new svg elements and attributes + +## 0.0.230 + +### Patch Changes + +- 0846769d: Fix color label overflow + +## 0.0.229 + +### Patch Changes + +- 5770da69: Improve tap targets and spacing + +## 0.0.228 + +### Patch Changes + +- 312acb38: Apply styles to text parent + +## 0.0.227 + +### Patch Changes + +- 8d695237: Ignore colors with alpha in regen + +## 0.0.226 + +### Patch Changes + +- 98b7d345: Fix regen for theme values + +## 0.0.225 + +### Patch Changes + +- 603fbfed: Add an empty text node to prose elements + +## 0.0.224 + +### Patch Changes + +- 859ef100: Fix inconsistent typefaces +- d6ddbe3b: Send along options to stringify in tuple schema + +## 0.0.223 + +### Patch Changes + +- 049630e1: Add repeat keywords to count + +## 0.0.222 + +### Patch Changes + +- 7f4f6573: Add component swapping + +## 0.0.221 + +### Patch Changes + +- d1039b08: Move event propagation call + +## 0.0.220 + +### Patch Changes + +- c9b6365d: Disable browser label/input selection handling in the canvas + +## 0.0.219 + +### Patch Changes + +- ff2f1dcd: A small patch to remove autocorrect from property input control + +## 0.0.218 + +### Patch Changes + +- 794eab84: Make font size consistent in DOM tree + +## 0.0.217 + +### Patch Changes + +- eb553037: Improve node type swapping + +## 0.0.216 + +### Patch Changes + +- 354f899f: Implement inline insert for components/slots + +## 0.0.215 + +### Patch Changes + +- 565f3ed3: Maintain component children + +## 0.0.214 + +### Patch Changes + +- 74ac4a3e: Improve adding box shadow layers + +## 0.0.213 + +### Patch Changes + +- 8114b4c4: Improve color display + +## 0.0.212 + +### Patch Changes + +- 3f04e7ac: Only wrap imports when there's more than one top level element + +## 0.0.211 + +### Patch Changes + +- 790afdba: Keep component name in combobox when selected + +## 0.0.210 + +### Patch Changes + +- 9628acc5: Keep props around when swapping between components + +## 0.0.209 + +### Patch Changes + +- 50d060da: Adds new properties and svg elements + +## 0.0.208 + +### Patch Changes + +- b5dc91a7: Make sure tag name combobox syncs + +## 0.0.207 + +### Patch Changes + +- c53ca4bb: Improve enter handling for combobox + +## 0.0.206 + +### Patch Changes + +- 2908cba5: Make sure default value is passed to base schema + +## 0.0.205 + +### Patch Changes + +- 635d59de: Fix palette picker z index + +## 0.0.204 + +### Patch Changes + +- f0114ae9: Fix color picker style bug + +## 0.0.203 + +### Patch Changes + +- 08f99dbb: Fixes typo +- a90031f8: Visual changes to editor controls + +## 0.0.202 + +### Patch Changes + +- f7c41754: Bump @radix-ui/react-switch from 0.1.5 to 1.0.0 +- 5aa3cbec: Bump @radix-ui/react-dropdown-menu from 0.1.6 to 1.0.0 +- 473ba671: Bump @radix-ui/react-popover from 0.1.6 to 1.0.0 + +## 0.0.201 + +### Patch Changes + +- afcce3ed: Improve control styles + +## 0.0.200 + +### Patch Changes + +- 58c2c3fa: Display theme value for scales + +## 0.0.199 + +### Patch Changes + +- af5a6cf9: Add component name to dropdown in editor + +## 0.0.198 + +### Patch Changes + +- f464b9d0: Bump theme-ui from 0.14.6 to 0.14.7 + +## 0.0.197 + +### Patch Changes + +- 5cb0fcf5: Show function names in input + +## 0.0.196 + +### Patch Changes + +- a3654f79: Add theme support in gradient + +## 0.0.195 + +### Patch Changes + +- 5a373ac3: Add support for box shadows in theme + +## 0.0.194 + +### Patch Changes + +- 9784d96d: Add changeset + +## 0.0.193 + +### Patch Changes + +- b5c54ad8: Make border radius theme aware + +## 0.0.192 + +### Patch Changes + +- 82aafd34: Add random image to image when added to canvas + +## 0.0.191 + +### Patch Changes + +- 1fd09f49: Improve font family theme integration + +## 0.0.190 + +### Patch Changes + +- 684e2f65: Fix gradient stops adding + +## 0.0.189 + +### Patch Changes + +- 05f3157a: Add component/slot to layers panel + +## 0.0.188 + +### Patch Changes + +- 130847c4: Fix bug with inline text editing + +## 0.0.187 + +### Patch Changes + +- db4fa469: Implement inline text editing + +## 0.0.186 + +### Patch Changes + +- 6e4d520b: Theme handling improvements, remove duplicate UI + +## 0.0.185 + +### Patch Changes + +- d9ff3da0: Properly handle contrast for all properties + +## 0.0.184 + +### Patch Changes + +- 304e6671: Improve node adding and editing + +## 0.0.183 + +### Patch Changes + +- 49aae809: Constrain to accessible contrasts when generating colors + +## 0.0.182 + +### Patch Changes + +- 2351ca88: Handle textarea children + +## 0.0.181 + +### Patch Changes + +- 1a4562c9: Refactor fieldset passing + +## 0.0.180 + +### Patch Changes + +- d7124e11: Add draggable reordering to field array inputs + +## 0.0.179 + +### Patch Changes + +- 5820a1bb: Fix node type select + +## 0.0.178 + +### Patch Changes + +- bb72987d: Ignore style attribute on import for now + +## 0.0.177 + +### Patch Changes + +- 474882f6: Improve nested component selection + +## 0.0.176 + +### Patch Changes + +- ebde90d6: Improve HTML node imports + +## 0.0.175 + +### Patch Changes + +- cc3bed1f: Improve fieldset fuzzy search + +## 0.0.174 + +### Patch Changes + +- 92807f4a: Add support for nested elements + +## 0.0.173 + +### Patch Changes + +- 9b88bf0d: Implement HTML and Markdown imports for DOM structure + +## 0.0.172 + +### Patch Changes + +- 3930a3bc: Improve element selection + +## 0.0.171 + +### Patch Changes + +- 56cacc60: Fix transforms + +## 0.0.170 + +### Patch Changes + +- ff1d652e: Ensure that theme colors are generated + +## 0.0.169 + +### Patch Changes + +- 122bd3ed: Enable selection for nested components + +## 0.0.168 + +### Patch Changes + +- b6d1c2fe: Internal refactor of HTML renderers and editors + +## 0.0.167 + +### Patch Changes + +- e2bd4fb8: Internal refactor for canvas prop instantiation + +## 0.0.166 + +### Patch Changes + +- 084d6bb9: Add inline text editing to node tree + +## 0.0.165 + +### Patch Changes + +- 1a9b3f54: Add more rect attributes + +## 0.0.164 + +### Patch Changes + +- 27c01a47: Add support for nesting components as children + +## 0.0.163 + +### Patch Changes + +- 7ee06fcd: Internal refactoring + +## 0.0.162 + +### Patch Changes + +- 0a39cf5f: Don't allow for path selection inside component + +## 0.0.161 + +### Patch Changes + +- 57dd87dd: Expose attributes for a component + +## 0.0.160 + +### Patch Changes + +- b2c31b23: Make list schema use theme when relevant + +## 0.0.159 + +### Patch Changes + +- 03505bbf: Add prop syntax to relevant exports + +## 0.0.158 + +### Patch Changes + +- 993b2236: Add basic slot support for strings + +## 0.0.157 + +### Patch Changes + +- 971e506a: Improve some default values + +## 0.0.156 + +### Patch Changes + +- 2bd60942: Fix component selection + +## 0.0.155 + +### Patch Changes + +- 184ff579: Fix responsive theme values + +## 0.0.154 + +### Patch Changes + +- e4f12cad: Add initial component support + +## 0.0.153 + +### Patch Changes + +- 7ba14dbb: Adds background color to fix bug on node editor + +## 0.0.152 + +### Patch Changes + +- 0246cd41: Changes element editor to sticky position + +## 0.0.151 + +### Patch Changes + +- 7683e6b8: Fix theme selection for box side + +## 0.0.150 + +### Patch Changes + +- 000e4489: Add polyline element + +## 0.0.149 + +### Patch Changes + +- 87d117be: Fix skew x/y + +## 0.0.148 + +### Patch Changes + +- 5bd603aa: Allow cursor to be overridden in canvas +- 97d48aee: Fix translate3d + +## 0.0.147 + +### Patch Changes + +- 7e8991b8: Only set default canvas styles in canvas mode + +## 0.0.146 + +### Patch Changes + +- 888a55fe: Set default to current color + +## 0.0.145 + +### Patch Changes + +- 6f28e1db: Add theme support for box side properties +- 141b70c7: Pass theme to shorthands + +## 0.0.144 + +### Patch Changes + +- d2bf7579: Pass theme to codegen + +## 0.0.143 + +### Patch Changes + +- 236266eb: Zero index theme values + +## 0.0.142 + +### Patch Changes + +- 07cf4070: Fix system colors + +## 0.0.141 + +### Patch Changes + +- 1fd871b3: Pass theme along with document for codegen + +## 0.0.140 + +### Patch Changes + +- 09588f40: Improve theme integration + +## 0.0.139 + +### Patch Changes + +- 20f68b77: Remove unneeded internal function +- ffb1ef8e: Fix theme handling in HTML editor + +## 0.0.138 + +### Patch Changes + +- 6ad62f66: Add some basic SVG functionality + +## 0.0.137 + +### Patch Changes + +- 6df72919: Properly hide none schema type, tie in variable fonts + +## 0.0.136 + +### Patch Changes + +- af3185f5: Default z index to 1 + +## 0.0.135 + +### Patch Changes + +- 5bfb117d: Change default length value for height + +## 0.0.134 + +### Patch Changes + +- 4790114f: Don't error when the theme path doesn't exist +- 50b691fd: Adjust height/width default values + +## 0.0.133 + +### Patch Changes + +- cbac582a: Don't use old color shape + +## 0.0.132 + +### Patch Changes + +- ea271f92: Stringify font family + +## 0.0.131 + +### Patch Changes + +- d9d7d449: Add back node copying, make more robust + +## 0.0.130 + +### Patch Changes + +- 5d9ad0c1: Misc bug fixes including tuple handling and box sides + +## 0.0.129 + +### Patch Changes + +- 46040f61: Remove user select from labels + +## 0.0.128 + +### Patch Changes + +- e4b01dea: Hide copy node temporarily + +## 0.0.127 + +### Patch Changes + +- 3c1b1a68: Remove default button styles, add tokenizer + +## 0.0.126 + +### Patch Changes + +- 3660e1ad: Transform legacy formats, ensure transform happens before CSS export + +## 0.0.125 + +### Patch Changes + +- 89c8d7fa: Stringify keywords before validation + +## 0.0.124 + +### Patch Changes + +- 69fc6fcb: Accept theme in html editor, pass to style controls + +## 0.0.123 + +### Patch Changes + +- c269a1e3: More app like chrome + +## 0.0.122 + +### Patch Changes + +- 94f1b85: Add copy/wrap node + +## 0.0.121 + +### Patch Changes + +- 4632b1b: Make item display configurable + +## 0.0.120 + +### Patch Changes + +- 1588bfd: Make default node an empty div +- 0273dee: Fix background-size + +## 0.0.119 + +### Patch Changes + +- c2a64fb: Fix selection bug on node adding +- cc6d912: Improve comboboxes + +## 0.0.118 + +### Patch Changes + +- 31bdf9b: Clear all styles dropdown + +## 0.0.117 + +### Patch Changes + +- e432f72: Changes layers editor +- 6c83225: Remove fieldset + +## 0.0.116 + +### Patch Changes + +- 356d97e: Ensure "add child" is always shown + +## 0.0.115 + +### Patch Changes + +- e0ef441: Make nodes in html editor unist friendly +- 5fe33db: Remove props transform temporarily +- ad2ed3e: Remove attr default temporarily +- b894bd0: Improve unstyled html export + +## 0.0.114 + +### Patch Changes + +- f7619d5: Fix schema transformer to not destructure raw strings +- 0587bb0: Format exports +- db91166: Add React(vanilla/Emotion/Theme UI/Styled JSX) and Vue exports + +## 0.0.113 + +### Patch Changes + +- 2dbba5d: fixes lab and lch color picker + +## 0.0.112 + +### Patch Changes + +- 67f54e3: fixes selecting values in picker + +## 0.0.111 + +### Patch Changes + +- d2b4e14: Fixes color picker mode switching + +## 0.0.110 + +### Patch Changes + +- 6df9f13: Make theme more of a first class citizen + +## 0.0.109 + +### Patch Changes + +- cf5bfc0: Generative controls + +## 0.0.108 + +### Patch Changes + +- 89a9014: Handle undefined values in dimension input + +## 0.0.107 + +### Patch Changes + +- 0fa831b: Add tabs for node/tree/export, add copy to clipboarfor exported HTML + CSS +- 00e15a3: Fix node editing in tabs +- 1042ffc: Design tweaks to editor +- 438ad58: Fix navigation alignment +- 2474219: Force styles editor re-render when selection changes in html editor + +## 0.0.106 + +### Patch Changes + +- f9d81c3: Changes label copy +- 91a1e64: Design tweaks to editor + +## 0.0.105 + +### Patch Changes + +- e1b17b3: Improve fuzzy sort by ignoring hypen in property names + +## 0.0.104 + +### Patch Changes + +- 0b70d4a: Don't set outline or user select when not in canvas mode + +## 0.0.103 + +### Patch Changes + +- 12d442b: Minor internal improvements to inputs + +## 0.0.102 + +### Patch Changes + +- 760266c: Removes modes from color groups + +## 0.0.101 + +### Patch Changes + +- eb84f84: Allow manually typed decimals in number input + +## 0.0.100 + +### Patch Changes + +- 77a9d7c: Fixes colorpicker for safari + +## 0.0.99 + +### Patch Changes + +- c96be76: Fix bug with default values + +## 0.0.98 + +### Patch Changes + +- 21ec5af: Remove unneeded canvas wrap +- b943e01: kebab property names +- b0847c4: Fix href handling in canvas + +## 0.0.97 + +### Patch Changes + +- c8f38a8: Tweak styles +- 60189e3: Fix combobox, convert all inputs to new schema +- ce61c0c: Clean up visuals + +## 0.0.96 + +### Patch Changes + +- a679ce7: Implement dynamic fieldsets for pseudos + +## 0.0.95 + +### Patch Changes + +- 28f0e9d: Fix combobox init + +## 0.0.94 + +### Patch Changes + +- 0b91ab3: Begin generating controls from schema + +## 0.0.93 + +### Patch Changes + +- 665fe5e: Fixes importing theme and theme value ranges + +## 0.0.92 + +### Patch Changes + +- 159bfb1: Bump react and @types/react +- 167af9a: Bump react-feather from 2.0.9 to 2.0.10 + +## 0.0.91 + +### Patch Changes + +- 1b7b5b4: Improve stringification to handle edge cases +- 5fad1da: Improve dimensional controls for space and border +- 76a9a8b: Fix palette swatches/gradient stops +- 32b0449: Export a schema version + +## 0.0.90 + +### Patch Changes + +- e552e6e: Adds html elements and attributes + +## 0.0.89 + +### Patch Changes + +- a985b87: Fixes regen for color input + +## 0.0.88 + +### Patch Changes + +- dc0f8a9: Improve selection after adding and removing nodes +- f6630f1: Turn off user select in canvas + +## 0.0.87 + +### Patch Changes + +- 4c12a85: Fix DraggableInput to be immediately reflected value when keyed down + +## 0.0.86 + +### Patch Changes + +- db6f904: Add HTML codegen +- 6fff7cd: Make text input on HTML editor a textarea + +## 0.0.85 + +### Patch Changes + +- 95aec83: Only wrap elements in span when in canvas + +## 0.0.84 + +### Patch Changes + +- 6e4b786: fixes negative value entry and NaN values + +## 0.0.83 + +### Patch Changes + +- 2f746c0: New default values +- f6b2ab6: Adds additional default values + +## 0.0.82 + +### Patch Changes + +- 1b14e3b: Adds theme preview picker to color popover +- dd9fff9: Fix tree view + +## 0.0.81 + +### Patch Changes + +- 26e8157: Use text node rather than string + +## 0.0.80 + +### Patch Changes + +- c8cfc1f: Delete href in canvas to avoid browser jump +- 29cb0a3: Use default cursor in tree view +- 607f95e: Make label spacing more consistent + +## 0.0.79 + +### Patch Changes + +- ad49603: Sets value to theme unit on mount if init value matches a theme +- d8d15c6: Set cursor to default in canvas +- aae59ca: Improve selection styles + +## 0.0.78 + +### Patch Changes + +- b0adbe2: Add selection indicator to tree view + +## 0.0.77 + +### Patch Changes + +- d076466: Ensure class attrs don't drop styling + +## 0.0.76 + +### Patch Changes + +- 6ec180e: Better handle void elements + +## 0.0.75 + +### Patch Changes + +- a4373e2: Fix theme font families to the top of the input +- b2e9ea5: Add ability to provide a theme as a provider + +## 0.0.74 + +### Patch Changes + +- 300787d: Adds variable font tag support to html editor + +## 0.0.73 + +### Patch Changes + +- 71c8bc4: Add selection state to HTML editor + +## 0.0.72 + +### Patch Changes + +- f5460f6: Select outer root when html editor mounts + +## 0.0.71 + +### Patch Changes + +- 2082101: Keep combobox value in sync + +## 0.0.70 + +### Patch Changes + +- 02d3cac: Adds font tags to html editor + +## 0.0.69 + +### Patch Changes + +- 60842c6: Adjust some types + +## 0.0.68 + +### Patch Changes + +- d43581d: Fix duplicates bug + +## 0.0.67 + +### Patch Changes + +- 5dc4b27: Fix sorting for properties + +## 0.0.66 + +### Patch Changes + +- cec7fb8: Add default styles when a html tag is selected +- 0ffe9ca: Adds more HTML elements to the list +- fff36f0: Clears combobox when item selected + +## 0.0.65 + +### Patch Changes + +- 26eeecb: Point to documentation if styles object is absent +- e2cc0a2: Add property controls for fieldsets + ## 0.0.64 ### Patch Changes diff --git a/packages/gui/jest.config.cjs b/packages/gui/jest.config.cjs new file mode 100644 index 00000000..670d7889 --- /dev/null +++ b/packages/gui/jest.config.cjs @@ -0,0 +1,13 @@ +/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ +module.exports = { + preset: 'ts-jest/presets/default-esm', + testEnvironment: 'node', + globals: { + 'ts-jest': { + useESM: true, + }, + }, + moduleNameMapper: { + '^(\\.{1,2}/.*)\\.js$': '$1', + }, +} diff --git a/packages/gui/package.json b/packages/gui/package.json index c3f2a8a2..97ae23a3 100644 --- a/packages/gui/package.json +++ b/packages/gui/package.json @@ -1,12 +1,14 @@ { "name": "@compai/css-gui", - "version": "0.0.64", + "version": "0.0.247", "type": "module", "module": "./dist/index.js", "types": "./dist/index.d.ts", "license": "MIT", "scripts": { "build": "tsup", + "test": "jest", + "typecheck": "tsc --noEmit", "dev": "tsup --watch", "clean": "rm -rf .turbo node_modules dist" }, @@ -25,13 +27,16 @@ "react-dom": ">= 18" }, "devDependencies": { + "@types/jest": "^28.1.3", "@types/lodash-es": "^4.17.6", - "@types/react": "18.0.5", + "@types/react": "18.0.10", "@types/react-dom": "^18.0.1", "@types/uuid": "^8.3.4", "config": "*", - "react": "18.0.0", + "jest": "^28.1.1", + "react": "18.1.0", "react-dom": "18.0.0", + "ts-jest": "^28.0.5", "tsconfig": "*", "typescript": "^4.6.4" }, @@ -40,24 +45,38 @@ "@mdx-js/react": "^1.6.22", "@radix-ui/react-accordion": "^0.1.6", "@radix-ui/react-collapsible": "^0.1.6", + "@radix-ui/react-dropdown-menu": "^2.0.3", "@radix-ui/react-label": "^0.1.5", - "@radix-ui/react-popover": "^0.1.6", - "@radix-ui/react-slider": "^0.1.4", - "@radix-ui/react-switch": "^0.1.5", + "@radix-ui/react-popover": "^1.0.0", + "@radix-ui/react-select": "^0.1.1", + "@radix-ui/react-slider": "^1.0.0", + "@radix-ui/react-switch": "^1.0.0", "@radix-ui/react-tabs": "^0.1.5", - "@radix-ui/react-toggle": "^0.1.4", + "@radix-ui/react-toggle": "^1.0.1", "@radix-ui/react-tooltip": "^0.1.7", + "@use-gesture/react": "^10.2.17", + "copy-to-clipboard": "^3.3.2", "csstype": "^3.0.11", "culori": "^2.0.3", "downshift": "^6.1.7", + "escape-html": "^1.0.3", + "fuzzysort": "^2.0.1", "get-contrast": "^3.0.0", + "hast-to-hyperscript": "^10.0.1", + "hast-util-to-html": "^8.0.3", + "hast-util-to-mdast": "^8.3.1", "immer": "^9.0.12", "lodash-es": "^4.17.21", - "react-feather": "^2.0.9", - "react-use-gesture": "^9.1.3", + "mdast-util-from-markdown": "^1.2.0", + "mdast-util-to-hast": "^12.1.2", + "mdast-util-to-markdown": "^1.3.0", + "property-information": "^6.1.1", + "react-feather": "^2.0.10", "rehype-parse": "^8.0.4", "rehype-sanitize": "^5.0.1", - "theme-ui": "^0.14.5", + "rehype-stringify": "^9.0.3", + "remark-parse": "^10.0.1", + "theme-ui": "^0.14.7", "unified": "^10.1.2", "unist-util-remove": "^3.1.0", "unist-util-visit": "^4.1.0", diff --git a/packages/gui/src/components/AddFieldset.tsx b/packages/gui/src/components/AddFieldset.tsx new file mode 100644 index 00000000..97878923 --- /dev/null +++ b/packages/gui/src/components/AddFieldset.tsx @@ -0,0 +1,60 @@ +import fuzzysort from 'fuzzysort' +import { elements } from '../data/elements' +import { pseudoClasses } from '../data/pseudo-classes' +import { pseudoElements } from '../data/pseudo-elements' +import { Styles } from '../types/css' +import { Combobox, Label } from './primitives' +import { useEditor } from './providers/EditorContext' +import { KeyArg } from './providers/types' +import { joinPath } from './providers/util' + +interface Props { + field?: KeyArg + styles: Styles + label?: string +} +export const AddFieldsetControl = ({ + field, + styles, + label = 'Add pseudo element or class', +}: Props) => { + const { setField } = useEditor() + const allItems = [...pseudoClasses, ...pseudoElements, ...elements] + + const handleFilterItems = (input: string) => { + if (input === '') { + return allItems + } + + const styleItems = Object.keys(styles) + return fuzzysort + .go(input.replace(/-/g, ''), allItems) + .map((res) => res.target) + .filter((item) => !styleItems.includes(item)) + } + + const handleAddFieldset = (propertyName: string) => { + const fullField = field ? joinPath(field, propertyName) : propertyName + setField(fullField, {}) + } + + return ( +
      + + +
      + ) +} diff --git a/packages/gui/src/components/AddProperty.tsx b/packages/gui/src/components/AddProperty.tsx index c072382c..5ee811b5 100644 --- a/packages/gui/src/components/AddProperty.tsx +++ b/packages/gui/src/components/AddProperty.tsx @@ -1,194 +1,67 @@ -import { useCombobox } from 'downshift' -import { useEffect, useId, useRef, useState } from 'react' import { properties as propertyList } from '../data/properties' -import { getDefaultValue } from '../lib/defaults' +import { getDefaultValue } from './Editor/util' import { Styles } from '../types/css' -import { Label } from './primitives' +import { Combobox, Label } from './primitives' import { useDynamicControls } from './providers/DynamicPropertiesContext' import { useEditor } from './providers/EditorContext' +import { KeyArg } from './providers/types' +import { joinPath } from './providers/util' +import fuzzysort from 'fuzzysort' +import { kebabCase } from 'lodash-es' interface Props { + field?: KeyArg styles: Styles + label?: string } -export const AddPropertyControl = ({ styles }: Props) => { +export const AddPropertyControl = ({ + field, + styles, + label = 'Add property', +}: Props) => { const { setField } = useEditor() const { addDynamicProperty } = useDynamicControls() - const id = useId() - const inputRef = useRef(null) - // @ts-ignore + //@ts-ignore const allProperties: string[] = Object.entries(propertyList) .map(([name, data]) => { - return data.type !== 'none' ? name : null + return data.input ? name : null }) .filter(Boolean) - const [inputItems, setInputItems] = useState([]) - const [filterValue, setFilterValue] = useState('') - - useEffect(() => { - handleFilterItems(filterValue) - }, []) - - const { - isOpen, - toggleMenu, - getMenuProps, - getInputProps, - getItemProps, - getComboboxProps, - highlightedIndex, - } = useCombobox({ - id, - items: inputItems, - selectedItem: filterValue, - onInputValueChange: ({ inputValue }) => { - handleFilterItems(inputValue!) - }, - onSelectedItemChange: ({ selectedItem }) => { - handleAddProperty(selectedItem ?? '') - }, - }) - const handleFilterItems = (input: string) => { + if (input === '') { + return allProperties + } + const styleItems = Object.keys(styles) - const filteredItems = allProperties - .filter((item) => { - if (item.toLowerCase().startsWith(input.toLowerCase() || '')) { - return !styleItems.includes(item) - } - }) - .sort() - setInputItems(filteredItems) + return fuzzysort + .go(input.replace(/-/g, ''), allProperties) + .map((res) => res.target) + .filter((item) => !styleItems.includes(item)) } const handleAddProperty = (propertyName: string) => { - setField(propertyName, getDefaultValue(propertyName)) - if (addDynamicProperty) { + const fullField = field ? joinPath(field, propertyName) : propertyName + + setField(fullField, getDefaultValue(propertyName)) + if (addDynamicProperty && !field) { addDynamicProperty(propertyName) } } return ( -
      -