@apple-pie/slice 0.1.3 → 0.1.4
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 +47 -77
- package/dist/cjs/chunks/{Button-hg5kGC1P.js → Button-krf4dQeL.js} +4 -2
- package/dist/cjs/chunks/{FileList-BQgcnKPP.js → FileList-CkpMj-os.js} +1 -1
- package/dist/cjs/chunks/{ProgressIndicator-qjya_Yb5.js → ProgressIndicator-DVD-gD3T.js} +1 -1
- package/dist/cjs/chunks/{PromptInput-ZqHQUfXw.js → PromptInput-DULf5ock.js} +1 -1
- package/dist/cjs/chunks/SSEConnection-B_yE8cXz.js +140 -0
- package/dist/cjs/chunks/{TextArea-BhzVGfKA.js → TextArea-BJCjRUEG.js} +1 -1
- package/dist/cjs/chunks/{TextField-hIjxrOG9.js → TextField-CjT26H_6.js} +18 -16
- package/dist/cjs/chunks/{UploadArea-B4GA06LW.js → UploadArea-BE6but3t.js} +1 -1
- package/dist/cjs/chunks/WSConnection-DCBuJGmb.js +206 -0
- package/dist/cjs/chunks/{sseStore-Dg0WuXsI.js → sseStore-CIIeshjm.js} +3 -3
- package/dist/cjs/chunks/windowStore-CCxCOUqa.js +156 -0
- package/dist/cjs/components/Button/index.js +2 -2
- package/dist/cjs/components/FileList/index.js +2 -2
- package/dist/cjs/components/Progress/index.js +2 -2
- package/dist/cjs/components/PromptInput/index.js +4 -4
- package/dist/cjs/components/TextArea/index.js +3 -3
- package/dist/cjs/components/Textfield/index.js +3 -3
- package/dist/cjs/components/UploadArea/index.js +7 -8
- package/dist/cjs/hooks/useWindow.js +46 -11
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/stores/SSE.js +2 -2
- package/dist/cjs/stores/WS.js +62 -0
- package/dist/cjs/stores/window.js +14 -3
- package/dist/cjs/stores.js +15 -4
- package/dist/cjs/utils/index.js +2 -2
- package/dist/cjs/utils/objects/index.js +4 -138
- package/dist/esm/chunks/{Button-DJDS7Yad.mjs → Button-kXFJmcKv.mjs} +4 -2
- package/dist/esm/chunks/{FileList-CmlXqPXl.mjs → FileList-Bon537-t.mjs} +1 -1
- package/dist/esm/chunks/{PromptInput-DSHVUuEf.mjs → PromptInput-DXFAZspz.mjs} +3 -3
- package/dist/esm/chunks/SSEConnection-Dj9P0SWE.mjs +140 -0
- package/dist/esm/chunks/{TextArea-CyVBzMoN.mjs → TextArea-DBmM6aQm.mjs} +1 -1
- package/dist/esm/chunks/{TextField-CYI2vbvO.mjs → TextField-DyUTMegV.mjs} +18 -16
- package/dist/esm/chunks/{UploadArea-Kez3VD4d.mjs → UploadArea-tT5V8q23.mjs} +3 -3
- package/dist/esm/chunks/WSConnection-DlYSitff.mjs +206 -0
- package/dist/esm/chunks/{sseStore-m3IPyLwJ.mjs → sseStore-DdqmnAAf.mjs} +2 -2
- package/dist/esm/chunks/windowStore-BOTh1g37.mjs +148 -0
- package/dist/esm/components/Button/index.mjs +2 -2
- package/dist/esm/components/FileList/index.mjs +2 -2
- package/dist/esm/components/Progress/index.mjs +3 -3
- package/dist/esm/components/PromptInput/index.mjs +4 -4
- package/dist/esm/components/TextArea/index.mjs +3 -3
- package/dist/esm/components/Textfield/index.mjs +3 -3
- package/dist/esm/components/UploadArea/index.mjs +7 -7
- package/dist/esm/hooks/useWindow.mjs +47 -11
- package/dist/esm/index.mjs +7 -7
- package/dist/esm/stores/SSE.mjs +2 -2
- package/dist/esm/stores/WS.mjs +59 -0
- package/dist/esm/stores/window.mjs +3 -1
- package/dist/esm/stores.mjs +5 -5
- package/dist/esm/utils/index.mjs +3 -1
- package/dist/esm/utils/objects/index.mjs +4 -139
- package/dist/types/hooks/index.d.ts +1 -1
- package/dist/types/hooks/useWindow/useWindow.d.ts +19 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/stores/WS/_types.d.ts +17 -0
- package/dist/types/stores/WS/index.d.ts +2 -0
- package/dist/types/stores/WS/wsStore.d.ts +19 -0
- package/dist/types/stores/window/_types.d.ts +5 -0
- package/dist/types/stores/window/index.d.ts +3 -2
- package/dist/types/stores/window/windowStore.d.ts +8 -0
- package/dist/types/utils/index.d.ts +2 -2
- package/dist/types/utils/objects/WSConnection/WSConnection.d.ts +147 -0
- package/dist/types/utils/objects/index.d.ts +2 -0
- package/package.json +1 -1
- package/dist/cjs/chunks/windowStore-RaJswiHM.js +0 -70
- package/dist/esm/chunks/windowStore-CwW0i_le.mjs +0 -71
- package/dist/esm/chunks/{ProgressIndicator-h11R3FG1.mjs → ProgressIndicator-D2eairZl.mjs} +2 -2
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { create } from "zustand";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Form factor names
|
|
5
|
-
*/ var FormFactor;
|
|
6
|
-
|
|
7
|
-
!function(FormFactor) {
|
|
8
|
-
FormFactor.Mobile = "mobile", FormFactor.Tablet = "tablet", FormFactor.Desktop = "desktop",
|
|
9
|
-
FormFactor.DesktopL = "desktopL", FormFactor.DesktopXL = "desktopXL";
|
|
10
|
-
}(FormFactor || (FormFactor = {}));
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Use bootstrap breakpoints
|
|
14
|
-
*/
|
|
15
|
-
const bootstrapBreakPoints = {
|
|
16
|
-
[FormFactor.Mobile]: 576,
|
|
17
|
-
[FormFactor.Tablet]: 768,
|
|
18
|
-
[FormFactor.Desktop]: 992,
|
|
19
|
-
[FormFactor.DesktopL]: 1200,
|
|
20
|
-
[FormFactor.DesktopXL]: 1400
|
|
21
|
-
}, orderedBps = Object.entries(bootstrapBreakPoints).sort((a, b) => -b[1] - a[1]), getFormFactor = width => {
|
|
22
|
-
if (!width || width <= 0) return FormFactor.Mobile;
|
|
23
|
-
for (const [formFactor, breakpoint] of orderedBps) if (width >= breakpoint) return formFactor;
|
|
24
|
-
return FormFactor.Mobile;
|
|
25
|
-
}, initialSize = processWindowSize(), useWindowStore = create((set, get) => {
|
|
26
|
-
var _a;
|
|
27
|
-
return {
|
|
28
|
-
formFactor: initialSize.formFactor,
|
|
29
|
-
viewportWidth: initialSize.viewportWidth,
|
|
30
|
-
viewportHeight: initialSize.viewportHeight,
|
|
31
|
-
height: initialSize.height,
|
|
32
|
-
isElectron: checkElectron(),
|
|
33
|
-
isAppleDevice: navigator.platform.startsWith("Mac") || "iPhone" === navigator.platform,
|
|
34
|
-
isTouchDevice: "ontouchstart" in globalThis || navigator.maxTouchPoints > 0,
|
|
35
|
-
dpr: null !== (_a = Math.min(Math.ceil(window.devicePixelRatio), 3)) && void 0 !== _a ? _a : 1,
|
|
36
|
-
actions: {
|
|
37
|
-
initialize: () => {
|
|
38
|
-
var _a;
|
|
39
|
-
const win = null !== (_a = globalThis.top) && void 0 !== _a ? _a : globalThis;
|
|
40
|
-
return null == win || win.addEventListener("resize", handleResize), () => null == win ? void 0 : win.removeEventListener("resize", handleResize);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
function checkElectron() {
|
|
47
|
-
return navigator.userAgent.toLowerCase().includes("electron/");
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function handleResize() {
|
|
51
|
-
const {formFactor: formFactor, viewportWidth: viewportWidth, viewportHeight: viewportHeight, height: height} = processWindowSize();
|
|
52
|
-
useWindowStore.setState({
|
|
53
|
-
formFactor: formFactor,
|
|
54
|
-
viewportWidth: viewportWidth,
|
|
55
|
-
viewportHeight: viewportHeight,
|
|
56
|
-
height: height
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function processWindowSize(top = !0) {
|
|
61
|
-
var _a, _b, _c;
|
|
62
|
-
const viewport = null !== (_a = globalThis.top) && void 0 !== _a ? _a : globalThis, touch = "ontouchstart" in globalThis || navigator.maxTouchPoints > 0, windowWidth = null !== (_b = null == viewport ? void 0 : viewport.innerWidth) && void 0 !== _b ? _b : -1, windowHeight = null !== (_c = null == viewport ? void 0 : viewport.innerHeight) && void 0 !== _c ? _c : -1;
|
|
63
|
-
return {
|
|
64
|
-
formFactor: getFormFactor(windowWidth),
|
|
65
|
-
viewportWidth: windowWidth,
|
|
66
|
-
viewportHeight: windowHeight,
|
|
67
|
-
height: viewport && touch ? `${windowHeight}px` : "100vh"
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export { FormFactor as F, useWindowStore as u };
|
|
@@ -8,12 +8,12 @@ import "../theme/colors.mjs";
|
|
|
8
8
|
|
|
9
9
|
import "../hooks/useWindow.mjs";
|
|
10
10
|
|
|
11
|
-
import { _ as __rest } from "./tslib.es6-c-7TIv71.mjs";
|
|
12
|
-
|
|
13
11
|
import { I as Icon } from "./_types-CTmvSEX0.mjs";
|
|
14
12
|
|
|
15
13
|
import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
|
|
16
14
|
|
|
15
|
+
import { _ as __rest } from "./tslib.es6-c-7TIv71.mjs";
|
|
16
|
+
|
|
17
17
|
import { AnimatePresence, motion } from "motion/react";
|
|
18
18
|
|
|
19
19
|
var css$1_wrapper = "DoneCheck-module_wrapper__AlISD flexBox-module_row__z24tF", css$1_icon = "DoneCheck-module_icon__bKaFp flexBox-module_row__z24tF";
|