@kong-ui-public/entities-shared 3.59.0 → 3.59.2-pr.3642.c9df003fa.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
@@ -9,6 +9,7 @@ Shared components for Kong entities.
9
9
  - [Usage](#usage)
10
10
  - [Install](#install)
11
11
  - [Registration](#registration)
12
+ - [Color mode (light/dark theme)](#color-mode-lightdark-theme)
12
13
  - [Individual component documentation](#individual-component-documentation)
13
14
  - [Individual composables documentation](#individual-composables-documentation)
14
15
  - [Sandbox shared utilities](#sandbox-shared-utilities)
@@ -69,6 +70,20 @@ import { EntityDeleteModal, EntityBaseTable } from '@kong-ui-public/entities-sha
69
70
  import '@kong-ui-public/entities-shared/dist/style.css'
70
71
  ```
71
72
 
73
+ ### Color mode (light/dark theme)
74
+
75
+ Components in this package that embed a Monaco-based editor (for example `DeckCommandEditor`) automatically match the host application's active color mode. To enable this, the host application should `provide` a `ComputedRef<'light' | 'dark'>` under the `app:konnectColorMode` injection key. When provided, the editors reactively switch between their light and dark themes as the value changes. When the key is not provided, the editors fall back to the `'light'` theme.
76
+
77
+ ```ts
78
+ // In the host application (e.g. within your root component's setup)
79
+ import { computed, provide } from 'vue'
80
+
81
+ // `isDarkMode` is however your app tracks its current theme
82
+ const colorMode = computed<'light' | 'dark'>(() => (isDarkMode.value ? 'dark' : 'light'))
83
+
84
+ provide('app:konnectColorMode', colorMode)
85
+ ```
86
+
72
87
  ## Individual component documentation
73
88
 
74
89
  - [`<EntityDeleteModal.vue />`](docs/entity-delete-modal.md)
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("./_plugin-vue_export-helper-C-LN_xos.cjs"),m=require("@kong-ui-public/monaco-editor"),p=require("@kong/icons"),k=require("@kong/kongponents");require("@kong-ui-public/monaco-editor/dist/runtime/style.css");const y={class:"deck-command-editor-wrapper"},_={class:"deck-command-copy-button"},f=e.defineComponent({__name:"DeckCommandEditor",props:e.mergeModels({language:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const n=e.useModel(r,"modelValue"),{i18n:{t:c}}=a.composables.useI18n(),d={scrollbar:{alwaysConsumeMouseWheel:!1},autoIndent:"keep",editContext:!1};async function s(){await u(n.value)}async function u(l){if(navigator.clipboard)try{return await navigator.clipboard.writeText(l),!0}catch{}const o=document?.createElement("textarea");o&&(o.style.position="fixed",o.style.top="0",o.style.left="0",o.style.width="32px",o.style.height="32px",o.style.padding="0",o.style.border="none",o.style.outline="none",o.style.boxShadow="none",o.style.background="transparent",o.value=l,document?.body?.appendChild(o),o.focus(),o.select());let t;try{t=document?.execCommand("copy")}catch{t=!1}finally{document?.body?.removeChild(o)}return t}return(l,o)=>(e.openBlock(),e.createElementBlock("div",y,[e.createVNode(e.unref(m.MonacoEditor),{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=t=>n.value=t),appearance:"standalone",class:"deck-command-editor",language:r.language,options:d,theme:"light"},null,8,["modelValue","language"]),e.createElementVNode("div",_,[e.createVNode(e.unref(k.KCodeBlockIconButton),{"aria-label":e.unref(c)("deckCodeBlock.copy_tooltip"),"copy-tooltip":e.unref(c)("deckCodeBlock.copy_tooltip"),theme:"light",onClick:o[1]||(o[1]=t=>s())},{default:e.withCtx(()=>[e.createVNode(e.unref(p.CopyIcon),{decorative:""})]),_:1},8,["aria-label","copy-tooltip"])])]))}}),i=a._export_sfc(f,[["__scopeId","data-v-55ffc70c"]]),C={},g={class:"editor-skeleton"};function v(r,n){const c=e.resolveComponent("KSkeleton");return e.openBlock(),e.createElementBlock("div",g,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(5,d=>e.createVNode(c,{key:d})),64))])}const b=a._export_sfc(C,[["render",v],["__scopeId","data-v-ec59bbd1"]]);function E(){e.provide(a.DECK_COMMAND_EDITOR_KEY,i)}exports.DeckCommandEditor=i;exports.DeckCommandEditorLoading=b;exports.provideDeckCommandEditor=E;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("./_plugin-vue_export-helper-C-LN_xos.cjs"),p=require("@kong-ui-public/monaco-editor"),k=require("@kong/icons"),y=require("@kong/kongponents");require("@kong-ui-public/monaco-editor/dist/runtime/style.css");const _={class:"deck-command-editor-wrapper"},f={class:"deck-command-copy-button"},C=e.defineComponent({__name:"DeckCommandEditor",props:e.mergeModels({language:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const d=e.inject("app:konnectColorMode",e.computed(()=>"light")),n=e.useModel(r,"modelValue"),{i18n:{t:c}}=a.composables.useI18n(),s={scrollbar:{alwaysConsumeMouseWheel:!1},autoIndent:"keep",editContext:!1};async function u(){await m(n.value)}async function m(l){if(navigator.clipboard)try{return await navigator.clipboard.writeText(l),!0}catch{}const o=document?.createElement("textarea");o&&(o.style.position="fixed",o.style.top="0",o.style.left="0",o.style.width="32px",o.style.height="32px",o.style.padding="0",o.style.border="none",o.style.outline="none",o.style.boxShadow="none",o.style.background="transparent",o.value=l,document?.body?.appendChild(o),o.focus(),o.select());let t;try{t=document?.execCommand("copy")}catch{t=!1}finally{document?.body?.removeChild(o)}return t}return(l,o)=>(e.openBlock(),e.createElementBlock("div",_,[(e.openBlock(),e.createBlock(e.unref(p.MonacoEditor),{key:e.unref(d),modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=t=>n.value=t),appearance:"standalone",class:"deck-command-editor",language:r.language,options:s,theme:e.unref(d)},null,8,["modelValue","language","theme"])),e.createElementVNode("div",f,[e.createVNode(e.unref(y.KCodeBlockIconButton),{"aria-label":e.unref(c)("deckCodeBlock.copy_tooltip"),"copy-tooltip":e.unref(c)("deckCodeBlock.copy_tooltip"),theme:"light",onClick:o[1]||(o[1]=t=>u())},{default:e.withCtx(()=>[e.createVNode(e.unref(k.CopyIcon),{decorative:""})]),_:1},8,["aria-label","copy-tooltip"])])]))}}),i=a._export_sfc(C,[["__scopeId","data-v-2da602e1"]]),g={},v={class:"editor-skeleton"};function b(r,d){const n=e.resolveComponent("KSkeleton");return e.openBlock(),e.createElementBlock("div",v,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(5,c=>e.createVNode(n,{key:c})),64))])}const E=a._export_sfc(g,[["render",b],["__scopeId","data-v-ec59bbd1"]]);function h(){e.provide(a.DECK_COMMAND_EDITOR_KEY,i)}exports.DeckCommandEditor=i;exports.DeckCommandEditorLoading=E;exports.provideDeckCommandEditor=h;
@@ -1,12 +1,12 @@
1
- import { defineComponent as f, useModel as y, openBlock as s, createElementBlock as i, createVNode as c, unref as t, createElementVNode as _, withCtx as k, mergeModels as C, resolveComponent as g, Fragment as v, renderList as b, provide as h } from "vue";
2
- import { c as x, _ as m, D as E } from "./_plugin-vue_export-helper-Fi4wf1FB.js";
3
- import { MonacoEditor as D } from "@kong-ui-public/monaco-editor";
4
- import { CopyIcon as w } from "@kong/icons";
5
- import { KCodeBlockIconButton as V } from "@kong/kongponents";
1
+ import { defineComponent as _, inject as f, computed as k, useModel as C, openBlock as c, createElementBlock as i, createBlock as g, unref as o, createElementVNode as v, createVNode as s, withCtx as h, mergeModels as b, resolveComponent as x, Fragment as E, renderList as D, provide as M } from "vue";
2
+ import { c as w, _ as m, D as V } from "./_plugin-vue_export-helper-Fi4wf1FB.js";
3
+ import { MonacoEditor as B } from "@kong-ui-public/monaco-editor";
4
+ import { CopyIcon as I } from "@kong/icons";
5
+ import { KCodeBlockIconButton as K } from "@kong/kongponents";
6
6
  import "@kong-ui-public/monaco-editor/dist/runtime/style.css";
7
- const I = { class: "deck-command-editor-wrapper" }, M = { class: "deck-command-copy-button" }, B = /* @__PURE__ */ f({
7
+ const S = { class: "deck-command-editor-wrapper" }, T = { class: "deck-command-copy-button" }, N = /* @__PURE__ */ _({
8
8
  __name: "DeckCommandEditor",
9
- props: /* @__PURE__ */ C({
9
+ props: /* @__PURE__ */ b({
10
10
  language: {}
11
11
  }, {
12
12
  modelValue: { required: !0 },
@@ -14,17 +14,17 @@ const I = { class: "deck-command-editor-wrapper" }, M = { class: "deck-command-c
14
14
  }),
15
15
  emits: ["update:modelValue"],
16
16
  setup(l) {
17
- const n = y(l, "modelValue"), { i18n: { t: a } } = x.useI18n(), d = {
17
+ const d = f("app:konnectColorMode", k(() => "light")), n = C(l, "modelValue"), { i18n: { t: a } } = w.useI18n(), p = {
18
18
  scrollbar: {
19
19
  alwaysConsumeMouseWheel: !1
20
20
  },
21
21
  autoIndent: "keep",
22
22
  editContext: !1
23
23
  };
24
- async function p() {
25
- await u(n.value);
24
+ async function u() {
25
+ await y(n.value);
26
26
  }
27
- async function u(r) {
27
+ async function y(r) {
28
28
  if (navigator.clipboard)
29
29
  try {
30
30
  return await navigator.clipboard.writeText(r), !0;
@@ -32,54 +32,55 @@ const I = { class: "deck-command-editor-wrapper" }, M = { class: "deck-command-c
32
32
  }
33
33
  const e = document?.createElement("textarea");
34
34
  e && (e.style.position = "fixed", e.style.top = "0", e.style.left = "0", e.style.width = "32px", e.style.height = "32px", e.style.padding = "0", e.style.border = "none", e.style.outline = "none", e.style.boxShadow = "none", e.style.background = "transparent", e.value = r, document?.body?.appendChild(e), e.focus(), e.select());
35
- let o;
35
+ let t;
36
36
  try {
37
- o = document?.execCommand("copy");
37
+ t = document?.execCommand("copy");
38
38
  } catch {
39
- o = !1;
39
+ t = !1;
40
40
  } finally {
41
41
  document?.body?.removeChild(e);
42
42
  }
43
- return o;
43
+ return t;
44
44
  }
45
- return (r, e) => (s(), i("div", I, [
46
- c(t(D), {
45
+ return (r, e) => (c(), i("div", S, [
46
+ (c(), g(o(B), {
47
+ key: o(d),
47
48
  modelValue: n.value,
48
- "onUpdate:modelValue": e[0] || (e[0] = (o) => n.value = o),
49
+ "onUpdate:modelValue": e[0] || (e[0] = (t) => n.value = t),
49
50
  appearance: "standalone",
50
51
  class: "deck-command-editor",
51
52
  language: l.language,
52
- options: d,
53
- theme: "light"
54
- }, null, 8, ["modelValue", "language"]),
55
- _("div", M, [
56
- c(t(V), {
57
- "aria-label": t(a)("deckCodeBlock.copy_tooltip"),
58
- "copy-tooltip": t(a)("deckCodeBlock.copy_tooltip"),
53
+ options: p,
54
+ theme: o(d)
55
+ }, null, 8, ["modelValue", "language", "theme"])),
56
+ v("div", T, [
57
+ s(o(K), {
58
+ "aria-label": o(a)("deckCodeBlock.copy_tooltip"),
59
+ "copy-tooltip": o(a)("deckCodeBlock.copy_tooltip"),
59
60
  theme: "light",
60
- onClick: e[1] || (e[1] = (o) => p())
61
+ onClick: e[1] || (e[1] = (t) => u())
61
62
  }, {
62
- default: k(() => [
63
- c(t(w), { decorative: "" })
63
+ default: h(() => [
64
+ s(o(I), { decorative: "" })
64
65
  ]),
65
66
  _: 1
66
67
  }, 8, ["aria-label", "copy-tooltip"])
67
68
  ])
68
69
  ]));
69
70
  }
70
- }), K = /* @__PURE__ */ m(B, [["__scopeId", "data-v-55ffc70c"]]), S = {}, T = { class: "editor-skeleton" };
71
- function N(l, n) {
72
- const a = g("KSkeleton");
73
- return s(), i("div", T, [
74
- (s(), i(v, null, b(5, (d) => c(a, { key: d })), 64))
71
+ }), O = /* @__PURE__ */ m(N, [["__scopeId", "data-v-2da602e1"]]), $ = {}, A = { class: "editor-skeleton" };
72
+ function L(l, d) {
73
+ const n = x("KSkeleton");
74
+ return c(), i("div", A, [
75
+ (c(), i(E, null, D(5, (a) => s(n, { key: a })), 64))
75
76
  ]);
76
77
  }
77
- const R = /* @__PURE__ */ m(S, [["render", N], ["__scopeId", "data-v-ec59bbd1"]]);
78
- function U() {
79
- h(E, K);
78
+ const Y = /* @__PURE__ */ m($, [["render", L], ["__scopeId", "data-v-ec59bbd1"]]);
79
+ function z() {
80
+ M(V, O);
80
81
  }
81
82
  export {
82
- K as DeckCommandEditor,
83
- R as DeckCommandEditorLoading,
84
- U as provideDeckCommandEditor
83
+ O as DeckCommandEditor,
84
+ Y as DeckCommandEditorLoading,
85
+ z as provideDeckCommandEditor
85
86
  };