@luna-park/plugin-reactivity 1.0.0 → 1.1.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.
Files changed (3) hide show
  1. package/dist/index.js +521 -431
  2. package/dist/runtime.js +85 -62
  3. package/package.json +1 -1
package/dist/runtime.js CHANGED
@@ -1,28 +1,28 @@
1
- import { breakpointsAntDesign as e, breakpointsBootstrapV5 as t, breakpointsElement as n, breakpointsQuasar as r, breakpointsTailwind as i, breakpointsVuetifyV3 as a, refDebounced as o, refThrottled as s, useBreakpoints as c, useColorMode as l, useCountdown as u, useFullscreen as d, useIntervalFn as f, useScrollLock as p, useStorage as m, useWakeLock as h } from "@vueuse/core";
2
- import { computed as g, effectScope as _, getCurrentScope as v, reactive as y } from "vue";
1
+ import { breakpointsAntDesign as e, breakpointsBootstrapV5 as t, breakpointsElement as n, breakpointsQuasar as r, breakpointsTailwind as i, breakpointsVuetifyV3 as a, refDebounced as o, refThrottled as s, useBreakpoints as c, useColorMode as l, useCountdown as u, useEventListener as d, useFullscreen as f, useIntervalFn as p, useScrollLock as m, useStorage as h, useWakeLock as g } from "@vueuse/core";
2
+ import { computed as _, effectScope as v, getCurrentScope as y, onScopeDispose as ee, reactive as b, ref as x } from "vue";
3
3
  // src/runtime/shared.ts
4
- var b = _(!0), x = !1;
5
- function S(e) {
6
- x = e;
4
+ var S = v(!0), C = !1;
5
+ function te(e) {
6
+ C = e;
7
7
  }
8
- function C() {
9
- return x;
8
+ function w() {
9
+ return C;
10
10
  }
11
- function w(e) {
11
+ function T(e) {
12
12
  let t;
13
- return () => (t ??= b.run(e), t);
13
+ return () => (t ??= S.run(e), t);
14
14
  }
15
- function T(e) {
16
- return b.run(e);
15
+ function E(e) {
16
+ return S.run(e);
17
17
  }
18
18
  // src/runtime/actions.ts
19
- var E = w(() => d()), D = w(() => h()), O = w(() => p(globalThis.document?.body));
20
- async function k(e) {
21
- let t = E();
22
- return await t[e]().catch(() => void 0), t.isFullscreen.value;
23
- }
19
+ var D = T(() => f()), O = T(() => g()), k = T(() => m(globalThis.document?.body));
24
20
  async function A(e) {
25
21
  let t = D();
22
+ return await t[e]().catch(() => void 0), t.isFullscreen.value;
23
+ }
24
+ async function j(e) {
25
+ let t = O();
26
26
  try {
27
27
  e ? await t.request("screen") : await t.release();
28
28
  } catch {
@@ -30,13 +30,13 @@ async function A(e) {
30
30
  }
31
31
  return e;
32
32
  }
33
- function j(e) {
34
- C() || (O().value = e);
33
+ function M(e) {
34
+ w() || (k().value = e);
35
35
  }
36
- function M() {
37
- return O().value;
36
+ function N() {
37
+ return k().value;
38
38
  }
39
- async function N(e) {
39
+ async function P(e) {
40
40
  if (!globalThis.navigator?.share) return !1;
41
41
  try {
42
42
  return await navigator.share(e), !0;
@@ -44,20 +44,20 @@ async function N(e) {
44
44
  return !1;
45
45
  }
46
46
  }
47
- function P(e) {
47
+ function F(e) {
48
48
  return globalThis.navigator?.vibrate?.(e) ?? !1;
49
49
  }
50
- async function F(e, t = {}) {
50
+ async function I(e, t = {}) {
51
51
  return !("Notification" in globalThis) || (Notification.permission === "default" ? await Notification.requestPermission() : Notification.permission) !== "granted" ? !1 : (new Notification(e, t), !0);
52
52
  }
53
- function I(e, t = {}) {
53
+ function L(e, t = {}) {
54
54
  if (!("speechSynthesis" in globalThis)) return Promise.resolve(!1);
55
55
  let n = new SpeechSynthesisUtterance(e);
56
56
  return Object.assign(n, Object.fromEntries(Object.entries(t).filter(([, e]) => e !== void 0))), new Promise((e) => {
57
57
  n.onend = () => e(!0), n.onerror = () => e(!1), speechSynthesis.cancel(), speechSynthesis.speak(n);
58
58
  });
59
59
  }
60
- async function L() {
60
+ async function R() {
61
61
  let e = globalThis.EyeDropper;
62
62
  if (!e) return "";
63
63
  try {
@@ -67,44 +67,67 @@ async function L() {
67
67
  }
68
68
  }
69
69
  // src/runtime/config.ts
70
- var R = {
70
+ var z = {
71
71
  antDesign: e,
72
72
  bootstrap: t,
73
73
  element: n,
74
74
  quasar: r,
75
75
  tailwind: i,
76
76
  vuetify: a
77
- }, z = y({ breakpoints: "tailwind" });
78
- function B(e) {
79
- Object.assign(z, e);
77
+ }, B = b({ breakpoints: "tailwind" });
78
+ function V(e) {
79
+ Object.assign(B, e);
80
80
  }
81
- function V() {
82
- return z.breakpoints;
81
+ function H() {
82
+ return B.breakpoints;
83
83
  }
84
- function H(e) {
85
- return Object.keys(R[e] ?? i);
84
+ function U(e) {
85
+ return Object.keys(z[e] ?? i);
86
86
  }
87
- function U() {
88
- return c(R[z.breakpoints] ?? i);
87
+ function W() {
88
+ return c(z[B.breakpoints] ?? i);
89
89
  }
90
- function W(e) {
91
- let t = U();
90
+ function G(e) {
91
+ let t = W();
92
92
  return {
93
93
  greaterOrEqual: t.greaterOrEqual(e),
94
94
  smaller: t.smaller(e)
95
95
  };
96
96
  }
97
+ // src/runtime/drag.ts
98
+ function K() {
99
+ let e = x(0), t = x(0), n = x(!1), r;
100
+ function i(i) {
101
+ r?.(), i.preventDefault?.();
102
+ let a = i.clientX - e.value, o = i.clientY - t.value;
103
+ n.value = !0;
104
+ let s = [d(window, "pointermove", (n) => {
105
+ e.value = n.clientX - a, t.value = n.clientY - o;
106
+ }), d(window, ["pointerup", "pointercancel"], () => {
107
+ n.value = !1, r?.();
108
+ })];
109
+ r = () => {
110
+ s.forEach((e) => e()), r = void 0;
111
+ };
112
+ }
113
+ return ee(() => r?.()), {
114
+ isDragging: n,
115
+ start: i,
116
+ x: e,
117
+ y: t
118
+ };
119
+ }
97
120
  // src/runtime/instances.ts
98
- function G() {
99
- let e = v() ?? _(!0), t = /* @__PURE__ */ new Map();
121
+ function q() {
122
+ let e = y() ?? v(!0), t = /* @__PURE__ */ new Map();
100
123
  return function(n, r, i) {
101
124
  let a = t.get(i);
102
125
  if (a && a.deps.length === n.length && a.deps.every((e, t) => Object.is(e, n[t]))) return a.value;
103
126
  if (a?.scope.stop(), !e.active) {
104
- let e = _(!0), t = e.run(r);
127
+ let e = v(!0), t = e.run(r);
105
128
  return e.stop(), t;
106
129
  }
107
- let o = e.run(() => _()), s = o.run(r);
130
+ let o = e.run(() => v()), s = o.run(r);
108
131
  return t.set(i, {
109
132
  deps: n,
110
133
  scope: o,
@@ -113,7 +136,7 @@ function G() {
113
136
  };
114
137
  }
115
138
  // src/runtime/state.ts
116
- var K = /* @__PURE__ */ new Map(), q = {
139
+ var J = /* @__PURE__ */ new Map(), Y = {
117
140
  read: (e) => {
118
141
  try {
119
142
  return JSON.parse(e);
@@ -123,38 +146,38 @@ var K = /* @__PURE__ */ new Map(), q = {
123
146
  },
124
147
  write: (e) => JSON.stringify(e)
125
148
  };
126
- function J(e, t = "local") {
127
- let n = `${t}:${e}`, r = K.get(n);
149
+ function X(e, t = "local") {
150
+ let n = `${t}:${e}`, r = J.get(n);
128
151
  if (r) return r;
129
- let i = t === "session" ? globalThis.sessionStorage : globalThis.localStorage, a = T(() => m(e, null, i, {
130
- serializer: q,
152
+ let i = t === "session" ? globalThis.sessionStorage : globalThis.localStorage, a = E(() => h(e, null, i, {
153
+ serializer: Y,
131
154
  writeDefaults: !1
132
155
  }));
133
- return K.set(n, a), a;
156
+ return J.set(n, a), a;
134
157
  }
135
- function Y(e, t = "local", n) {
136
- return J(e, t).value ?? n;
158
+ function Z(e, t = "local", n) {
159
+ return X(e, t).value ?? n;
137
160
  }
138
- function X(e, t, n = "local") {
139
- J(e, n).value = t ?? null;
161
+ function Q(e, t, n = "local") {
162
+ X(e, n).value = t ?? null;
140
163
  }
141
- var Z = w(() => l({
164
+ var $ = T(() => l({
142
165
  emitAuto: !0,
143
166
  onChanged: (e, t) => {
144
- C() || t(e);
167
+ w() || t(e);
145
168
  }
146
169
  }));
147
- function Q(e) {
148
- Z().store.value = e;
170
+ function ne(e) {
171
+ $().store.value = e;
149
172
  }
150
- function $(e, t) {
151
- return o(g(e), t);
173
+ function re(e, t) {
174
+ return o(_(e), t);
152
175
  }
153
- function ee(e, t) {
154
- return s(g(e), t);
176
+ function ie(e, t) {
177
+ return s(_(e), t);
155
178
  }
156
- function te(e, t) {
157
- let n = u(e, { scheduler: (e) => f(e, t, { immediate: !1 }) });
179
+ function ae(e, t) {
180
+ let n = u(e, { scheduler: (e) => p(e, t, { immediate: !1 }) });
158
181
  return n.start(), n;
159
182
  }
160
- export { R as breakpointPresets, B as configureReactivity, H as getBreakpointNames, V as getBreakpointPreset, Z as getColorMode, E as getFullscreen, D as getWakeLock, C as isEditorMode, M as isScrollLocked, F as notify, L as pickColor, Y as readStorage, Q as setColorMode, S as setEditorMode, k as setFullscreen, j as setScrollLock, A as setWakeLock, N as share, I as speak, W as useBreakpoint, U as useBreakpointPreset, $ as useDebouncedValue, G as useInstances, te as useRunningCountdown, ee as useThrottledValue, P as vibrate, X as writeStorage };
183
+ export { z as breakpointPresets, V as configureReactivity, U as getBreakpointNames, H as getBreakpointPreset, $ as getColorMode, D as getFullscreen, O as getWakeLock, w as isEditorMode, N as isScrollLocked, I as notify, R as pickColor, Z as readStorage, ne as setColorMode, te as setEditorMode, A as setFullscreen, M as setScrollLock, j as setWakeLock, P as share, L as speak, G as useBreakpoint, W as useBreakpointPreset, re as useDebouncedValue, K as useDrag, q as useInstances, ae as useRunningCountdown, ie as useThrottledValue, F as vibrate, Q as writeStorage };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luna-park/plugin-reactivity",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "private": false,
5
5
  "description": "Reactivity plugin for Luna Park: browser, sensor, time and state nodes powered by VueUse.",
6
6
  "keywords": [