Skip to content

Deep signal optimisations - #2

Draft
saitonakamura wants to merge 14 commits into
mainfrom
deep-signal-optimisations
Draft

Deep signal optimisations#2
saitonakamura wants to merge 14 commits into
mainfrom
deep-signal-optimisations

Conversation

@saitonakamura

Copy link
Copy Markdown

No description provided.

Add DeepSignal integration and update package manager

- Introduced DeepSignal for improved reactivity in UIKit components.
- Updated `package.json` to use pnpm@10.5.2 and added workspaces.
- Added `deepsignal` as a dependency in `packages/uikit`.
- Updated `pnpm-lock.yaml` to reflect new dependencies.
```
Integrate `deepsignal` for enhanced reactivity

- Added `deepsignal` dependency to `package.json`.
- Replaced `Signal` with `DeepSignal` in various components.
- Updated `usePropertySignals` to utilize `deepSignal`.
- Adjusted listener and container logic to support `DeepSignal`.
```
Fix property assignment in Container and Content classes

- Remove unnecessary undefined type from DeepSignal properties.
- Use Object.assign for updating propertiesSignal to ensure proper merging.
```
```typescript
<<<<<<< SEARCH
import { AllOptionalProperties } from '../properties/default.js'
import { createParentContextSignal, setupParentContextSignal, bindHandlers, Component } from './utils.js'
import { ReadonlySignal, Signal, effect, signal, untracked } from '@preact/signals-core'
import { TextProperties, createTextState, setupText } from '../components/text.js'
import { MergedProperties } from '../properties/index.js'
import { ThreeEventMap } from '../events.js'
=======
import { AllOptionalProperties } from '../properties/default.js'
import { createParentContextSignal, setupParentContextSignal, bindHandlers, Component } from './utils.js'
import { ReadonlySignal, Signal, effect, signal, untracked } from '@preact/signals-core'
import { DeepSignal, deepSignal } from 'deepsignal'
import { TextProperties, createTextState, setupText } from '../components/text.js'
import { MergedProperties } from '../properties/index.js'
import { ThreeEventMap } from '../events.js'
>>>>>>> REPLACE
```

packages/uikit/src/vanilla/text.ts
```typescript
<<<<<<< SEARCH
  private readonly propertiesSignal: Signal<TextProperties<EM> | undefined>
=======
  private readonly propertiesSignal: DeepSignal<TextProperties<EM>>
>>>>>>> REPLACE
```
…vg components and vanilla/svg implementation
Refactor properties to use DeepSignal for reactivity

Replaced Signal with DeepSignal for properties across components to
enhance reactivity and simplify nested property updates. Updated
related functions and utilities to accommodate the new structure.
```
Update DeepSignal imports and add deepsignal dependency

- Updated all DeepSignal imports to use 'deepsignal/core'.
- Added 'deepsignal' version 1.6.0 to dependencies in package.json.
```
Refactor DefaultProperties to use memoized property hashes

- Added `createDefaultPropertiesHash` to generate stable hashes for
  properties.
- Updated `DefaultProperties` to use `useMemo` for efficient re-renders.
- Improved handling of nested objects and signals in default properties.
```
Refactor property merging and signal handling for components

- Replace `MergedProperties` with `ReadonlyDeepSignalObject` for better type safety.
- Introduce `mergeProps` utility to handle property merging with priorities.
- Update components to use `deepSignal` for default properties.
- Simplify computed properties and remove redundant `computedMergedProperties`.
- Refactor `setupImmediateProperties` to handle dynamic keys.
- Adjust `PanelMaterialConfig` to support dynamic property keys.
- Improve type annotations and remove unnecessary comments.
```
Add @ts-expect-error annotations for type issues

This commit introduces `@ts-expect-error` annotations in various files to suppress TypeScript errors where type mismatches or missing type definitions occur. These changes ensure the code compiles without errors while maintaining functionality.
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant