fullstacked 0.12.2-1382 → 0.12.2-1407
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/fullstacked_modules/@types/connect/index.d.ts +3 -3
- package/fullstacked_modules/@types/style/index.d.ts +54 -0
- package/fullstacked_modules/auto_update.ts +2 -1
- package/fullstacked_modules/build/index.ts +24 -6
- package/fullstacked_modules/components/snackbar.s.ts +96 -0
- package/fullstacked_modules/components/snackbar.ts +3 -2
- package/fullstacked_modules/connect.ts +5 -3
- package/fullstacked_modules/git.ts +10 -5
- package/fullstacked_modules/sass/index.js +3974 -2942
- package/fullstacked_modules/style/build.ts +150 -0
- package/fullstacked_modules/style.ts +60 -0
- package/index.js +21 -6
- package/package.json +4 -2
- package/fullstacked_modules/components/snackbar.css +0 -54
- package/fullstacked_modules/components/snackbar.scss +0 -52
|
@@ -12,17 +12,17 @@ declare module "connect" {
|
|
|
12
12
|
on(callback: DataChannelRawCallback): void;
|
|
13
13
|
off(callback: DataChannelRawCallback): void;
|
|
14
14
|
};
|
|
15
|
-
export
|
|
15
|
+
export declare function connect(
|
|
16
16
|
name: string,
|
|
17
17
|
port: number,
|
|
18
18
|
host?: string,
|
|
19
19
|
raw?: false,
|
|
20
20
|
): Promise<DataChannel>;
|
|
21
|
-
export
|
|
21
|
+
export declare function connect(
|
|
22
22
|
name: string,
|
|
23
23
|
port: number,
|
|
24
24
|
host: string,
|
|
25
25
|
raw: true,
|
|
26
26
|
): Promise<DataChannelRaw>;
|
|
27
|
-
export
|
|
27
|
+
export default connect;
|
|
28
28
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
declare module "style" {
|
|
2
|
+
import CSS from "csstype";
|
|
3
|
+
export declare const propertiesDefaultingToPx: {
|
|
4
|
+
readonly padding: true;
|
|
5
|
+
readonly paddingTop: true;
|
|
6
|
+
readonly paddingRight: true;
|
|
7
|
+
readonly paddingBottom: true;
|
|
8
|
+
readonly paddingLeft: true;
|
|
9
|
+
readonly margin: true;
|
|
10
|
+
readonly marginTop: true;
|
|
11
|
+
readonly marginRight: true;
|
|
12
|
+
readonly marginBottom: true;
|
|
13
|
+
readonly marginLeft: true;
|
|
14
|
+
readonly width: true;
|
|
15
|
+
readonly minWidth: true;
|
|
16
|
+
readonly maxWidth: true;
|
|
17
|
+
readonly height: true;
|
|
18
|
+
readonly minHeight: true;
|
|
19
|
+
readonly maxHeight: true;
|
|
20
|
+
readonly top: true;
|
|
21
|
+
readonly right: true;
|
|
22
|
+
readonly bottom: true;
|
|
23
|
+
readonly left: true;
|
|
24
|
+
readonly gap: true;
|
|
25
|
+
readonly fontSize: true;
|
|
26
|
+
readonly borderRadius: true;
|
|
27
|
+
readonly borderTopLeftRadius: true;
|
|
28
|
+
readonly borderTopRightRadius: true;
|
|
29
|
+
readonly borderBottomLeftRadius: true;
|
|
30
|
+
readonly borderBottomRightRadius: true;
|
|
31
|
+
readonly outlineOffset: true;
|
|
32
|
+
};
|
|
33
|
+
export type CSSProperties =
|
|
34
|
+
| {
|
|
35
|
+
[property in keyof CSS.Properties]: property extends keyof typeof propertiesDefaultingToPx
|
|
36
|
+
? number | CSS.Properties[property]
|
|
37
|
+
: CSS.Properties[property];
|
|
38
|
+
}
|
|
39
|
+
| {
|
|
40
|
+
[child: string]: CSSProperties;
|
|
41
|
+
};
|
|
42
|
+
export declare const createClass: (
|
|
43
|
+
name: string,
|
|
44
|
+
cssProperties: CSSProperties,
|
|
45
|
+
) => string;
|
|
46
|
+
export declare const createGlobalStyle: (
|
|
47
|
+
cssProperties: CSSProperties,
|
|
48
|
+
) => void;
|
|
49
|
+
declare const style: {
|
|
50
|
+
createClass: (name: string, cssProperties: CSSProperties) => string;
|
|
51
|
+
createGlobalStyle: (cssProperties: CSSProperties) => void;
|
|
52
|
+
};
|
|
53
|
+
export default style;
|
|
54
|
+
}
|
|
@@ -9,14 +9,32 @@ import core_message from "../core_message";
|
|
|
9
9
|
import { buildSASS } from "./sass";
|
|
10
10
|
import fs from "../fs";
|
|
11
11
|
|
|
12
|
+
async function buildStyle(projectId: string, entrypoint: string) {
|
|
13
|
+
const modulePath = projectId ? `/${projectId}/${entrypoint}` : entrypoint;
|
|
14
|
+
const contents = await fs.readFile(modulePath);
|
|
15
|
+
const urlObj = URL.createObjectURL(
|
|
16
|
+
new Blob([contents as Uint8Array<ArrayBuffer>], {
|
|
17
|
+
type: "text/javascript"
|
|
18
|
+
})
|
|
19
|
+
);
|
|
20
|
+
const css = (await import(urlObj)).exportStyles();
|
|
21
|
+
URL.revokeObjectURL(urlObj);
|
|
22
|
+
return {
|
|
23
|
+
css,
|
|
24
|
+
errors: []
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
12
28
|
core_message.addListener("build-style", async (messageStr) => {
|
|
13
29
|
const { id, entryPoint, projectId } = JSON.parse(messageStr);
|
|
14
|
-
const result =
|
|
15
|
-
projectId,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
30
|
+
const result = entryPoint.endsWith(".js")
|
|
31
|
+
? await buildStyle(projectId, entryPoint)
|
|
32
|
+
: await buildSASS(entryPoint, {
|
|
33
|
+
projectId,
|
|
34
|
+
canonicalize: (filePath) => new URL(filePath, "file://"),
|
|
35
|
+
load: (url) =>
|
|
36
|
+
fs.readFile(projectId + url.pathname, { encoding: "utf8" })
|
|
37
|
+
});
|
|
20
38
|
bridge(
|
|
21
39
|
new Uint8Array([58, ...serializeArgs([id, JSON.stringify(result)])])
|
|
22
40
|
);
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import style from "style";
|
|
2
|
+
|
|
3
|
+
const spacing = {
|
|
4
|
+
xs: 5,
|
|
5
|
+
s: 10,
|
|
6
|
+
m: 20,
|
|
7
|
+
l: 30
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const colors = {
|
|
11
|
+
blue: {
|
|
12
|
+
main: "#007aff",
|
|
13
|
+
accent: "#04b8ec",
|
|
14
|
+
dark: "#1e293b"
|
|
15
|
+
},
|
|
16
|
+
dark: "#15171b",
|
|
17
|
+
red: "#ff453a",
|
|
18
|
+
green: "#30d158",
|
|
19
|
+
yellow: "#ffcc00",
|
|
20
|
+
light: "#ffffff",
|
|
21
|
+
gray: {
|
|
22
|
+
main: "#8c929b",
|
|
23
|
+
dark: "#404958"
|
|
24
|
+
},
|
|
25
|
+
overlay: "#15171b99"
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
function opacity(color: string, opacity: number) {
|
|
29
|
+
return `rgba(${parseInt(color.slice(1, 3), 16)}, ${parseInt(color.slice(3, 5), 16)}, ${parseInt(color.slice(5), 16)}, ${opacity / 100})`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const typography = {
|
|
33
|
+
h1: 36,
|
|
34
|
+
h2: 30,
|
|
35
|
+
h3: 24,
|
|
36
|
+
m: 16,
|
|
37
|
+
s: 12,
|
|
38
|
+
xs: 9
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const fontFamily =
|
|
42
|
+
'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif';
|
|
43
|
+
|
|
44
|
+
export const snackBarClass = "snack-bar";
|
|
45
|
+
|
|
46
|
+
export const snackBarsContainerClass = style.createClass(
|
|
47
|
+
"snack-bars-container",
|
|
48
|
+
{
|
|
49
|
+
display: "flex",
|
|
50
|
+
flexDirection: "column",
|
|
51
|
+
gap: spacing.s,
|
|
52
|
+
position: "fixed",
|
|
53
|
+
bottom: 0,
|
|
54
|
+
left: 0,
|
|
55
|
+
zIndex: 100,
|
|
56
|
+
padding: `0 ${spacing.m} ${spacing.m}`,
|
|
57
|
+
alignItems: "flex-start",
|
|
58
|
+
width: "100%",
|
|
59
|
+
pointerEvents: "none",
|
|
60
|
+
textAlign: "left",
|
|
61
|
+
fontFamily,
|
|
62
|
+
fontSize: typography.m,
|
|
63
|
+
maxWidth: 450,
|
|
64
|
+
|
|
65
|
+
[`@media (max-width: 450px)`]: {
|
|
66
|
+
alignItems: "center"
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
[`.${snackBarClass}`]: {
|
|
70
|
+
pointerEvents: "all",
|
|
71
|
+
|
|
72
|
+
backgroundColor: colors.gray.dark,
|
|
73
|
+
borderRadius: spacing.xs,
|
|
74
|
+
color: colors.light,
|
|
75
|
+
|
|
76
|
+
minHeight: 42,
|
|
77
|
+
maxWidth: "100%",
|
|
78
|
+
width: "max-content",
|
|
79
|
+
|
|
80
|
+
display: "flex",
|
|
81
|
+
alignItems: "center",
|
|
82
|
+
justifyContent: "space-between",
|
|
83
|
+
gap: spacing.s,
|
|
84
|
+
|
|
85
|
+
padding: `${spacing.xs} ${spacing.s}`,
|
|
86
|
+
|
|
87
|
+
boxShadow: `0px 4px 10px ${opacity(colors.dark, 60)}`,
|
|
88
|
+
|
|
89
|
+
["> div:first-child"]: {
|
|
90
|
+
padding: `${spacing.xs} 0`,
|
|
91
|
+
width: "100%",
|
|
92
|
+
overflowWrap: "break-word"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
);
|
|
@@ -4,6 +4,7 @@ https://www.figma.com/design/xb3JBRCvEWpbwGda03T5QQ/Mockups?node-id=415-3655
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { Button } from "@fullstacked/ui";
|
|
7
|
+
import { snackBarClass, snackBarsContainerClass } from "./snackbar.s";
|
|
7
8
|
|
|
8
9
|
type SnackBarOpt = {
|
|
9
10
|
message: string;
|
|
@@ -16,12 +17,12 @@ let snackBarsContainer: HTMLDivElement;
|
|
|
16
17
|
export function SnackBar(opts: SnackBarOpt) {
|
|
17
18
|
if (!snackBarsContainer) {
|
|
18
19
|
snackBarsContainer = document.createElement("div");
|
|
19
|
-
snackBarsContainer.classList.add(
|
|
20
|
+
snackBarsContainer.classList.add(snackBarsContainerClass);
|
|
20
21
|
document.body.append(snackBarsContainer);
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
const container = document.createElement("div");
|
|
24
|
-
container.classList.add(
|
|
25
|
+
container.classList.add(snackBarClass);
|
|
25
26
|
|
|
26
27
|
const text = document.createElement("div");
|
|
27
28
|
text.innerHTML = opts.message;
|
|
@@ -38,19 +38,19 @@ type ChannelRaw = {
|
|
|
38
38
|
const channels = new Map<string, Channel | ChannelRaw>();
|
|
39
39
|
|
|
40
40
|
// 20
|
|
41
|
-
export
|
|
41
|
+
export function connect(
|
|
42
42
|
name: string,
|
|
43
43
|
port: number,
|
|
44
44
|
host?: string,
|
|
45
45
|
raw?: false
|
|
46
46
|
): Promise<DataChannel>;
|
|
47
|
-
export
|
|
47
|
+
export function connect(
|
|
48
48
|
name: string,
|
|
49
49
|
port: number,
|
|
50
50
|
host: string,
|
|
51
51
|
raw: true
|
|
52
52
|
): Promise<DataChannelRaw>;
|
|
53
|
-
export
|
|
53
|
+
export function connect(
|
|
54
54
|
name: string,
|
|
55
55
|
port: number,
|
|
56
56
|
host = "localhost",
|
|
@@ -123,3 +123,5 @@ function send(channelId: string, data: Uint8Array) {
|
|
|
123
123
|
|
|
124
124
|
return bridge(payload);
|
|
125
125
|
}
|
|
126
|
+
|
|
127
|
+
export default connect;
|
|
@@ -5,17 +5,22 @@ import { Project } from "./../editor/types";
|
|
|
5
5
|
|
|
6
6
|
const pullPromises = new Map<
|
|
7
7
|
string,
|
|
8
|
-
|
|
8
|
+
{
|
|
9
|
+
resolve: (p: PullResponse) => void;
|
|
10
|
+
reject: (p: PullResponse) => void;
|
|
11
|
+
}[]
|
|
9
12
|
>();
|
|
10
13
|
let addedListener = false;
|
|
11
14
|
function setListenerOnce() {
|
|
12
15
|
if (addedListener) return;
|
|
13
16
|
|
|
14
17
|
core_message.addListener("git-pull", (message) => {
|
|
15
|
-
const { url, data, finished } = JSON.parse(message);
|
|
18
|
+
const { url, data, error, finished } = JSON.parse(message);
|
|
16
19
|
if (!finished) return;
|
|
17
20
|
const promises = pullPromises.get(url);
|
|
18
|
-
promises?.forEach((resolve) =>
|
|
21
|
+
promises?.forEach(({ resolve, reject }) =>
|
|
22
|
+
error ? reject(data) : resolve(data)
|
|
23
|
+
);
|
|
19
24
|
pullPromises.delete(url);
|
|
20
25
|
});
|
|
21
26
|
addedListener = true;
|
|
@@ -109,8 +114,8 @@ export async function pull(project?: Project): Promise<PullResponse> {
|
|
|
109
114
|
pullPromises.set(url, p);
|
|
110
115
|
}
|
|
111
116
|
|
|
112
|
-
return new Promise((resolve) => {
|
|
113
|
-
p.push(resolve);
|
|
117
|
+
return new Promise((resolve, reject) => {
|
|
118
|
+
p.push({ resolve, reject });
|
|
114
119
|
bridge(payload);
|
|
115
120
|
});
|
|
116
121
|
}
|