@loafacto/ui 0.8.5 → 0.8.7

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.
@@ -13,6 +13,22 @@ type __VLS_Props = {
13
13
  themeToggle?: boolean;
14
14
  brandName?: string;
15
15
  brandHref?: string;
16
+ /**
17
+ * 사용자 메뉴의 「내 정보」가 가리키는 곳. 빈 문자열이면 항목을 내지 않는다.
18
+ *
19
+ * 기본값이 같은 오리진의 절대 경로인 것이 요점이다 — /macro 에서 눌러도 /agent 에서
20
+ * 눌러도 플랫폼의 같은 화면으로 간다. 다른 오리진에서 쓰는 서비스(아직 서브도메인인
21
+ * hub 등)는 전체 URL 을 넘긴다.
22
+ */
23
+ myPageHref?: string;
24
+ /**
25
+ * 「로그아웃」이 가리키는 곳. 빈 문자열이면 항목을 내지 않는다.
26
+ *
27
+ * 이벤트가 아니라 링크인 것은 **서비스마다 로그아웃을 구현하지 않게** 하기 위해서다.
28
+ * 세션을 발급하는 곳이 하나이므로 끊는 곳도 하나면 된다. 전체 페이지 이동이지만
29
+ * 어차피 나가는 길이고, 메모리에 남은 상태까지 확실히 비워진다.
30
+ */
31
+ logoutHref?: string;
16
32
  logoUrl?: string;
17
33
  user?: ShellUser | null;
18
34
  backgroundColor?: string;
@@ -48,6 +64,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
48
64
  themeToggle: boolean;
49
65
  brandName: string;
50
66
  brandHref: string;
67
+ myPageHref: string;
68
+ logoutHref: string;
51
69
  user: ShellUser | null;
52
70
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
53
71
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
package/dist/index.d.ts CHANGED
@@ -54,4 +54,5 @@ export { useConfirm } from './composables/useConfirm';
54
54
  export { applyTheme, DARK_THEME, LIGHT_THEME, DEFAULT_THEME, type ThemeConfig, } from './theme/applyTheme';
55
55
  export { initTheme, useTheme, type ThemeMode } from './theme/useTheme';
56
56
  export { deriveSemanticPalette, applySemanticPalette, isLightBackground, colorToRgb, hexToRgb, luminance, contrastRatio, type SemanticPalette, } from './theme/themeColors';
57
+ export { LOAFACTO_SERVICES, serviceIdForPath, isServicePath, } from './services';
57
58
  export type { ServiceDescriptor, ShellUser, ShortcutLink, LfOption, LfTableColumn, LfTableSort, } from './types';
package/dist/index.js CHANGED
@@ -2,6 +2,53 @@ import { readonly, ref, openBlock, createElementBlock, createStaticVNode, create
2
2
  import { a as applyTheme, D as DARK_THEME, L as LIGHT_THEME } from "./applyTheme-EBr0eOKY.js";
3
3
  import { b, c, d, e, f, h, i, l } from "./applyTheme-EBr0eOKY.js";
4
4
  import { defineStore } from "pinia";
5
+ const LOAFACTO_SERVICES = [
6
+ {
7
+ /**
8
+ * 매크로 — **여기 한 줄이 이 서비스의 첫인상 전부다.**
9
+ *
10
+ * 「반복 작업 자동화 매크로 편집·실행」이었던 때가 있다. 만드는 사람의 말이라 무엇이
11
+ * 좋아지는지는 안 나오고, 「편집·실행」은 어느 도구에나 붙는 말이다.
12
+ *
13
+ * 그리고 이 서비스에는 다른 서비스에 없는 전제가 있다 — **윈도우 PC 한 대가 켜져
14
+ * 있어야 한다.** 내 PC 에 러너를 깔아야 돌아가기 때문이다. 그걸 모르고 들어가면
15
+ * 로그인까지 마친 뒤에야 알게 되고, 그때는 빈 기기 화면을 보고 떠난다.
16
+ */
17
+ id: "macro",
18
+ name: "매크로",
19
+ path: "/macro",
20
+ description: "앱·게임·웹에서 매일 하는 조작을 정한 시각에 대신 눌러 줍니다. 윈도우 PC 한 대가 필요합니다.",
21
+ iconPath: "M13 2 3 14h7l-1 8 10-12h-7l1-8z",
22
+ requiresAuth: true
23
+ },
24
+ {
25
+ /**
26
+ * 에이전트 — 다른 서비스와 성격이 다르다. macro 는 loafacto.com 안에서 돌지만
27
+ * 에이전트의 런타임은 **고객의 팀 서버**에서 돈다(폐쇄망·로컬 LLM 이 전제다).
28
+ * 이 경로는 시연과 내려받기를 맡는다. 저장소는 loafacto-agent.
29
+ *
30
+ * 지금 올라가 있는 것은 「작업대 만들기」 흐름의 목업이다. 표시 없이 두면 사용자가
31
+ * 완성품으로 읽고 눌리지 않는 버튼을 버그로 신고한다.
32
+ */
33
+ id: "agent",
34
+ name: "에이전트",
35
+ path: "/agent",
36
+ description: "화면에서 고른 것만 에이전트에게 시키는 작업대",
37
+ badge: "목업",
38
+ iconPath: "M12 2a2 2 0 0 1 2 2v1h3a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V8a3 3 0 0 1 3-3h3V4a2 2 0 0 1 2-2zm-3 9a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3zm6 0a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3z",
39
+ requiresAuth: true
40
+ }
41
+ ];
42
+ function isUnder(pathname, servicePath) {
43
+ return pathname === servicePath || pathname.startsWith(`${servicePath}/`);
44
+ }
45
+ function serviceIdForPath(pathname, services = LOAFACTO_SERVICES) {
46
+ var _a;
47
+ return (_a = services.find((s) => isUnder(pathname, s.path))) == null ? void 0 : _a.id;
48
+ }
49
+ function isServicePath(pathname, services = LOAFACTO_SERVICES) {
50
+ return services.some((s) => isUnder(pathname, s.path));
51
+ }
5
52
  const STORAGE_KEY = "lf-theme";
6
53
  const OS_QUERY = "(prefers-color-scheme: light)";
7
54
  function readStored() {
@@ -172,37 +219,41 @@ const _hoisted_19 = {
172
219
  key: 0,
173
220
  class: "lf-user__email"
174
221
  };
175
- const _hoisted_20 = {
222
+ const _hoisted_20 = ["href"];
223
+ const _hoisted_21 = ["href"];
224
+ const _hoisted_22 = {
176
225
  key: 3,
177
226
  class: "lf-shortcuts",
178
227
  "aria-label": "바로가기"
179
228
  };
180
- const _hoisted_21 = ["href", "title", "aria-label"];
181
- const _hoisted_22 = {
229
+ const _hoisted_23 = ["href", "title", "aria-label"];
230
+ const _hoisted_24 = {
182
231
  viewBox: "0 0 24 24",
183
232
  "aria-hidden": "true"
184
233
  };
185
- const _hoisted_23 = ["d"];
186
- const _hoisted_24 = ["title", "aria-label"];
187
- const _hoisted_25 = {
234
+ const _hoisted_25 = ["d"];
235
+ const _hoisted_26 = ["title", "aria-label"];
236
+ const _hoisted_27 = {
188
237
  viewBox: "0 0 24 24",
189
238
  "aria-hidden": "true"
190
239
  };
191
- const _hoisted_26 = ["d"];
192
- const _hoisted_27 = { class: "lf-content" };
193
- const _hoisted_28 = { class: "site-footer" };
194
- const _hoisted_29 = { class: "site-footer-inner" };
240
+ const _hoisted_28 = ["d"];
241
+ const _hoisted_29 = { class: "lf-content" };
242
+ const _hoisted_30 = { class: "site-footer" };
243
+ const _hoisted_31 = { class: "site-footer-inner" };
195
244
  const ICON_SUN = "M12 7a5 5 0 1 0 0 10 5 5 0 0 0 0-10zm0-5v3h0V2zm0 17v3h0v-3zM2 11h3v2H2v-2zm17 0h3v2h-3v-2zM4.2 4.2l2.1 2.1L4.9 7.7 2.8 5.6l1.4-1.4zm13.5 13.5 2.1 2.1-1.4 1.4-2.1-2.1 1.4-1.4zM19.8 4.2l1.4 1.4-2.1 2.1-1.4-1.4 2.1-2.1zM6.3 17.7l1.4 1.4-2.1 2.1-1.4-1.4 2.1-2.1z";
196
245
  const ICON_MOON = "M12.3 3a7 7 0 1 0 8.7 8.7A9 9 0 1 1 12.3 3z";
197
246
  const _sfc_main$s = /* @__PURE__ */ defineComponent({
198
247
  __name: "AppShell",
199
248
  props: {
200
- services: { default: () => [] },
249
+ services: { default: () => LOAFACTO_SERVICES },
201
250
  currentServiceId: {},
202
251
  shortcuts: { default: () => [] },
203
252
  themeToggle: { type: Boolean, default: true },
204
253
  brandName: { default: "Loafacto" },
205
254
  brandHref: { default: "/" },
255
+ myPageHref: { default: "/me" },
256
+ logoutHref: { default: "/logout" },
206
257
  logoUrl: {},
207
258
  user: { default: null },
208
259
  backgroundColor: {},
@@ -385,10 +436,19 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
385
436
  onClick: _cache[3] || (_cache[3] = ($event) => userOpen.value = false)
386
437
  }, [
387
438
  __props.user.email ? (openBlock(), createElementBlock("p", _hoisted_19, toDisplayString(__props.user.email), 1)) : createCommentVNode("", true),
388
- renderSlot(_ctx.$slots, "user-menu", {}, void 0, true)
439
+ __props.myPageHref ? (openBlock(), createElementBlock("a", {
440
+ key: 1,
441
+ href: __props.myPageHref
442
+ }, "내 정보", 8, _hoisted_20)) : createCommentVNode("", true),
443
+ renderSlot(_ctx.$slots, "user-menu", {}, void 0, true),
444
+ __props.logoutHref ? (openBlock(), createElementBlock("a", {
445
+ key: 2,
446
+ class: "lf-user__logout",
447
+ href: __props.logoutHref
448
+ }, "로그아웃", 8, _hoisted_21)) : createCommentVNode("", true)
389
449
  ])) : createCommentVNode("", true)
390
450
  ], 512)) : renderSlot(_ctx.$slots, "auth-actions", {}, void 0, true, 2),
391
- __props.shortcuts.length ? (openBlock(), createElementBlock("nav", _hoisted_20, [
451
+ __props.shortcuts.length ? (openBlock(), createElementBlock("nav", _hoisted_22, [
392
452
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.shortcuts, (s) => {
393
453
  return openBlock(), createElementBlock("a", {
394
454
  key: s.id,
@@ -399,13 +459,13 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
399
459
  title: s.label,
400
460
  "aria-label": `${s.label} (새 탭에서 열림)`
401
461
  }, [
402
- (openBlock(), createElementBlock("svg", _hoisted_22, [
462
+ (openBlock(), createElementBlock("svg", _hoisted_24, [
403
463
  createElementVNode("path", {
404
464
  d: s.iconPath,
405
465
  fill: "currentColor"
406
- }, null, 8, _hoisted_23)
466
+ }, null, 8, _hoisted_25)
407
467
  ]))
408
- ], 8, _hoisted_21);
468
+ ], 8, _hoisted_23);
409
469
  }), 128))
410
470
  ])) : createCommentVNode("", true),
411
471
  __props.themeToggle ? (openBlock(), createElementBlock("button", {
@@ -417,21 +477,21 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
417
477
  onClick: _cache[4] || (_cache[4] = //@ts-ignore
418
478
  (...args) => unref(toggle) && unref(toggle)(...args))
419
479
  }, [
420
- (openBlock(), createElementBlock("svg", _hoisted_25, [
480
+ (openBlock(), createElementBlock("svg", _hoisted_27, [
421
481
  createElementVNode("path", {
422
482
  d: unref(mode2) === "dark" ? ICON_MOON : ICON_SUN,
423
483
  fill: "currentColor"
424
- }, null, 8, _hoisted_26)
484
+ }, null, 8, _hoisted_28)
425
485
  ]))
426
- ], 8, _hoisted_24)) : createCommentVNode("", true),
486
+ ], 8, _hoisted_26)) : createCommentVNode("", true),
427
487
  renderSlot(_ctx.$slots, "actions", {}, void 0, true)
428
488
  ])
429
489
  ]),
430
- createElementVNode("main", _hoisted_27, [
490
+ createElementVNode("main", _hoisted_29, [
431
491
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
432
492
  ]),
433
- createElementVNode("footer", _hoisted_28, [
434
- createElementVNode("div", _hoisted_29, [
493
+ createElementVNode("footer", _hoisted_30, [
494
+ createElementVNode("div", _hoisted_31, [
435
495
  renderSlot(_ctx.$slots, "footer", {}, () => [
436
496
  _cache[8] || (_cache[8] = createElementVNode("p", { class: "site-footer-copy" }, "© Loafacto. All rights reserved.", -1))
437
497
  ], true)
@@ -441,7 +501,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
441
501
  };
442
502
  }
443
503
  });
444
- const AppShell = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-dc328b6e"]]);
504
+ const AppShell = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-513c839a"]]);
445
505
  function generateId() {
446
506
  return `toast-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
447
507
  }
@@ -2661,6 +2721,7 @@ export {
2661
2721
  b as DEFAULT_THEME,
2662
2722
  LF_ICONS,
2663
2723
  LIGHT_THEME,
2724
+ LOAFACTO_SERVICES,
2664
2725
  LfAlert,
2665
2726
  LfAvatar,
2666
2727
  LfBadge,
@@ -2695,7 +2756,9 @@ export {
2695
2756
  h as hexToRgb,
2696
2757
  initTheme,
2697
2758
  i as isLightBackground,
2759
+ isServicePath,
2698
2760
  l as luminance,
2761
+ serviceIdForPath,
2699
2762
  useConfirm,
2700
2763
  useConfirmStore,
2701
2764
  useLoadingStore,