@uplatform/brand 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -26,7 +26,9 @@ import '@uplatform/brand' // registers <uplatform-affiliation> and <u-mark>
26
26
  | `theme` | `auto` (follows `prefers-color-scheme`) · `light` · `dark` | `auto` |
27
27
 
28
28
  Data only (no element): `import { products, umbrella, productHref } from '@uplatform/brand/products'`.
29
- `productHref` returns the product's own site, or `undefined` when it has none — render plain text then.
29
+ `productHref(product, lang?)` returns the product's own site, or `undefined` when it has none — render plain text then.
30
+ With `lang` `'en'` it returns the product's English page (`siteEn`) when the product has one, otherwise the same site — it never guesses an `/en/` path.
31
+ The affiliation element follows its `lang` attribute the same way.
30
32
  Mark files: `@uplatform/brand/marks/<id>.svg` and `<id>-reverse.svg` (for dark backgrounds).
31
33
 
32
34
  ## Marks that move — `<u-mark>`
@@ -1,6 +1,6 @@
1
1
  // <uplatform-affiliation> — U-Platform 소속 표시. 의존 0 · 네트워크 0 · 쿠키 0 · shadow DOM.
2
2
  // 제품 UI 안에 놓이지만 그 UI 와 스타일이 서로 새지 않는다. 호스트는 --uplatform-fg · --uplatform-bg 로 대비만 맞춘다.
3
- import { products, umbrella, HUB } from './products.js';
3
+ import { products, umbrella, HUB, productHref } from './products.js';
4
4
  import { MARKS } from './generated/marks.js';
5
5
  import { GROUND } from './ground.js';
6
6
  const TEXT = {
@@ -79,7 +79,7 @@ export class UplatformAffiliation extends HTMLElement {
79
79
  if (items.length === 0)
80
80
  return '';
81
81
  return `<div role="group" aria-labelledby="label-${family}"><p class="label" id="label-${family}">${esc(label)}</p><ul>${items
82
- .map(p => `<li><a href="${esc(p.site)}">${p.mark ? mark(p.id, theme) : ''}<span>${esc(p.name)}</span></a></li>`)
82
+ .map(p => `<li><a href="${esc(productHref(p, lang))}">${p.mark ? mark(p.id, theme) : ''}<span>${esc(p.name)}</span></a></li>`)
83
83
  .join('')}</ul></div>`;
84
84
  };
85
85
  this.#root.innerHTML = `<style>${STYLE}</style>
@@ -17,6 +17,7 @@
17
17
  "name": "U-CMMS",
18
18
  "family": "solutions",
19
19
  "site": "https://cmms.u-platform.kr",
20
+ "siteEn": "https://cmms.u-platform.kr/en/",
20
21
  "hue": 125,
21
22
  "color": {
22
23
  "light": "#556E1C",
@@ -77,7 +78,8 @@
77
78
  "id": "u-board",
78
79
  "name": "U-Board",
79
80
  "family": "cross",
80
- "site": "https://github.com/iyulab/U-Board",
81
+ "site": "https://board.u-platform.kr",
82
+ "siteEn": "https://board.u-platform.kr/en/",
81
83
  "hue": 170,
82
84
  "color": {
83
85
  "light": "#007759",
@@ -4,6 +4,8 @@ export interface Product {
4
4
  family: 'solutions' | 'system' | 'cross';
5
5
  /** 제품 자신의 공개 페이지. 없으면 링크하지 않는다(갈 곳이 없다). */
6
6
  site?: string;
7
+ /** 그 사이트의 영어 페이지 — 영어판이 실재할 때만 있다. 없으면 영어 화면도 `site` 로 간다. */
8
+ siteEn?: string;
7
9
  hue?: number;
8
10
  color?: {
9
11
  light: string;
@@ -26,5 +28,10 @@ export declare const umbrella: {
26
28
  dark: string;
27
29
  };
28
30
  };
29
- /** 갈 곳이 있으면 그 주소, 없으면 undefined — 쓰는 쪽은 링크 대신 글자만 둔다. */
30
- export declare function productHref(product: Product): string | undefined;
31
+ /** 화면 언어 — 영어(`en`)가 아니면 한국어. */
32
+ export type Lang = 'ko' | 'en';
33
+ /**
34
+ * 갈 곳이 있으면 그 주소, 없으면 undefined — 쓰는 쪽은 링크 대신 글자만 둔다.
35
+ * 영어 화면이면 그 제품의 영어 페이지(`siteEn`)가 있을 때 그리로, 없으면 기본 주소로(영어판 없는 사이트에 `/en/` 을 짐작해 붙이지 않는다).
36
+ */
37
+ export declare function productHref(product: Product, lang?: Lang): string | undefined;
package/dist/products.js CHANGED
@@ -2,7 +2,10 @@ import data from './generated/products.json' with { type: 'json' };
2
2
  export const HUB = 'https://u-platform.kr';
3
3
  export const products = data.products;
4
4
  export const umbrella = data.umbrella;
5
- /** 갈 곳이 있으면 그 주소, 없으면 undefined — 쓰는 쪽은 링크 대신 글자만 둔다. */
6
- export function productHref(product) {
7
- return product.site;
5
+ /**
6
+ * 갈 곳이 있으면 그 주소, 없으면 undefined — 쓰는 쪽은 링크 대신 글자만 둔다.
7
+ * 영어 화면이면 그 제품의 영어 페이지(`siteEn`)가 있을 때 그리로, 없으면 기본 주소로(영어판 없는 사이트에 `/en/` 을 짐작해 붙이지 않는다).
8
+ */
9
+ export function productHref(product, lang = 'ko') {
10
+ return (lang === 'en' && product.siteEn) || product.site;
8
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uplatform/brand",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "U-Platform affiliation kit — product list, marks, the <uplatform-affiliation> and <u-mark> elements, mark renders and patterns.",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",