Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
「defineCustomElement」を活用した サービス共通のUIコンポーネントライブラリ
Search
piyoppi
November 21, 2023
Programming
1.4k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
「defineCustomElement」を活用した サービス共通のUIコンポーネントライブラリ
piyoppi
November 21, 2023
Other Decks in Programming
See All in Programming
Snowflake Summitでの新機能 CoCo / CoWork / snowflake-summit-2026-overall-what-new-coco
tatsuhiro
1
220
Claude Opus 4.6以後の受託開発エンジニアの変化(Claude Code開発ノウハウ大公開スペシャルbyクラスメソッド)
iidatakuma
1
420
壊れたパーサから始める関数型設計と構成的なパーサ #fp_matsuri
raiga0310
2
190
鹿野さんに聞く!『TypeScriptコードレシピ集』で磨く実践力
tonkotsuboy_com
4
1.1k
継続モナドとリアクティブプログラミング
yukikurage
3
470
地域 SRE コミュニティ最前線 - ホンマでっかSRE勉強会
tk3fftk
0
220
【SRE NEXT 2026 Lunch Session】一人目専任SREの立ち上げを加速する ― AIと進めたオンボーディングで2分を0.04秒にした話
pkshadeck
PRO
0
2.2k
Honoでのサプライチェーン侵害対策 〜 3つのライブラリに学ぶ
yusukebe
7
1.8k
霧の中の代数的エフェクト
funnyycat
1
330
エンジニアと一緒にテストコードの設計と実装を改善した話
mototakatsu
0
260
1B+ /day規模のログを管理する技術
broadleaf
0
130
ビデオ通話が繋がる0.2秒で何が起きているのか
supurazako
2
110
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.8k
Designing Powerful Visuals for Engaging Learning
tmiket
1
450
The Curious Case for Waylosing
cassininazir
1
430
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
170
Into the Great Unknown - MozCon
thekraken
41
2.6k
Between Models and Reality
mayunak
4
370
Building Adaptive Systems
keathley
44
3.1k
The untapped power of vector embeddings
frankvandijk
2
1.8k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.4k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
180
Transcript
1 「defineCustomElement」を活⽤した サービス共通のUIコンポーネントライブラリ 尾形 将平 GMOペパボ株式会社 EC事業部 エンジニア 2023.10.28
2 ⾃⼰紹介 EC事業部 プロダクトチーム 尾形 将平 Shohei Ogata • ECプラットフォーム「カラーミーショップ」の 開発に従事
• Vue.js歴は概ね4年くらい • GitHub : @piyoppi
ECプラットフォーム「カラーミーショップ」 3 インターネットで商いを⽀援
「カラーミーショップ」とVue.js 4 アプリストア カラーミーショップとVue.js ショップ管理画⾯ 社内ツール などなど...
「カラーミーショップ」とVue.js 5 ショップ管理画⾯ • PHP + jQuery のMPA • ショップデザイン
/ 商品管理 / 発送 など... • 2021年〜からVue.js (Custom Element)を利⽤
「カラーミーショップ」とVue.js 6 ショップ管理画⾯とVue.js • 2021〜 Vue2系 + Vue CLI Web
Components Build ◦ https://tech.pepabo.com/2021/03/23/admin-ui-components/ • 2022〜 Vue3系 + defineCustomElement ◦ https://tech.pepabo.com/2022/10/31/colorme-vue3-migration/ • 2023〜 ペパボ共通デザインシステム「Inhouse」導⼊ ◦ https://note.com/colorme_design/n/n6e3499aa25d3
Custom Element変換層の導⼊による UIコンポーネントライブラリの開発 7
Custom Element変換層の導⼊によるUIコンポーネントライブラリの開発 8 ce-proxy ui-components .ts .css vue-application .js .ce.js
web-application <script src=”ce-proxy.js”> <c-button> ボタン </c-button> defineCustomElement()
9 custom-elements-proxy ui-components .ts .css vue-application .js .ce.js web-application <script
src=”ce-proxy.js”> <colorme-button> ボタン </colorme-button> defineCustomElement() • SFC(.vue)をそれぞれビルド • SFC毎に .ts & .css ファイルを公開 Custom Element変換層の導⼊によるUIコンポーネントライブラリの開発 c-button .vue c-radio .vue c-button .vue.ts c-button .css c-radio .vue.ts c-radio .css … …
ce-proxy vue-application .js .ce.js web-application <script src=”ce-proxy.js”> <colorme-button> ボタン </colorme-button>
defineCustomElement() 10 • ui-componentsが公開するSFCを利⽤ ◦ スタイルの読み込みはViteプラグインで⾃動化している Custom Element変換層の導⼊によるUIコンポーネントライブラリの開発 <template> <div> <c-button>ボタン</c-button> </div> </template> <script setup lang=”ts”> import CButton from “ui-components/c-button.vue” import “ui-components/c-button.css” </script>
ce-proxy vue-application .js .ce.js web-application <script src=”ce-proxy.js”> <colorme-button> ボタン </colorme-button>
defineCustomElement() 11 • defineCustomElement() を通して Custom Element化 • 属性値を Vue props にそのまま渡 せない場合の変換層としても機能 Custom Element変換層の導⼊によるUIコンポーネントライブラリの開発 ce-proxy ui-components JSON HTML </> component Object component
ce-proxy vue-application .js .ce.js web-application <script src=”ce-proxy.js”> <colorme-button> ボタン </colorme-button>
defineCustomElement() 12 • コンポーネント毎にJavaScriptを出⼒ • 必要なコンポーネントを検索して取得 するスクリプトを同梱 ◦ よく使うコンポーネントはスクリプトに同梱してネットワー クの往復による遅延を低減 Custom Element変換層の導⼊によるUIコンポーネントライブラリの開発 <script src=”ce-proxy.js”> <B>foo</B> <C>bar</C> ce-proxy.js C A.js A B.js B
13 • ce-proxyをロード • ui-components が公開するSFCを ce-proxyを介して利⽤できる web-application <script src=”ce-proxy.js”>
<c-button> ボタン </c-button> Custom Element変換層の導⼊によるUIコンポーネントライブラリの開発
14 • カラーミーショップではdefineCustomElement() を 活⽤しています • カスタム要素の変換層を作ることでより再利⽤性の ⾼いUIライブラリを作っています まとめ