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
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { propertiesDefaultingToPx, CSSProperties } from "../style";
|
|
2
|
+
|
|
3
|
+
const propertiesDefaultingToPxArr = Object.keys(propertiesDefaultingToPx);
|
|
4
|
+
const allCSSProperties = [];
|
|
5
|
+
for (const property in document.body.style) {
|
|
6
|
+
allCSSProperties.push(property);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
type StyleItem = {
|
|
10
|
+
element: HTMLElement;
|
|
11
|
+
order: number;
|
|
12
|
+
children: StyleTree;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type StyleTree = {
|
|
16
|
+
[name: string]: StyleItem;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const styles: StyleTree = {};
|
|
20
|
+
let order = 0;
|
|
21
|
+
|
|
22
|
+
function getOrCreateParentFromPath(path: string[], parent = styles): StyleTree {
|
|
23
|
+
if (path.length === 0) {
|
|
24
|
+
return parent;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const child = path.shift();
|
|
28
|
+
if (!parent[child]) {
|
|
29
|
+
parent[child] = {
|
|
30
|
+
element: document.createElement("div"),
|
|
31
|
+
order: order++,
|
|
32
|
+
children: {}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return getOrCreateParentFromPath(path, parent[child].children);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function createStyle(
|
|
40
|
+
cssProperties: CSSProperties,
|
|
41
|
+
path: string[],
|
|
42
|
+
existing: StyleItem
|
|
43
|
+
): StyleItem {
|
|
44
|
+
const styleItem = existing || {
|
|
45
|
+
element: document.createElement("div"),
|
|
46
|
+
order: order++,
|
|
47
|
+
children: {}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
Object.entries(cssProperties).forEach(([property, value]) => {
|
|
51
|
+
if (!allCSSProperties.includes(property)) {
|
|
52
|
+
if (property.startsWith("@media")) {
|
|
53
|
+
const parentPath = [property, ...path];
|
|
54
|
+
_createClass(
|
|
55
|
+
parentPath,
|
|
56
|
+
value,
|
|
57
|
+
getOrCreateParentFromPath(parentPath.slice(0, -1))
|
|
58
|
+
);
|
|
59
|
+
} else {
|
|
60
|
+
_createClass([...path, property], value, styleItem.children);
|
|
61
|
+
}
|
|
62
|
+
} else {
|
|
63
|
+
if (
|
|
64
|
+
propertiesDefaultingToPxArr.includes(property) &&
|
|
65
|
+
value &&
|
|
66
|
+
typeof value === "number"
|
|
67
|
+
) {
|
|
68
|
+
value = value + "px";
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
styleItem.element.style[property] = value;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
return styleItem;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function _createClass(
|
|
79
|
+
path: string[],
|
|
80
|
+
cssProperties: CSSProperties,
|
|
81
|
+
parent = styles
|
|
82
|
+
) {
|
|
83
|
+
parent[path.at(-1)] = createStyle(cssProperties, path, parent[path.at(-1)]);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function createClass(name: string, cssProperties: CSSProperties) {
|
|
87
|
+
_createClass(["." + name], cssProperties);
|
|
88
|
+
return name;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function createGlobalStyle(globalCssProperties: CSSProperties) {
|
|
92
|
+
Object.entries(globalCssProperties).forEach(([name, cssProperties]) => {
|
|
93
|
+
styles[name] = createStyle(cssProperties, [name], styles[name]);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function constructClassName(path: string[]) {
|
|
98
|
+
return path.reduce(
|
|
99
|
+
(str, item) =>
|
|
100
|
+
str + (item.startsWith("&") ? item.slice(1) : ` ${item}`),
|
|
101
|
+
""
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function generateStyleRecusively(path: string[] = [], parent = styles) {
|
|
106
|
+
return Object.entries(parent)
|
|
107
|
+
.sort(([_, itemA], [__, itemB]) => itemA.order - itemB.order)
|
|
108
|
+
.map(([tag, styleItem]) => {
|
|
109
|
+
let css = "";
|
|
110
|
+
|
|
111
|
+
const currentPath = [...path, tag];
|
|
112
|
+
|
|
113
|
+
const cssString = styleItem.element.style.cssText;
|
|
114
|
+
|
|
115
|
+
if (cssString) {
|
|
116
|
+
css += `${constructClassName(currentPath)} { ${cssString} } `;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (styleItem.children) {
|
|
120
|
+
if (tag.startsWith("@media")) {
|
|
121
|
+
css += `${tag} { ${generateStyleRecusively(
|
|
122
|
+
currentPath.slice(1),
|
|
123
|
+
styleItem.children
|
|
124
|
+
)} }`;
|
|
125
|
+
} else {
|
|
126
|
+
css += generateStyleRecusively(
|
|
127
|
+
currentPath,
|
|
128
|
+
styleItem.children
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
styleItem.element.remove();
|
|
134
|
+
|
|
135
|
+
return css;
|
|
136
|
+
})
|
|
137
|
+
.flat()
|
|
138
|
+
.join("");
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export function exportStyles() {
|
|
142
|
+
return generateStyleRecusively();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const style = {
|
|
146
|
+
createClass,
|
|
147
|
+
createGlobalStyle
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export default style;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import CSS from "csstype";
|
|
2
|
+
|
|
3
|
+
export const propertiesDefaultingToPx = {
|
|
4
|
+
padding: true,
|
|
5
|
+
paddingTop: true,
|
|
6
|
+
paddingRight: true,
|
|
7
|
+
paddingBottom: true,
|
|
8
|
+
paddingLeft: true,
|
|
9
|
+
|
|
10
|
+
margin: true,
|
|
11
|
+
marginTop: true,
|
|
12
|
+
marginRight: true,
|
|
13
|
+
marginBottom: true,
|
|
14
|
+
marginLeft: true,
|
|
15
|
+
|
|
16
|
+
width: true,
|
|
17
|
+
minWidth: true,
|
|
18
|
+
maxWidth: true,
|
|
19
|
+
|
|
20
|
+
height: true,
|
|
21
|
+
minHeight: true,
|
|
22
|
+
maxHeight: true,
|
|
23
|
+
|
|
24
|
+
top: true,
|
|
25
|
+
right: true,
|
|
26
|
+
bottom: true,
|
|
27
|
+
left: true,
|
|
28
|
+
|
|
29
|
+
gap: true,
|
|
30
|
+
|
|
31
|
+
fontSize: true,
|
|
32
|
+
borderRadius: true,
|
|
33
|
+
borderTopLeftRadius: true,
|
|
34
|
+
borderTopRightRadius: true,
|
|
35
|
+
borderBottomLeftRadius: true,
|
|
36
|
+
borderBottomRightRadius: true,
|
|
37
|
+
|
|
38
|
+
outlineOffset: true
|
|
39
|
+
} as const;
|
|
40
|
+
|
|
41
|
+
export type CSSProperties =
|
|
42
|
+
| {
|
|
43
|
+
[property in keyof CSS.Properties]: property extends keyof typeof propertiesDefaultingToPx
|
|
44
|
+
? number | CSS.Properties[property]
|
|
45
|
+
: CSS.Properties[property];
|
|
46
|
+
}
|
|
47
|
+
| {
|
|
48
|
+
[child: string]: CSSProperties;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const createClass = (name: string, cssProperties: CSSProperties) => name;
|
|
52
|
+
|
|
53
|
+
export const createGlobalStyle = (cssProperties: CSSProperties) => {};
|
|
54
|
+
|
|
55
|
+
const style = {
|
|
56
|
+
createClass,
|
|
57
|
+
createGlobalStyle
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export default style;
|
package/index.js
CHANGED
|
@@ -415,6 +415,7 @@ async function buildSASS(entryPoint, opts) {
|
|
|
415
415
|
// src/build.ts
|
|
416
416
|
import fs2 from "node:fs";
|
|
417
417
|
import path2 from "node:path";
|
|
418
|
+
import jsdom from "jsdom";
|
|
418
419
|
function quickInstallPackage(editorHeader, directory) {
|
|
419
420
|
return new Promise((resolve) => {
|
|
420
421
|
const cb2 = (_, messageType, message) => {
|
|
@@ -436,6 +437,13 @@ function quickInstallPackage(editorHeader, directory) {
|
|
|
436
437
|
);
|
|
437
438
|
});
|
|
438
439
|
}
|
|
440
|
+
async function buildStyle(entrypoint) {
|
|
441
|
+
globalThis.document = new jsdom.JSDOM().window.document;
|
|
442
|
+
return {
|
|
443
|
+
css: (await import(entrypoint)).exportStyles(),
|
|
444
|
+
errors: []
|
|
445
|
+
};
|
|
446
|
+
}
|
|
439
447
|
async function buildLocalProject(directory) {
|
|
440
448
|
const editorHeader = createPayloadHeader({
|
|
441
449
|
id: "",
|
|
@@ -446,7 +454,9 @@ async function buildLocalProject(directory) {
|
|
|
446
454
|
const cb2 = async (_, messageType, message) => {
|
|
447
455
|
if (messageType === "build-style") {
|
|
448
456
|
const { id, entryPoint, projectId } = JSON.parse(message);
|
|
449
|
-
const result = await
|
|
457
|
+
const result = entryPoint.endsWith(".js") ? await buildStyle(
|
|
458
|
+
path2.resolve(process.cwd(), projectId, entryPoint)
|
|
459
|
+
) : await buildSASS(entryPoint, {
|
|
450
460
|
canonicalize: (filePath) => filePath.startsWith("file://") ? new URL(filePath) : new URL(
|
|
451
461
|
"file://" + path2.resolve(
|
|
452
462
|
process.cwd(),
|
|
@@ -467,8 +477,14 @@ async function buildLocalProject(directory) {
|
|
|
467
477
|
const { errors } = JSON.parse(message);
|
|
468
478
|
if (errors.length) {
|
|
469
479
|
errors.forEach((e) => {
|
|
470
|
-
|
|
471
|
-
|
|
480
|
+
try {
|
|
481
|
+
console.log(
|
|
482
|
+
`${e.Location.File}#${e.Location.Line}`
|
|
483
|
+
);
|
|
484
|
+
console.log(e.Text + "\n");
|
|
485
|
+
} catch (_2) {
|
|
486
|
+
console.log(e);
|
|
487
|
+
}
|
|
472
488
|
});
|
|
473
489
|
reject();
|
|
474
490
|
} else {
|
|
@@ -563,11 +579,10 @@ import fs4 from "node:fs";
|
|
|
563
579
|
// src/tsconfig.ts
|
|
564
580
|
var compilerOptions = {
|
|
565
581
|
esModuleInterop: true,
|
|
566
|
-
module: "
|
|
567
|
-
target: "
|
|
582
|
+
module: "esnext",
|
|
583
|
+
target: "esnext",
|
|
568
584
|
moduleResolution: "bundler",
|
|
569
585
|
allowJs: true,
|
|
570
|
-
lib: ["dom", "dom.iterable", "es2023"],
|
|
571
586
|
jsx: "react",
|
|
572
587
|
typeRoots: ["../.fullstacked_modules/@types", "./node_modules/@types"]
|
|
573
588
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fullstacked",
|
|
3
|
-
"version": "0.12.2-
|
|
3
|
+
"version": "0.12.2-1407",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "node build.js",
|
|
6
6
|
"postbuild": "node build.js --binding",
|
|
@@ -13,14 +13,16 @@
|
|
|
13
13
|
"type": "module",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"cli-progress": "^3.12.0",
|
|
16
|
+
"jsdom": "^27.2.0",
|
|
16
17
|
"open": "^10.2.0",
|
|
17
18
|
"pretty-bytes": "^7.1.0",
|
|
18
|
-
"sass": "^1.
|
|
19
|
+
"sass": "^1.94.0",
|
|
19
20
|
"tar-stream": "^3.1.7",
|
|
20
21
|
"ws": "^8.18.3"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
24
|
"@types/cli-progress": "^3.11.6",
|
|
25
|
+
"@types/jsdom": "^27.0.0",
|
|
24
26
|
"@types/tar-stream": "^3.1.4",
|
|
25
27
|
"@types/ws": "^8.18.1",
|
|
26
28
|
"node-addon-api": "^8.5.0"
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
This file must follow the figma defined spacing components
|
|
3
|
-
https://www.figma.com/design/xb3JBRCvEWpbwGda03T5QQ/Mockups?node-id=6-49
|
|
4
|
-
*/
|
|
5
|
-
/*
|
|
6
|
-
This file must follow the figma local color styles
|
|
7
|
-
https://www.figma.com/design/xb3JBRCvEWpbwGda03T5QQ/Mockups
|
|
8
|
-
*/
|
|
9
|
-
/*
|
|
10
|
-
This file must follow the figma local text styles
|
|
11
|
-
https://www.figma.com/design/xb3JBRCvEWpbwGda03T5QQ/Mockups
|
|
12
|
-
*/
|
|
13
|
-
.snack-bars-container {
|
|
14
|
-
display: flex;
|
|
15
|
-
flex-direction: column;
|
|
16
|
-
gap: 10px;
|
|
17
|
-
position: fixed;
|
|
18
|
-
bottom: 0;
|
|
19
|
-
left: 0;
|
|
20
|
-
z-index: 100;
|
|
21
|
-
padding: 0 20px 20px;
|
|
22
|
-
align-items: flex-start;
|
|
23
|
-
width: 100%;
|
|
24
|
-
pointer-events: none;
|
|
25
|
-
text-align: left;
|
|
26
|
-
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
|
|
27
|
-
font-size: 16px;
|
|
28
|
-
max-width: 450px;
|
|
29
|
-
}
|
|
30
|
-
@media (max-width: 450px) {
|
|
31
|
-
.snack-bars-container {
|
|
32
|
-
align-items: center;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
.snack-bars-container .snack-bar {
|
|
36
|
-
pointer-events: all;
|
|
37
|
-
background-color: #404958;
|
|
38
|
-
border-radius: 5px;
|
|
39
|
-
color: #ffffff;
|
|
40
|
-
min-height: 42px;
|
|
41
|
-
max-width: 100%;
|
|
42
|
-
width: max-content;
|
|
43
|
-
display: flex;
|
|
44
|
-
align-items: center;
|
|
45
|
-
justify-content: space-between;
|
|
46
|
-
gap: 10px;
|
|
47
|
-
padding: 5px 10px;
|
|
48
|
-
box-shadow: 0px 4px 10px rgba(21, 23, 27, 0.6);
|
|
49
|
-
}
|
|
50
|
-
.snack-bars-container .snack-bar > div:first-child {
|
|
51
|
-
padding: 5px 0;
|
|
52
|
-
width: 100%;
|
|
53
|
-
overflow-wrap: break-word;
|
|
54
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
@use "../../node_modules/@fullstacked/ui/values/spacing.scss";
|
|
2
|
-
@use "../../node_modules/@fullstacked/ui/values/colors.scss";
|
|
3
|
-
@use "../../node_modules/@fullstacked/ui/values/typography.scss";
|
|
4
|
-
|
|
5
|
-
.snack-bars-container {
|
|
6
|
-
display: flex;
|
|
7
|
-
flex-direction: column;
|
|
8
|
-
gap: spacing.$small;
|
|
9
|
-
position: fixed;
|
|
10
|
-
bottom: 0;
|
|
11
|
-
left: 0;
|
|
12
|
-
z-index: 100;
|
|
13
|
-
padding: 0 spacing.$medium spacing.$medium;
|
|
14
|
-
align-items: flex-start;
|
|
15
|
-
width: 100%;
|
|
16
|
-
pointer-events: none;
|
|
17
|
-
text-align: left;
|
|
18
|
-
font-family: typography.$fonts;
|
|
19
|
-
font-size: typography.$medium;
|
|
20
|
-
|
|
21
|
-
max-width: 450px;
|
|
22
|
-
@media (max-width: 450px) {
|
|
23
|
-
align-items: center;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.snack-bar {
|
|
27
|
-
pointer-events: all;
|
|
28
|
-
|
|
29
|
-
background-color: colors.$gray-dark;
|
|
30
|
-
border-radius: spacing.$x-small;
|
|
31
|
-
color: colors.$light;
|
|
32
|
-
|
|
33
|
-
min-height: 42px;
|
|
34
|
-
max-width: 100%;
|
|
35
|
-
width: max-content;
|
|
36
|
-
|
|
37
|
-
display: flex;
|
|
38
|
-
align-items: center;
|
|
39
|
-
justify-content: space-between;
|
|
40
|
-
gap: spacing.$small;
|
|
41
|
-
|
|
42
|
-
padding: spacing.$x-small spacing.$small;
|
|
43
|
-
|
|
44
|
-
box-shadow: 0px 4px 10px colors.opacity(colors.$dark, 60);
|
|
45
|
-
|
|
46
|
-
> div:first-child {
|
|
47
|
-
padding: spacing.$x-small 0;
|
|
48
|
-
width: 100%;
|
|
49
|
-
overflow-wrap: break-word;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|