Share
Embed
管理画面向けUIコンポーネントの設計 - Web componentsでフレームワーク非依存を目指す
「UIT × Bonfire Front-end Meetup #1」での発表資料です。
https://uit.connpass.com/event/300284/
LINEヤフーTech (LY Corporation Tech) PRO
December 12, 2023
Transcript
26 slides
-
ཧը໘ͷ։ൃͷಛ w ͦΕͳΓʹେن w ߦ7VFϑΝΠϧ ݸ+4ϑΝΠϧ ݸ w ػೳ͕ଟذʹΘͨΔ͕ɺ֤ػೳͷར༻ස·ͪ·ͪ
w ಛఆͷϢʔβʔʹ͚ͩඞཁͳཧը໘͕ͨ͘͞Μ͋ΔΠϝʔδ ࠷খͷ࿑ྗͰɺͦͷը໘ͷॏཁʹ߹Θͤͨ ΫΦϦςΟͰ6*Λ࣮͢Δ͜ͱΛॏࢹ -
ҠߦͷऔΓΈ w ݕ౼ͷ݁Ռ5BJMXJOEΛ࠾༻͠ɺঃʑʹҠߦ͍ͯ͘͜͠ͱʹ w #PPUTUSBQͷDMBTT໊͕5BJMXJOEͷͷͱॏෳ😩 w Ήͳ͘5BJMXJOEͷQSF fi YΛ༗ޮԽ AMEAΛ༩
<div class="ld-flex ld-items-start ld-mx-200 ld-my-600"> <div class="ld-w-[130px] ld-h-[130px] ld-bg-gray-200"> <img class="ld-max-w-full ld-max-h-full" /> ... -
ͱ͍͏ͷͷʜ w 6*ίϯϙʔωϯτͱͯ͠8FCDPNQPOFOUTΛ࠾༻͢Δ͜ͱʹջٙత ͳҙݟଟ͍ w ։ൃύϥμΠϜͷҧ͍ w طଘϑϨʔϜϫʔΫͱͷੑ w 443ͷରԠ
w ͦΕͧΕͷ՝ʹ͍ͭͯɺࢲͨͪͷࠓͷղܾࡦΛ͠·͢ -
-JU͚ͷϔϧύʔΛ༻ҙ͢Δ͜ͱͰͳ͘ಈ࡞ import * as checkbox from '@zag-js/checkbox'; import { useController
} from 'haunted'; import { html } from 'lit'; import { MachineController, applyProps, createElement } from '~util'; export const Checkbox = createElement((element) => { const machine = useController( (host) => new MachineController(host, checkbox) ); const api = machine.connect(); return html` <label ${applyProps(api.rootProps)}> <div class="checkbox" ${applyProps(api.controlProps)}></div> <input ${applyProps(api.hiddenInputProps)} /> <span ${applyProps(api.labelProps)}> <slot></slot> </span> </label> `; }); -
ιʔείʔυ͔ΒQSPQTTMPUTFNJUTͷܕΛநग़ import { defineComponentEmits, defineComponentProps, defineComponentSlots, } from '~util'; export
const tagName = 'my-checkbox'; export const props = defineComponentProps<{ checked: boolean; }>({ checked: false, }); export const slots = defineComponentSlots<{ default: () => void; }>(); export const emit = defineComponentEmits<{ changed: boolean | 'indeterminate'; }>(); { "schemaVersion": "1.0.0", "modules": [ { "kind": "javascript-module", "declarations": [ { "kind": "class", "customElement": true, "tagName": "my-checkbox", "attributes": [ { "name": "checked", "fieldName": "checked", "type": { "text": "boolean" }, "default": "false" } ], "slots": [], "events": [ { "name": "changed", "type": { "text": "CustomEvent<boolean | \"indeterminate\">" } -
ͳ͘3FBDU7VF͔Βར༻Ͱ͖ΔΑ͏ʹʂ <MyCheckbox :checked="checked" @changed="..."> ... </MyCheckbox> <MyCheckbox checked={checked} onChanged={...}> ...
</MyCheckbox> { "schemaVersion": "1.0.0", "modules": [ { "kind": "javascript-module", "declarations": [ { "kind": "class", "customElement": true, "tagName": "my-checkbox", "attributes": [ { "name": "checked", "fieldName": "checked", "type": { "text": "boolean" }, "default": "false" } ], "slots": [], "events": [ { "name": "changed", "type": { "text": "CustomEvent<boolean | \"indeterminate\">" } 7VF 3FBDU