diff --git a/README.md b/README.md index 01497344..84ee0957 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,12 @@ # PATCH MAP English | [ν•œκ΅­μ–΄](./README_KR.md) -PATCH MAP is an optimized canvas library built on pixijs and pixi-viewport, tailored to meet the requirements of PATCH services. -It enables flexible and fast creation of 2D content. +PATCH MAP is an optimized canvas library built on pixi.js and pixi-viewport, tailored to meet the requirements of PATCH services. +
+Therefore, to use this, an understanding of the following two libraries is essential. -- **[PixiJS](https://github.com/pixijs/pixijs)** -- **[Pixi-Viewport](https://github.com/pixi-viewport/pixi-viewport)** +- **[pixi.js](https://github.com/pixijs/pixijs)** +- **[pixi-viewport](https://github.com/pixi-viewport/pixi-viewport)**
@@ -45,52 +46,56 @@ It enables flexible and fast creation of 2D content. ## πŸš€ Getting Started ### Install -Install `@conalog/patch-map` using npm: +#### NPM ```sh npm install @conalog/patch-map ``` +#### CDN +```html + + +``` + ### Usage -Here's a quick example to get you started: +Here's a quick example to get you started: [Example](https://codesandbox.io/p/sandbox/yvjrpx) ```js -(async () => { - import { Patchmap } from '@conalog/patch-map'; - - const data = [ - { - type: 'group', - id: 'group-id-1', - label: 'group-label-1', - items: [{ - type: 'grid', - id: 'grid-1', - label: 'grid-label-1', - cells: [ [1, 0, 1], [1, 1, 1] ], - position: { x: 0, y: 0 }, - itemSize: { width: 40, height: 80 }, - components: [ - { - type: 'background', - texture: { - type: 'rect', - fill: 'white', - borderWidth: 2, - borderColor: 'primary.dark', - radius: 4, - }, +import { Patchmap } from '@conalog/patch-map'; + +const data = [ + { + type: 'group', + id: 'group-id-1', + label: 'group-label-1', + items: [{ + type: 'grid', + id: 'grid-1', + label: 'grid-label-1', + cells: [ [1, 0, 1], [1, 1, 1] ], + position: { x: 0, y: 0 }, + itemSize: { width: 40, height: 80 }, + components: [ + { + type: 'background', + texture: { + type: 'rect', + fill: 'white', + borderWidth: 2, + borderColor: 'primary.dark', + radius: 4, } - { type: 'icon', asset: 'loading', size: 16 } - ] - }] - } - ]; + }, + { type: 'icon', asset: 'loading', size: 16 } + ] + }] + } +]; - const patchmap = new Patchmap(); +const patchmap = new Patchmap(); - await patchmap.init(document.body); - - patchmap.draw(data); -})() +await patchmap.init(document.body); + +patchmap.draw(data); ```
@@ -116,7 +121,7 @@ await patchmap.init(el, { Customize the rendering behavior using the following options: - `app` - - `PixiJS Application options` ([Docs](https://pixijs.download/release/docs/app.ApplicationOptions.html)) + - `pixi.js Application options` ([Docs](https://pixijs.download/release/docs/app.ApplicationOptions.html)) Default: ```js @@ -129,7 +134,7 @@ Customize the rendering behavior using the following options: ``` - `viewport` - - `Viewport options` ([Docs](https://pixi-viewport.github.io/pixi-viewport/jsdoc/Viewport.html#Viewport)) + - `Viewport options` ([Docs](https://viewport.pixijs.io/jsdoc/Viewport.html)) - `plugins` - Plugins to enhance or modify the viewport's behavior. You can add new plugins or disable default ones. Default: @@ -196,8 +201,8 @@ const data = [ borderWidth: 2, borderColor: 'primary.dark', radius: 4, - }, - } + } + }, { type: 'icon', asset: 'loading', size: 16 } ] }] @@ -331,7 +336,7 @@ patchmap.viewport.plugin.remove('mouse-edges');
### `asset` -- Refer to [pixiJS Assets](https://pixijs.download/release/docs/assets.Assets.html) for information about assets. +- Refer to [pixi.js Assets](https://pixijs.download/release/docs/assets.Assets.html) for information about assets.
diff --git a/README_KR.md b/README_KR.md index b5fc4efb..a7c6a2f2 100644 --- a/README_KR.md +++ b/README_KR.md @@ -1,11 +1,12 @@ # PATCH MAP [English](./README.md) | ν•œκ΅­μ–΄ -PATCH MAP은 PATCH μ„œλΉ„μŠ€μ˜ μš”κ΅¬ 사항을 μΆ©μ‘±μ‹œν‚€κΈ° μœ„ν•΄ `pixijs`와 `pixi-viewport`λ₯Ό 기반으둜 μ΅œμ ν™”λœ μΊ”λ²„μŠ€ λΌμ΄λΈŒλŸ¬λ¦¬μž…λ‹ˆλ‹€. -μœ μ—°ν•˜κ³  λΉ λ₯Έ 2D μ½˜ν…μΈ  생성을 κ°€λŠ₯ν•˜κ²Œ ν•©λ‹ˆλ‹€. +PATCH MAP은 PATCH μ„œλΉ„μŠ€μ˜ μš”κ΅¬ 사항을 μΆ©μ‘±μ‹œν‚€κΈ° μœ„ν•΄ `pixi.js`와 `pixi-viewport`λ₯Ό 기반으둜 μ΅œμ ν™”λœ μΊ”λ²„μŠ€ λΌμ΄λΈŒλŸ¬λ¦¬μž…λ‹ˆλ‹€. +
+λ”°λΌμ„œ 이λ₯Ό μ‚¬μš©ν•˜κΈ° μœ„ν•΄μ„œλŠ” μ•„λž˜ 두 λΌμ΄λΈŒλŸ¬λ¦¬μ— λŒ€ν•œ 이해가 ν•„μˆ˜μ μž…λ‹ˆλ‹€. -- **[PixiJS](https://github.com/pixijs/pixijs)** -- **[Pixi-Viewport](https://github.com/pixi-viewport/pixi-viewport)** +- **[pixi.js](https://github.com/pixijs/pixijs)** +- **[pixi-viewport](https://github.com/pixi-viewport/pixi-viewport)**
@@ -45,52 +46,56 @@ PATCH MAP은 PATCH μ„œλΉ„μŠ€μ˜ μš”κ΅¬ 사항을 μΆ©μ‘±μ‹œν‚€κΈ° μœ„ν•΄ `pixijs` ## πŸš€ μ‹œμž‘ν•˜κΈ° ### μ„€μΉ˜ -npm을 μ΄μš©ν•œ `@conalog/patch-map` μ„€μΉ˜: +#### NPM ```sh npm install @conalog/patch-map ``` +#### CDN +```html + + +``` + ### κΈ°λ³Έ 예제 -μ‹œμž‘ν•˜λŠ” 데 도움이 λ˜λŠ” κ°„λ‹¨ν•œ μ˜ˆμ œμž…λ‹ˆλ‹€: +μ‹œμž‘ν•˜λŠ” 데 도움이 λ˜λŠ” κ°„λ‹¨ν•œ μ˜ˆμ œμž…λ‹ˆλ‹€: [예제](https://codesandbox.io/p/sandbox/yvjrpx) ```js -(async () => { - import { Patchmap } from '@conalog/patch-map'; - - const data = [ - { - type: 'group', - id: 'group-id-1', - label: 'group-label-1', - items: [{ - type: 'grid', - id: 'grid-1', - label: 'grid-label-1', - cells: [ [1, 0, 1], [1, 1, 1] ], - position: { x: 0, y: 0 }, - itemSize: { width: 40, height: 80 }, - components: [ - { - type: 'background', - texture: { - type: 'rect', - fill: 'white', - borderWidth: 2, - borderColor: 'primary.dark', - radius: 4, - }, +import { Patchmap } from '@conalog/patch-map'; + +const data = [ + { + type: 'group', + id: 'group-id-1', + label: 'group-label-1', + items: [{ + type: 'grid', + id: 'grid-1', + label: 'grid-label-1', + cells: [ [1, 0, 1], [1, 1, 1] ], + position: { x: 0, y: 0 }, + itemSize: { width: 40, height: 80 }, + components: [ + { + type: 'background', + texture: { + type: 'rect', + fill: 'white', + borderWidth: 2, + borderColor: 'primary.dark', + radius: 4, } - { type: 'icon', asset: 'loading', size: 16 } - ] - }] - } - ]; + }, + { type: 'icon', asset: 'loading', size: 16 } + ] + }] + } +]; - const patchmap = new Patchmap(); +const patchmap = new Patchmap(); - await patchmap.init(document.body); - - patchmap.draw(data); -})() +await patchmap.init(document.body); + +patchmap.draw(data); ```
@@ -117,7 +122,7 @@ await patchmap.init(el, { λ Œλ”λ§ λ™μž‘μ„ μ‚¬μš©μž μ •μ˜ν•˜λ €λ©΄ λ‹€μŒ μ˜΅μ…˜μ„ μ‚¬μš©ν•˜μ„Έμš”: - `app` - - `PixiJS Application options` ([Docs](https://pixijs.download/release/docs/app.ApplicationOptions.html)) + - `pixi.js Application options` ([Docs](https://pixijs.download/release/docs/app.ApplicationOptions.html)) Default: ```js @@ -130,7 +135,7 @@ await patchmap.init(el, { ``` - `viewport` - - `Viewport options` ([Docs](https://pixi-viewport.github.io/pixi-viewport/jsdoc/Viewport.html#Viewport)) + - `Viewport options` ([Docs](https://viewport.pixijs.io/jsdoc/Viewport.html)) - `plugins` - Viewport의 λ™μž‘μ„ ν–₯μƒμ‹œν‚€κ±°λ‚˜ μˆ˜μ •ν•˜λŠ” ν”ŒλŸ¬κ·ΈμΈμž…λ‹ˆλ‹€. μƒˆλ‘œμš΄ ν”ŒλŸ¬κ·ΈμΈμ„ μΆ”κ°€ν•˜κ±°λ‚˜ κΈ°λ³Έ ν”ŒλŸ¬κ·ΈμΈμ„ λΉ„ν™œμ„±ν™”ν•  수 μžˆμŠ΅λ‹ˆλ‹€. Default: @@ -196,8 +201,8 @@ const data = [ borderWidth: 2, borderColor: 'primary.dark', radius: 4, - }, - } + } + }, { type: 'icon', texture: 'loading', size: 16 } ] }] @@ -331,7 +336,7 @@ patchmap.viewport.plugin.remove('mouse-edges'); ### `asset` -- asset에 λŒ€ν•œ λ‚΄μš©μ€ [pixiJS Assets](https://pixijs.download/release/docs/assets.Assets.html)λ₯Ό μ°Έμ‘°ν•˜μ„Έμš”. +- asset에 λŒ€ν•œ λ‚΄μš©μ€ [pixi.js Assets](https://pixijs.download/release/docs/assets.Assets.html)λ₯Ό μ°Έμ‘°ν•˜μ„Έμš”.
diff --git a/package.json b/package.json index 19bd8709..0abae1f5 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "type": "module", "name": "@conalog/patch-map", "version": "0.1.9", - "description": "λ³Έ λΌμ΄λΈŒλŸ¬λ¦¬λŠ” `pixijs` 라이브러리λ₯Ό μ΄μš©ν•˜μ—¬ PATCH μ„œλΉ„μŠ€μ˜ μš”κ΅¬μ‚¬ν•­μ— λ§žλŠ” PATCH MAP을 μ œκ³΅ν•˜κ³ μž 함", + "description": "This library utilizes pixi.js to provide a PATCH MAP tailored to the requirements of the PATCH service.", "license": "MIT", "author": "Conalog", "keywords": [], diff --git a/src/display/data-schema/data.d.ts b/src/display/data-schema/data.d.ts index ae2e16ce..d8cf7498 100644 --- a/src/display/data-schema/data.d.ts +++ b/src/display/data-schema/data.d.ts @@ -93,7 +93,7 @@ export type components = export interface BackgroundComponent extends BaseObject { type: 'background'; show?: boolean; // default: true - texture: string | TextureStyle; + texture: TextureStyle; } /** @@ -102,10 +102,10 @@ export interface BackgroundComponent extends BaseObject { export interface BarComponent extends BaseObject { type: 'bar'; show?: boolean; // default: true - texture: string | TextureStyle; + texture: TextureStyle; placement?: Placement; // default: 'bottom' - margin?: string; // default: '0' + margin?: string; // default: '0', ('4 2', '2 1 3 4') percentWidth?: number; // default: 1 (0~1) percentHeight?: number; // default: 1 (0~1) animation?: boolean; // default: true @@ -118,10 +118,10 @@ export interface BarComponent extends BaseObject { export interface IconComponent extends BaseObject { type: 'icon'; show?: boolean; // default: true - asset: string; + asset: string; // object, inverter, combiner, edge, device, loading, warning, wifi, etc. placement?: Placement; // default: 'center' - margin?: string; // default: '0' + margin?: string; // default: '0', ('4 2', '2 1 3 4') size: number; // 0 or higher } @@ -133,7 +133,7 @@ export interface TextComponent extends BaseObject { show?: boolean; // default: true placement?: Placement; // default: 'center' - margin?: string; // default: '0' + margin?: string; // default: '0', ('4 2', '2 1 3 4') text?: string; // default: '' style?: Record; split?: number; // default: 0