Code Monkey home page Code Monkey logo

css.gui's People

Contributors

deanblacc avatar dependabot[bot] avatar github-actions[bot] avatar hturan avatar johno avatar kurata321 avatar mrmrs avatar natemoo-re avatar tesseralis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

css.gui's Issues

Creating new background gradient does not work

I've been told to keep the requests coming, so I am doing that :)

I tried out the BackgroundImage input. It doesn't seem to work for initializing a new gradient (maybe needs default stops to start?)

gif-2022-05-04_10-39-05

Additionally it seems like being able to remove a background image in the list would be helpful.

borderStyle is not recognized

Maybe it's already on your list, but I get:

Unhandled Runtime Error
TypeError: Cannot read properties of undefined (reading 'type')

Call Stack
getInputComponent
node_modules/@compai/css-gui/dist/index.js (6172:0)

when trying to use borderStyle. borderWidth and borderColor work fine.

Change default steps for line-height to .05

The step interval for the line-height control is set to 1 (believe this is html default). As line-height values generally range from 1-2 with values like 1.25 being common, we should increase the granularity so it's a bit smoother to scrub through possible values.

Add a RenderElement component that transforms our styles schema and applies the styling

Perhaps something like the following?

import { useState } from 'react'
import { Editor, RenderElement } from 'css-gui'

export const MyEditor = () => {
  const [styles, setStyles] = useState({})
  const inlineStyles = useInlineStyles(styles)

  return (
    <>
      <Editor element="p" value={styles} onChange={setStyles} />
      <RenderElement tagName="p" styles={styles}>Hello, world!</p>
    </>
  )
}

Error on use in existing project

Ran into this issue trying to install and use Editor with an existing app -- the error seems to come up once I start specifying state in the initial editor state. Any tips on how I track down what is going on here?

shotwin-2022-04-27_13-57-24

Unhandled Runtime Error
TypeError: (0 , react__WEBPACK_IMPORTED_MODULE_0__.useId) is not a function

Call Stack
ColorInput
node_modules/@compai/css-gui/dist/index.js (2120:18)
renderWithHooks
node_modules/react-dom/cjs/react-dom.development.js (14985:0)
mountIndeterminateComponent
node_modules/react-dom/cjs/react-dom.development.js (17811:0)
beginWork
node_modules/react-dom/cjs/react-dom.development.js (19049:0)
HTMLUnknownElement.callCallback
node_modules/react-dom/cjs/react-dom.development.js (3945:0)
Object.invokeGuardedCallbackDev
node_modules/react-dom/cjs/react-dom.development.js (3994:0)
invokeGuardedCallback
node_modules/react-dom/cjs/react-dom.development.js (4056:0)
beginWork$1
node_modules/react-dom/cjs/react-dom.development.js (23964:0)
performUnitOfWork
node_modules/react-dom/cjs/react-dom.development.js (22776:0)
workLoopSync
node_modules/react-dom/cjs/react-dom.development.js (22707:0)
renderRootSync
node_modules/react-dom/cjs/react-dom.development.js (22670:0)
performSyncWorkOnRoot
node_modules/react-dom/cjs/react-dom.development.js (22293:0)
eval
node_modules/react-dom/cjs/react-dom.development.js (11327:0)
unstable_runWithPriority
node_modules/scheduler/cjs/scheduler.development.js (468:0)
runWithPriority$1
node_modules/react-dom/cjs/react-dom.development.js (11276:0)
flushSyncCallbackQueueImpl
node_modules/react-dom/cjs/react-dom.development.js (11322:0)
flushSyncCallbackQueue
node_modules/react-dom/cjs/react-dom.development.js (11309:0)
scheduleUpdateOnFiber
node_modules/react-dom/cjs/react-dom.development.js (21893:0)
dispatchAction
node_modules/react-dom/cjs/react-dom.development.js (16139:0)
eval
node_modules/@liveblocks/react/lib/index.js (306:0)
step
node_modules/@liveblocks/react/lib/index.js (53:0)
Object.eval [as next]
node_modules/@liveblocks/react/lib/index.js (34:45)
fulfilled
node_modules/@liveblocks/react/lib/index.js (24:42)

Implement a pseudos control, add that to codegen

It should be aware of what pseudo classes and elements can be edited based on the element that the editor is associated with. For example, links have pseudos that other elements don't have.

<PseudoEditor name="after">
  <FontSize />
  <BackgroundColor />
  <Content />
</PseudoEditor>
<PseudoEditor name="before">
  <FontSize />
  <BackgroundColor />
  <Content />
</PseudoEditor>

Easy way to set color palette

I'd like an easy way to set some preset colors for the color picker input. This may be possible through the theme option but I didn't get it to work on my naive try of feeding { colors: { red: "red", blue: "blue" } } into the theme prop of the editor.

Possible use-case: user-defined styles

I've only half thought through this but thought it might be helpful for you all as a possible use-case:

There's a good chance we'll use css.gui to let users style their own blocks, something like this:
shotwin-2022-04-27_16-10-53

I think it will make sense to pre-define some commonly used styles for them to edit. Working on that now.

Someday I'd also love to let them add any CSS property to that styling block -- maybe something like a combobox where it suggests valid style properties as you start typing....

I think (as you cover more and more of the spec) css.gui could be a good fit for this -- a user adding a style would just mean setting in the style state, then the editor component should pick it up automatically.

Another piece would be that combobox -- I guess it would need to be powered by a list of valid style properties, I'm sure I could put that together but there also might be a way for css.gui to expose that? Or provide the combobox "add a style property" functionality out of the box?

Align the color swatches

I imagine custom styling of inputs is a possible rabbithole, at the moment my top request is a way to align the color swatch inputs -- I think in my specific case right aligning them (with 'justify-content: space-between') would work, though I'm open to other ideas as well. If they had a consistent classname I could do it myself (though I can imagine you might want to approach it a different way).

shotwin-2022-05-03_18-06-53

Editor option to clear or reset property

It would also be nice to have a way to set the default value in the editor, particularly for color values. Although maybe that gets weird in terms of telling whether that default value is applied...

I'm pretty much able to do what I want by adding in my own button that only appears when a property is set -- but possibly there's a cleaner/more general way to do it on your end.

gif-2022-04-29_18-06-26

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.