v-sistec-features 1.17.1 → 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.
@@ -1,4 +1,4 @@
1
- import { u as m, a as o } from "./useThemeFromParent-DVAilJ4B.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.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-DVAilJ4B.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.1",
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, readonly } from 'vue';
2
+ import { onMounted, ref, readonly, provide } from 'vue';
3
3
 
4
4
 
5
5
  /**
@@ -45,6 +45,9 @@ 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));
48
51
  return {
49
52
  theme: readonly(theme),
50
53
  themePalette: readonly(themePalette),
@@ -1,35 +0,0 @@
1
- import { ref as n, onMounted as i, onUnmounted as d, readonly as r } from "vue";
2
- function h(t) {
3
- const a = n(window.parent !== window);
4
- function m(s, o = "*") {
5
- a.value && window.parent.postMessage(s, o);
6
- }
7
- return i(() => {
8
- t && window.addEventListener("message", t);
9
- }), d(() => {
10
- t && window.removeEventListener("message", t);
11
- }), {
12
- isInIframe: r(a),
13
- // readonly para evitar modificação externa
14
- sendMessage: m
15
- };
16
- }
17
- function l() {
18
- const t = n("light"), a = n("slate"), m = n("");
19
- function s(u) {
20
- const e = u.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), a.value = e.themeBase), e.type === "reload" && location.reload());
22
- }
23
- const { sendMessage: o } = h(s);
24
- return i(() => {
25
- o({ type: "iframeReady" });
26
- }), {
27
- theme: r(t),
28
- themePalette: r(a),
29
- themePrimary: r(m)
30
- };
31
- }
32
- export {
33
- l as a,
34
- h as u
35
- };