v-sistec-features 1.17.0 → 1.17.2

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,10 @@ export declare function useIframeCommunicator(onMessageReceived?: (event: Messag
13
13
  * Um composable "tudo-em-um" que configura a comunicação de temas com a janela pai.
14
14
  * para usar, bastar importar e chamar useTheme() na raiz do component app do iframe
15
15
  */
16
- export declare function useTheme(): void;
16
+ export declare function useTheme(): {
17
+ theme: Readonly<Ref<string, string>>;
18
+ themePalette: Readonly<Ref<string, string>>;
19
+ themePrimary: Readonly<Ref<string, string>>;
20
+ };
17
21
 
18
22
  export { }
@@ -1,4 +1,4 @@
1
- import { u as m, a as o } from "./useThemeFromParent-iwlNh_Mm.js";
1
+ import { u as m, a as o } from "./useThemeFromParent-D38ZZSdw.js";
2
2
  export {
3
3
  m as useIframeCommunicator,
4
4
  o as useTheme
package/dist/index.d.ts CHANGED
@@ -18,7 +18,11 @@ export declare function useIframeCommunicator(onMessageReceived?: (event: Messag
18
18
  * Um composable "tudo-em-um" que configura a comunicação de temas com a janela pai.
19
19
  * para usar, bastar importar e chamar useTheme() na raiz do component app do iframe
20
20
  */
21
- export declare function useTheme(): void;
21
+ export declare function useTheme(): {
22
+ theme: Readonly<Ref<string, string>>;
23
+ themePalette: Readonly<Ref<string, string>>;
24
+ themePrimary: Readonly<Ref<string, string>>;
25
+ };
22
26
 
23
27
 
24
28
  export * from "@tabler/icons-vue";
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { S as r } from "./plugin-C0f4EPnK.js";
2
- import { u as a, a as s } from "./useThemeFromParent-iwlNh_Mm.js";
2
+ import { u as a, a as s } from "./useThemeFromParent-D38ZZSdw.js";
3
3
  export * from "@tabler/icons-vue";
4
4
  export {
5
5
  r as SistecPlugin,
@@ -0,0 +1,35 @@
1
+ import { ref as s, onMounted as u, onUnmounted as h, readonly as m, provide as o } from "vue";
2
+ function c(t) {
3
+ const a = s(window.parent !== window);
4
+ function n(r, i = "*") {
5
+ a.value && window.parent.postMessage(r, i);
6
+ }
7
+ return u(() => {
8
+ t && window.addEventListener("message", t);
9
+ }), h(() => {
10
+ t && window.removeEventListener("message", t);
11
+ }), {
12
+ isInIframe: m(a),
13
+ // readonly para evitar modificação externa
14
+ sendMessage: n
15
+ };
16
+ }
17
+ function l() {
18
+ const t = s("light"), a = s("slate"), n = s("");
19
+ function r(d) {
20
+ const e = d.data;
21
+ e && (e.type === "setTheme" && (document.documentElement.setAttribute("data-bs-theme", e.theme), t.value = e.theme), e.type === "setThemePrimary" && (document.documentElement.setAttribute("data-bs-theme-primary", e.themePrimary), n.value = e.themePrimary), e.type === "setThemeBase" && (document.documentElement.setAttribute("data-bs-theme-base", e.themeBase), a.value = e.themeBase), e.type === "reload" && location.reload());
22
+ }
23
+ const { sendMessage: i } = c(r);
24
+ return u(() => {
25
+ i({ type: "iframeReady" });
26
+ }), o("theme-v-sistec", m(t)), o("theme-palette-v-sistec", m(a)), o("theme-primary-v-sistec", m(n)), {
27
+ theme: m(t),
28
+ themePalette: m(a),
29
+ themePrimary: m(n)
30
+ };
31
+ }
32
+ export {
33
+ l as a,
34
+ c as u
35
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "v-sistec-features",
3
3
  "private": false,
4
- "version": "1.17.0",
4
+ "version": "1.17.2",
5
5
  "author": "Márlon Bento Azevedo (https://github.com/marlon-bento)",
6
6
  "repository": {
7
7
  "type": "git",
@@ -1,5 +1,5 @@
1
1
  import { useIframeCommunicator } from './useIframeCommunicator';
2
- import { onMounted, ref } from 'vue';
2
+ import { onMounted, ref, readonly, provide } from 'vue';
3
3
 
4
4
 
5
5
  /**
@@ -45,4 +45,12 @@ export function useTheme() {
45
45
  onMounted(() => {
46
46
  sendMessage({ type: 'iframeReady' });
47
47
  });
48
+ provide('theme-v-sistec', readonly(theme));
49
+ provide('theme-palette-v-sistec', readonly(themePalette));
50
+ provide('theme-primary-v-sistec', readonly(themePrimary));
51
+ return {
52
+ theme: readonly(theme),
53
+ themePalette: readonly(themePalette),
54
+ themePrimary: readonly(themePrimary)
55
+ };
48
56
  }
@@ -1,31 +0,0 @@
1
- import { ref as a, onMounted as r, onUnmounted as u, readonly as d } from "vue";
2
- function h(t) {
3
- const n = a(window.parent !== window);
4
- function m(s, o = "*") {
5
- n.value && window.parent.postMessage(s, o);
6
- }
7
- return r(() => {
8
- t && window.addEventListener("message", t);
9
- }), u(() => {
10
- t && window.removeEventListener("message", t);
11
- }), {
12
- isInIframe: d(n),
13
- // readonly para evitar modificação externa
14
- sendMessage: m
15
- };
16
- }
17
- function c() {
18
- const t = a("light"), n = a("slate"), m = a("");
19
- function s(i) {
20
- const e = i.data;
21
- e && (e.type === "setTheme" && (document.documentElement.setAttribute("data-bs-theme", e.theme), t.value = e.theme), e.type === "setThemePrimary" && (document.documentElement.setAttribute("data-bs-theme-primary", e.themePrimary), m.value = e.themePrimary), e.type === "setThemeBase" && (document.documentElement.setAttribute("data-bs-theme-base", e.themeBase), n.value = e.themeBase), e.type === "reload" && location.reload());
22
- }
23
- const { sendMessage: o } = h(s);
24
- r(() => {
25
- o({ type: "iframeReady" });
26
- });
27
- }
28
- export {
29
- c as a,
30
- h as u
31
- };