openpencil/packages/docs/pl/programmable/sdk/guides/property-panels.md
Danila Poyarkov 14325280d9 docs(i18n): translate all missing pages to 6 languages
- 78 SDK pages per language (components, composables, advanced API,
  guides, architecture, getting-started)
- vector-edit.md user guide page (5 languages)
- Update stale ru/programmable/cli/inspecting.md
- Fix YAML frontmatter quoting for colons in descriptions

474 files, 0 missing pages across de/es/fr/it/pl/ru.
VitePress build verified — all 546 SDK pages render.
2026-04-22 18:35:22 +03:00

2.5 KiB

title description
Panele właściwości Buduj panele właściwości z kompozytami kontrolek i bezstanowymi prymitywami list.

Panele właściwości

Panele właściwości w @open-pencil/vue są celowo oparte na kompozytach.

Jeśli panel potrzebuje głównie wartości pochodnych od selekcji i akcji aktualizacji, preferuj kompozyty. Jeśli panel potrzebuje wielokrotnie używalnej struktury tablicowej/listowej, użyj bezstanowego prymitywu jak PropertyListRoot.

Typowe kompozyty kontrolek

Dla standardowych sekcji właściwości zacznij od:

  • usePosition()
  • useLayout()
  • useAppearance()
  • useTypography()
  • useExport()

Dla paneli listowych użyj:

  • useFillControls()
  • useStrokeControls()
  • useEffectsControls()

Przykład: panel pozycji

<script setup lang="ts">
import { usePosition } from '@open-pencil/vue'

const { x, y, width, height, updateProp, commitProp } = usePosition()
</script>

<template>
  <div class="grid grid-cols-2 gap-2">
    <input :value="x" @input="updateProp('x', Number(($event.target as HTMLInputElement).value))" />
    <input :value="y" @input="updateProp('y', Number(($event.target as HTMLInputElement).value))" />
    <input :value="width" @input="updateProp('width', Number(($event.target as HTMLInputElement).value))" />
    <input :value="height" @input="updateProp('height', Number(($event.target as HTMLInputElement).value))" />
  </div>
</template>

Przykład: panel wypełnień

<script setup lang="ts">
import { PropertyListRoot, useFillControls } from '@open-pencil/vue'

const fillControls = useFillControls()
</script>

<template>
  <PropertyListRoot prop-key="fills" v-slot="{ items, add, remove }">
    <div v-for="(fill, index) in items" :key="index">
      {{ fill.type }}
      <button @click="remove(index)">Usuń</button>
    </div>

    <button @click="add(fillControls.defaultFill)">Dodaj wypełnienie</button>
  </PropertyListRoot>
</template>

Zasada

  • używaj kompozytów dla bezpośredniej logiki kontrolek
  • używaj prymitywów strukturalnych, gdy powtarzalna koordynacja listy/drzewa/slotu jest trudną częścią

Powiązane API