@valbuild/ui 0.22.0 → 0.23.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.
@@ -69352,11 +69352,6 @@ Showing stack trace of: 0. ${fatalErrors[0].message}`;
69352
69352
  );
69353
69353
  }, [pathFromParams]);
69354
69354
  const [hmrHash, setHmrHash] = React$3.useState(null);
69355
- React$3.useEffect(() => {
69356
- if (modules) {
69357
- console.log("->", hmrHash);
69358
- }
69359
- }, [modules]);
69360
69355
  React$3.useEffect(() => {
69361
69356
  try {
69362
69357
  const hot = new WebSocket(
@@ -70517,7 +70512,7 @@ function KeyOfField({
70517
70512
  };
70518
70513
  };
70519
70514
  const typeAndValues = getValuesFromModule(valModule);
70520
- const [value, setValue] = React$3.useState(defaultValue || typeAndValues.values[0]);
70515
+ const [value, setValue] = React$3.useState(defaultValue ?? typeAndValues.values[0]);
70521
70516
  const [loading, setLoading] = React$3.useState(false);
70522
70517
  React$3.useEffect(() => {
70523
70518
  setLoading(disabled);
@@ -70558,7 +70553,7 @@ function KeyOfField({
70558
70553
  },
70559
70554
  children: [
70560
70555
  /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: "Select a value" }) }),
70561
- /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: typeAndValues.values.map((value2) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: value2.toString(), children: value2 }, value2)) })
70556
+ /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: typeAndValues.values.map((value2) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: value2.toString(), children: value2.toString() }, value2)) })
70562
70557
  ]
70563
70558
  }
70564
70559
  ),
@@ -69334,11 +69334,6 @@ Showing stack trace of: 0. ${fatalErrors[0].message}`;
69334
69334
  );
69335
69335
  }, [pathFromParams]);
69336
69336
  const [hmrHash, setHmrHash] = useState(null);
69337
- useEffect(() => {
69338
- if (modules) {
69339
- console.log("->", hmrHash);
69340
- }
69341
- }, [modules]);
69342
69337
  useEffect(() => {
69343
69338
  try {
69344
69339
  const hot = new WebSocket(
@@ -70499,7 +70494,7 @@ function KeyOfField({
70499
70494
  };
70500
70495
  };
70501
70496
  const typeAndValues = getValuesFromModule(valModule);
70502
- const [value, setValue] = useState(defaultValue || typeAndValues.values[0]);
70497
+ const [value, setValue] = useState(defaultValue ?? typeAndValues.values[0]);
70503
70498
  const [loading, setLoading] = useState(false);
70504
70499
  useEffect(() => {
70505
70500
  setLoading(disabled);
@@ -70540,7 +70535,7 @@ function KeyOfField({
70540
70535
  },
70541
70536
  children: [
70542
70537
  /* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select a value" }) }),
70543
- /* @__PURE__ */ jsx(SelectContent, { children: typeAndValues.values.map((value2) => /* @__PURE__ */ jsx(SelectItem, { value: value2.toString(), children: value2 }, value2)) })
70538
+ /* @__PURE__ */ jsx(SelectContent, { children: typeAndValues.values.map((value2) => /* @__PURE__ */ jsx(SelectItem, { value: value2.toString(), children: value2.toString() }, value2)) })
70544
70539
  ]
70545
70540
  }
70546
70541
  ),
@@ -9,27 +9,38 @@ const serverFiles = [
9
9
  "server/dist/valbuild-ui-server.esm.js",
10
10
  "server/dist/valbuild-ui-server.cjs.js",
11
11
  ];
12
- const inputFile = "server/.tmp/index.js";
12
+ const inputDir = "server/.tmp";
13
+ function walk(dir) {
14
+ return fs.readdirSync(dir).reduce((files, fileOrDirName) => {
15
+ const fileOrDirPath = path.join(dir, fileOrDirName);
16
+ if (fs.statSync(fileOrDirPath).isDirectory()) {
17
+ return {
18
+ ...files,
19
+ ...walk(fileOrDirPath),
20
+ };
21
+ }
22
+ const fileContent = fs.readFileSync(fileOrDirPath, "utf-8");
23
+ const encodedContent = Buffer.from(fileContent).toString("base64");
24
+ return {
25
+ ...files,
26
+ [fileOrDirPath.replace(inputDir, "")]: encodedContent,
27
+ };
28
+ }, {});
29
+ }
30
+
31
+ const files = walk(inputDir);
32
+ const stringifiedFiles = JSON.stringify(files);
13
33
 
14
34
  for (const serverFile of serverFiles) {
15
35
  const filePath = path.join(__dirname, serverFile);
16
- const replaceString = "/**REPLACE:SCRIPT*/";
17
- const fileToEncodePath = path.join(__dirname, inputFile);
18
-
19
- // Read the contents of the file to be encoded
20
- const fileToEncodeContent = fs.readFileSync(fileToEncodePath, "utf-8");
21
-
22
- // Encode the file contents to base64
23
- const encodedContent = Buffer.from(fileToEncodeContent).toString("base64");
24
-
25
- // Read the main file and replace the placeholder string
36
+ const replaceString = "BUILD_REPLACE_THIS_WITH_RECORD";
26
37
  fs.readFile(filePath, "utf-8", (err, data) => {
27
38
  if (err) {
28
39
  console.error("Error reading file:", err);
29
40
  return;
30
41
  }
31
42
 
32
- const result = data.replace(replaceString, encodedContent);
43
+ const result = data.replace(replaceString, stringifiedFiles);
33
44
 
34
45
  // Write the modified content back to the file
35
46
  fs.writeFile(filePath, result, "utf-8", (err) => {
@@ -37,9 +48,7 @@ for (const serverFile of serverFiles) {
37
48
  console.error("Error writing file:", err);
38
49
  return;
39
50
  }
40
- console.log(
41
- `Replaced script in ${serverFile} with contents of ${inputFile}!`
42
- );
51
+ console.log(`Replaced script in ${serverFile} with contents of build!`);
43
52
  });
44
53
  });
45
54
  }
@@ -2,10 +2,8 @@ import { defineConfig } from "vite";
2
2
 
3
3
  // https://vitejs.dev/config/
4
4
  export default defineConfig({
5
+ base: "/api/val/static", // TODO: needs to be configurable
5
6
  build: {
6
7
  outDir: "./server/.tmp",
7
- rollupOptions: {
8
- output: { entryFileNames: "[name].js" },
9
- },
10
8
  },
11
9
  });
package/index.html CHANGED
@@ -2,12 +2,11 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
- <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>Vite + React</title>
6
+ <title>Val</title>
7
+ <script type="module" src="/src/main.jsx"></script>
8
8
  </head>
9
9
  <body>
10
10
  <div id="root"></div>
11
- <script type="module" src="/src/main.jsx"></script>
12
11
  </body>
13
12
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/ui",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "sideEffects": false,
5
5
  "scripts": {
6
6
  "typecheck": "tsc --noEmit",
@@ -35,7 +35,7 @@
35
35
  "@radix-ui/react-tooltip": "^1.0.7",
36
36
  "@types/express": "^4.17.17",
37
37
  "@types/react": "^18.0.26",
38
- "@valbuild/core": "~0.22.0",
38
+ "@valbuild/core": "~0.23.0",
39
39
  "class-variance-authority": "^0.7.0",
40
40
  "classnames": "^2.3.2",
41
41
  "clsx": "^2.0.0",
@@ -68337,7 +68337,7 @@ function KeyOfField({
68337
68337
  };
68338
68338
  };
68339
68339
  const typeAndValues = getValuesFromModule(valModule);
68340
- const [value, setValue] = reactExports.useState(defaultValue || typeAndValues.values[0]);
68340
+ const [value, setValue] = reactExports.useState(defaultValue ?? typeAndValues.values[0]);
68341
68341
  const [loading, setLoading] = reactExports.useState(false);
68342
68342
  reactExports.useEffect(() => {
68343
68343
  setLoading(disabled);
@@ -68378,7 +68378,7 @@ function KeyOfField({
68378
68378
  },
68379
68379
  children: [
68380
68380
  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select a value" }) }),
68381
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectContent, { children: typeAndValues.values.map((value2) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: value2.toString(), children: value2 }, value2)) })
68381
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectContent, { children: typeAndValues.values.map((value2) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: value2.toString(), children: value2.toString() }, value2)) })
68382
68382
  ]
68383
68383
  }
68384
68384
  ),
@@ -72248,11 +72248,6 @@ Showing stack trace of: 0. ${fatalErrors[0].message}`;
72248
72248
  );
72249
72249
  }, [pathFromParams]);
72250
72250
  const [hmrHash, setHmrHash] = reactExports.useState(null);
72251
- reactExports.useEffect(() => {
72252
- if (modules) {
72253
- console.log("->", hmrHash);
72254
- }
72255
- }, [modules]);
72256
72251
  reactExports.useEffect(() => {
72257
72252
  try {
72258
72253
  const hot = new WebSocket(
@@ -68338,7 +68338,7 @@ function KeyOfField({
68338
68338
  };
68339
68339
  };
68340
68340
  const typeAndValues = getValuesFromModule(valModule);
68341
- const [value, setValue] = reactExports.useState(defaultValue || typeAndValues.values[0]);
68341
+ const [value, setValue] = reactExports.useState(defaultValue ?? typeAndValues.values[0]);
68342
68342
  const [loading, setLoading] = reactExports.useState(false);
68343
68343
  reactExports.useEffect(() => {
68344
68344
  setLoading(disabled);
@@ -68379,7 +68379,7 @@ function KeyOfField({
68379
68379
  },
68380
68380
  children: [
68381
68381
  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select a value" }) }),
68382
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectContent, { children: typeAndValues.values.map((value2) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: value2.toString(), children: value2 }, value2)) })
68382
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectContent, { children: typeAndValues.values.map((value2) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: value2.toString(), children: value2.toString() }, value2)) })
68383
68383
  ]
68384
68384
  }
68385
68385
  ),
@@ -72249,11 +72249,6 @@ Showing stack trace of: 0. ${fatalErrors[0].message}`;
72249
72249
  );
72250
72250
  }, [pathFromParams]);
72251
72251
  const [hmrHash, setHmrHash] = reactExports.useState(null);
72252
- reactExports.useEffect(() => {
72253
- if (modules) {
72254
- console.log("->", hmrHash);
72255
- }
72256
- }, [modules]);
72257
72252
  reactExports.useEffect(() => {
72258
72253
  try {
72259
72254
  const hot = new WebSocket(