feat(site-builder): debounce style inputs and stop Layers recomputing on hover
Text/number/hex inputs keep local state and commit on 150ms idle, blur or Enter through the continuous setters; native colour pickers get an onContinuous path; ButtonStylePanel colour routes through the shared setters. LayersPanel collectors return structural signatures/primitives so hover and unrelated prop edits no longer rebuild the tree. Refs #40
This commit is contained in:
1 parent
2180f9a776
commit
ec071c4c39
7 files changed
+582
-76
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import { describe, test, expect, afterEach, beforeEach, vi } from 'vitest';
|
||||
import React from 'react';
|
||||
import { renderEditorHarness, EditorHarness } from '../editorHarness';
|
||||
import { useNodeProp, ColorPickerField, TextInputField, closeContinuousBurst, CONTINUOUS_EDIT_IDLE_MS } from '../../panels/right/styles/shared';
|
||||
import { useNodeProp, ColorPickerField, TextInputField, closeContinuousBurst, CONTINUOUS_EDIT_IDLE_MS, COMMIT_IDLE_MS } from '../../panels/right/styles/shared';
|
||||
import { AnimVisSection } from '../../panels/right/styles/containerBoxModel';
|
||||
import { AnimVisSection as MediaAnimVisSection } from '../../panels/right/styles/mediaBoxModel';
|
||||
|
||||
@@ -115,6 +115,7 @@ describe('undo granularity (real Craft history)', () => {
|
||||
mountFresh(<Probe />);
|
||||
let t = '';
|
||||
for (let i = 0; i < 30; i++) { t += 'x'; edit(textField(), t); tick(100); }
|
||||
tick(COMMIT_IDLE_MS); // TextInputField commits on a 150ms idle
|
||||
expect(props().text).toBe(t);
|
||||
expect(undoDepth()).toBe(1);
|
||||
expect(props().text).toBe('Hi');
|
||||
@@ -163,6 +164,7 @@ describe('undo granularity (real Craft history)', () => {
|
||||
edit(color(), '#121212');
|
||||
edit(textField(), 'abc');
|
||||
edit(textField(), 'abcd');
|
||||
tick(COMMIT_IDLE_MS);
|
||||
expect(undoDepth()).toBe(2);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user