30 Commits
Author SHA1 Message Date
Oleg Isonen 9dfef774e3 Add a stylesheet name for easier debugging (#731)
## Description

Multiple style elements are easier to differentiate when they have some
hint on the purpose

## Steps for reproduction

1. select style element on canvas, see data-webstudio attribute with a
name

## Code Review

- [ ] hi @TrySound , I need you to do
  - conceptual review (architecture, feature-correctness)

## Before requesting a review

- [x] made a self-review
- [x] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [x] tested locally and on preview environment (preview dev login:
5de6)
- [x] updated [test
cases](https://github.com/webstudio-is/webstudio-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [x] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
2023-01-03 21:39:25 +01:00
Ivan Starkov 6150dc0599 Background image DB support (#701)
## Description

ref  #534

Next PR #705

Db support for ImageValue style.
Having that ImageValue can contain assets we need to transform assets to
`assetId` and back during save/load.

`zod + dataloader` is used for transform for simplicity, allows avoiding
tree traversal, and highly simplifies code.

_I want to merge it to not make one huge PR, it has no breaking changes,
just a new feature save/load support_

## Steps for reproduction

## Code Review

- [x] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
- [x] hi @TrySound, I need 
 - detailed review (read every line)

## Before requesting a review

- [x] made a self-review
- [x] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [x] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
2022-12-27 13:17:22 +03:00
Bogdan Chadkin 752768abbc Use explicit imports from @jest/globals (#645)
pnpm prevents access to jest and @types/jest from packages so we need to
explicitly install it. Though @types/jest is not officially maintained
and often late for months with new major which bloats node_modules with
two versions of jest transitives.

Here is alternative way to use official types. The only downside is
complains these types has less descriptions.
2022-12-16 16:35:22 +03:00
Bogdan Chadkin aba5506e13 Add proprety reset button in popover (#583)
Ref https://github.com/webstudio-is/webstudio-designer/issues/29

<img width="281" alt="Screenshot 2022-12-10 at 12 03 54"
src="https://user-images.githubusercontent.com/5635476/206842519-5812b7d5-2c60-4941-93a7-8a980f6abae0.png">
2022-12-12 15:11:24 +03:00
Ivan Starkov 2be8511780 Add new RGB Style, then fix typescript errors (#578)
The reason of use opaque types, as otherwise props like `value` reused
everywhere.



Implemented same as CssValueInputLogic - during input editing nothing
changed.
Error is shown on Enter click. Value resetted on blur.
2022-12-09 20:31:20 +03:00
Oleg Isonen 6c9839d4f8 apparently Infinity - Infinity is NaN 2022-12-09 11:26:14 +00:00
Oleg Isonen c625298605 Merge branch 'main' into fix-media-query-specificity 2022-12-09 11:01:53 +00:00
Oleg Isonen df72608b2d fix the sort order when minWidth is undefined 2022-12-09 10:45:06 +00:00
Oleg Isonen 8c02d46bb1 fix media query specificity 2022-12-09 01:05:59 +00:00
Andras Bacsai 27469787a0 fix eslint 2022-12-08 13:21:37 +01:00
Ivan Starkov ffae4bd403 Make CSSValueInput controllable, (#551)
CSSValueInput used useEffect and executed onChange etc events on its
own. What in case of any small changes caused loops and strange
behavior. Now should execute everything only as a result of user input.

`parseCssValue` - now stupid parse CSS value and someday will be used
only inside text-control.
setProperty - now accepts StyleValue, the string param is deprecated,
warning set.

CSSValueInput now not update styles during editing.

unit menu now not hiding during formulas etc

fixed bug with updating style on newly created items

fixed scrub bugs with unsubscribing

css-tree Adds 52101 gzip bytes. 
A lot of size is coming from here 

https://github.com/csstree/csstree/blob/97d7f3b95a3efd8f431af39986acc149dceefa59/lib/data.js
more than 1/3 of `esm` size (20+kb gz), and most huge are properties
json we need and use.

Doesn't look tree-shakeable, anyway can be loaded lazily as until
editing we don't need to validate CSS vars.

Investigating: 
- [x] - Changing any style Combobox with mouse cause multiple value
updates to previous and current value (was a blur event issue)
2022-12-07 14:32:34 +04:00
Oleg Isonenandistarkov 4c8989784b Primitive tokens (#507)
https://github.com/webstudio-is/webstudio-designer/issues/494

This PR Renders this UI and, when adding tokens - renders CSS variables
on the canvas: It's behind a feature flag.

<img width="411" alt="Screenshot 2022-11-25 at 15 51 00"
src="https://user-images.githubusercontent.com/52824/204009859-81ed72c4-e758-4973-be49-c8c65e6b4661.png">


## Before requesting a review

- [ ] if the PR is WIP - use draft mode
- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")
- [ ] what kind of review is needed?
  - [ ] conceptual
  - [ ] detailed
  - [ ] with testing

## Test cases

- [ ] step by step interaction description and what is expected to
happen

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory

Co-authored-by: istarkov <istarkov@gmail.com>
2022-11-25 19:51:54 +01:00
Bogdan Chadkin 7f44d78279 Improve text editor styling and enable auto focus (#504)
Ref https://github.com/webstudio-is/webstudio-designer/issues/107

- fixed bold italic styling
- populate default style for instances created from text editor
- added unmount support to css engine
- auto focus text editor when start editing
2022-11-24 00:07:45 +03:00
Bogdan Chadkin 50010c7f0d Check all .ts and .tsx in packages src folder (#476)
Here "include" often have list of extensions and forgotten .tsx so such
modules are left unchecked. Replaced with just "src" which consider all
typescript extensions.

Ideally stop using tsc to build artifacts, switch to esbuild and remove
complex configuration from all tsconfig.json.
2022-11-19 21:21:38 +03:00
Oleg Isonen bda114b4e3 move tree utils again back to project
someone merged them back into app after they were moved to project
2022-11-18 14:01:19 +01:00
Oleg Isonen 7d74fb51ef emove stitches from sdk 2022-11-17 03:39:37 +01:00
Oleg Isonen 80a30a2b20 render fonts using css engine 2022-11-17 03:13:03 +01:00
Oleg Isonen 628081d0fa remove usage of stitches for helper css on canvas 2022-11-16 22:31:01 +01:00
Oleg Isonen 005baac2ed move react hooks from css engine to shared styles, it's too tight with app 2022-11-16 17:38:01 +01:00
Oleg Isonen 42fb00dfbe fix the media rule formatter 2022-11-16 17:04:31 +01:00
Oleg Isonen ab8ecd37de use default media query 2022-11-16 15:41:53 +01:00
Oleg Isonen 1c4dedea94 always require a breakpoint when populating instances 2022-11-15 16:18:36 +01:00
Oleg Isonen 2a0e920725 working version 2022-11-13 20:05:06 +01:00
Oleg Isonen c427316291 css-engine wip 2022-11-13 15:30:27 +01:00
Oleg Isonen e1986382e6 working version of the engine 2022-11-12 17:24:05 +01:00
Oleg Isonen 6269ad2422 wip 2022-11-11 10:24:40 +01:00
Oleg Isonen 27ade6adc7 remodeling 2022-11-11 00:49:31 +01:00
Oleg Isonen f3108b0f57 add one rule 2022-11-10 22:04:00 +01:00
Oleg Isonen 89d9c9aaf6 breakpoints 2022-11-10 21:39:45 +01:00
Oleg Isonen 9a8a3021bf initial css engine 2022-11-10 19:55:38 +01:00