onejs-core 3.0.4 → 3.0.5

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/bin/oj.js CHANGED
@@ -1,254 +1,254 @@
1
1
  #!/usr/bin/env node
2
- /* eslint-disable no-console */
3
- "use strict"
4
-
5
- /*
6
- * OneJS – oj (shadcn-style) CLI
7
- * A small utility for listing / installing premade UI components
8
- * shipped inside a <Assets/> Unity project folder.
9
- *
10
- * Commands:
11
- * oj list – show available components inside tarball
12
- * oj add <name … | all> – install one or many components
13
- * oj doctor – verify environment (Assets folder + tarball)
14
- *
15
- * Global flags:
16
- * -y, --yes, --force – skip overwrite prompts
17
- * --dry – dry-run (no filesystem writes)
18
- * --assets-dir <dir> – override Assets directory auto-detection
19
- * --tarball <file> – override tarball filename (default premade-uis.tgz.bytes)
20
- */
21
-
22
- const fs = require("fs")
23
- const path = require("path")
24
- const readline = require("readline")
25
- const tar = require("tar")
26
- const { Command } = require("commander")
27
- const chalk = require("chalk")
28
- const ora = require("ora")
29
-
30
- const pkg = require("../package.json")
31
-
32
- /* ─────────────────────────────── utils ─────────────────────────────── */
33
-
34
- function findAssetsDir(startDir, explicit) {
35
- if (explicit) {
36
- if (fs.existsSync(explicit) && fs.statSync(explicit).isDirectory()) return explicit
37
- return null
38
- }
39
- let dir = path.dirname(startDir) // Up a level, preventing `App/assets` getting returned
40
- const { root } = path.parse(dir)
41
- while (dir !== root) {
42
- const probe = path.join(dir, "Assets")
43
- if (fs.existsSync(probe) && fs.statSync(probe).isDirectory()) return probe
44
- dir = path.dirname(dir)
45
- }
46
- return null
47
- }
48
-
49
- function findTarball(assetsDir, tarballName) {
50
- const stack = [assetsDir]
51
- while (stack.length) {
52
- const curr = stack.pop()
53
- for (const e of fs.readdirSync(curr, { withFileTypes: true })) {
54
- const p = path.join(curr, e.name)
55
- if (e.isDirectory()) {
56
- stack.push(p)
57
- } else if (e.isFile() && e.name === tarballName) {
58
- return p
59
- }
60
- }
61
- }
62
- return null
63
- }
64
-
65
- async function askYN(prompt) {
66
- return new Promise((resolve) => {
67
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout })
68
- rl.question(`${prompt} ${chalk.dim("[y/N]")} `, (ans) => {
69
- rl.close()
70
- resolve(/^(y|yes)$/i.test(ans.trim()))
71
- })
72
- })
73
- }
74
-
75
- /**
76
- * Return Set of top-level component folders inside tarball.
77
- */
78
- async function scanComponents(tarPath) {
79
- const comps = new Set()
80
- await tar.t({
81
- file: tarPath,
82
- onentry: (entry) => {
83
- const p = entry.path.replace(/\\/g, "/")
84
- if (!p.startsWith("comps/")) return
85
-
86
- // Only treat entries inside a top-level folder under comps/
87
- // e.g. "comps/button/**" → "button"
88
- const rest = p.slice("comps/".length)
89
- const firstSlash = rest.indexOf("/")
90
- if (firstSlash === -1) return // file directly under comps/ → skip
91
-
92
- const top = rest.slice(0, firstSlash)
93
- if (top) comps.add(top)
94
- },
95
- })
96
- return comps
97
- }
98
-
99
- /* ─────────────────────────────── commander ─────────────────────────────── */
100
-
101
- const program = new Command()
102
-
103
- program
104
- .name("oj")
105
- .description("OneJS premade UI component manager")
106
- .version(pkg.version, "-v, --version", "print version")
107
-
108
- program
109
- .hook("preAction", (thisCmd, actionCmd) => {
110
- // Collect global opts and attach to actionCmd for convenience
111
- actionCmd._globalOpts = {
112
- yes: thisCmd.opts().yes || thisCmd.opts().force,
113
- dry: thisCmd.opts().dry,
114
- assetsDir: thisCmd.opts().assetsDir,
115
- tarballName: thisCmd.opts().tarball || "premade-uis.tgz.bytes",
116
- }
117
- })
118
- .option("-y, --yes", "skip confirmation prompts")
119
- .option("--force", "alias for --yes")
120
- .option("--dry", "dry-run – show actions only")
121
- .option("--assets-dir <dir>", "override Assets/ directory")
122
- .option("--tarball <file>", "override tarball filename (default premade-uis.tgz.bytes)")
123
-
124
- /* ─────────────────────────────── list ─────────────────────────────── */
125
-
126
- program
127
- .command("list")
128
- .description("list available components inside the tarball")
129
- .action(async function () {
130
- const { assetsDir, tarballName } = this._globalOpts
131
- const assets = findAssetsDir(process.cwd(), assetsDir) || findAssetsDir(__dirname, assetsDir)
132
- if (!assets) {
133
- console.error(chalk.red("Assets/ folder not found. Are you inside a Unity project?"))
134
- process.exit(1)
135
- }
136
- const tarPath = findTarball(assets, tarballName)
137
- if (!tarPath) {
138
- console.error(
139
- chalk.red(`Tarball '${tarballName}' not found under Assets/. Did you import the OneJS package?`)
140
- )
141
- process.exit(1)
142
- }
143
- const comps = await scanComponents(tarPath)
144
- console.log(chalk.bold(`Components in ${path.relative(process.cwd(), tarPath)}:`))
145
- comps.forEach((c) => console.log(" •", chalk.cyan(c)))
146
- })
147
-
148
- /* ─────────────────────────────── doctor ─────────────────────────────── */
149
-
150
- program
151
- .command("doctor")
152
- .description("check Assets directory and tarball presence")
153
- .action(async function () {
154
- const { assetsDir, tarballName } = this._globalOpts
155
- const spinner = ora("Checking environment").start()
156
- const assets = findAssetsDir(process.cwd(), assetsDir) || findAssetsDir(__dirname, assetsDir)
157
- if (!assets) {
158
- spinner.fail("Assets/ folder not found")
159
- process.exit(1)
160
- }
161
- const tarPath = findTarball(assets, tarballName)
162
- if (!tarPath) {
163
- spinner.fail(`Tarball '${tarballName}' not found under Assets/`)
164
- process.exit(1)
165
- }
166
- spinner.succeed("Environment OK")
167
- console.log(`Assets folder : ${chalk.green(path.relative(process.cwd(), assets))}`)
168
- console.log(`Tarball : ${chalk.green(path.relative(process.cwd(), tarPath))}`)
169
- })
170
-
171
- /* ─────────────────────────────── add ─────────────────────────────── */
172
-
173
- program
174
- .command("add")
175
- .argument("<names...>", "component names to add, or 'all'")
176
- .description("add components into ./comps")
177
- .action(async function (names) {
178
- const { yes, dry, assetsDir, tarballName } = this._globalOpts
179
- const spinner = ora("Preparing").start()
180
-
181
- const assets = findAssetsDir(process.cwd(), assetsDir) || findAssetsDir(__dirname, assetsDir)
182
- if (!assets) {
183
- spinner.fail("Assets/ folder not found")
184
- process.exit(1)
185
- }
186
- const tarPath = findTarball(assets, tarballName)
187
- if (!tarPath) {
188
- spinner.fail(`Tarball '${tarballName}' not found`)
189
- process.exit(1)
190
- }
191
-
192
- const allComps = await scanComponents(tarPath)
193
- const targetAll = names.length === 1 && names[0] === "all"
194
- const targets = targetAll ? Array.from(allComps) : names
195
-
196
- // validate unknown comps
197
- const unknown = targets.filter((c) => !allComps.has(c))
198
- if (unknown.length) {
199
- spinner.fail(`Unknown component(s): ${unknown.join(", ")}`)
200
- process.exit(1)
201
- }
202
-
203
- const cwd = process.cwd()
204
- const compsRoot = path.join(cwd, "comps")
205
- fs.mkdirSync(compsRoot, { recursive: true })
206
-
207
- // conflict detect
208
- const NO_PROMPT = new Set(["LICENSE"])
209
- const conflicts = targets.filter(
210
- (comp) => !NO_PROMPT.has(comp) && fs.existsSync(path.join(compsRoot, comp))
211
- )
212
- spinner.stop()
213
-
214
- if (conflicts.length && !yes) {
215
- for (const c of conflicts) {
216
- const ok = await askYN(
217
- `Overwrite existing ${chalk.yellow(`comps/${c}`)}? (backup your changes first)`
218
- )
219
- if (!ok) {
220
- console.log(chalk.yellow("Aborted."))
221
- process.exit(0)
222
- }
223
- }
224
- }
225
-
226
- if (dry) {
227
- console.log(chalk.green("Dry-run: would install"), targets.join(", "))
228
- process.exit(0)
229
- }
230
-
231
- const extractSpinner = ora("Extracting components").start()
232
-
233
- const filter = (p) => {
234
- if (!p.startsWith("comps/")) return false
235
- const [, comp] = p.split("/")
236
- return targetAll || targets.includes(comp)
237
- }
238
-
239
- try {
240
- await tar.x({ file: tarPath, cwd, gzip: true, filter })
241
- extractSpinner.succeed("Done.")
242
- } catch (err) {
243
- extractSpinner.fail("Extraction failed")
244
- console.error(err)
245
- process.exit(1)
246
- }
247
- })
248
-
249
- /* ─────────────────────────────── go ─────────────────────────────── */
250
-
251
- program.parseAsync().catch((err) => {
252
- console.error(err)
253
- process.exit(1)
2
+ /* eslint-disable no-console */
3
+ "use strict"
4
+
5
+ /*
6
+ * OneJS – oj (shadcn-style) CLI
7
+ * A small utility for listing / installing premade UI components
8
+ * shipped inside a <Assets/> Unity project folder.
9
+ *
10
+ * Commands:
11
+ * oj list – show available components inside tarball
12
+ * oj add <name … | all> – install one or many components
13
+ * oj doctor – verify environment (Assets folder + tarball)
14
+ *
15
+ * Global flags:
16
+ * -y, --yes, --force – skip overwrite prompts
17
+ * --dry – dry-run (no filesystem writes)
18
+ * --assets-dir <dir> – override Assets directory auto-detection
19
+ * --tarball <file> – override tarball filename (default premade-uis.tgz.bytes)
20
+ */
21
+
22
+ const fs = require("fs")
23
+ const path = require("path")
24
+ const readline = require("readline")
25
+ const tar = require("tar")
26
+ const { Command } = require("commander")
27
+ const chalk = require("chalk")
28
+ const ora = require("ora")
29
+
30
+ const pkg = require("../package.json")
31
+
32
+ /* ─────────────────────────────── utils ─────────────────────────────── */
33
+
34
+ function findAssetsDir(startDir, explicit) {
35
+ if (explicit) {
36
+ if (fs.existsSync(explicit) && fs.statSync(explicit).isDirectory()) return explicit
37
+ return null
38
+ }
39
+ let dir = path.dirname(startDir) // Up a level, preventing `App/assets` getting returned
40
+ const { root } = path.parse(dir)
41
+ while (dir !== root) {
42
+ const probe = path.join(dir, "Assets")
43
+ if (fs.existsSync(probe) && fs.statSync(probe).isDirectory()) return probe
44
+ dir = path.dirname(dir)
45
+ }
46
+ return null
47
+ }
48
+
49
+ function findTarball(assetsDir, tarballName) {
50
+ const stack = [assetsDir]
51
+ while (stack.length) {
52
+ const curr = stack.pop()
53
+ for (const e of fs.readdirSync(curr, { withFileTypes: true })) {
54
+ const p = path.join(curr, e.name)
55
+ if (e.isDirectory()) {
56
+ stack.push(p)
57
+ } else if (e.isFile() && e.name === tarballName) {
58
+ return p
59
+ }
60
+ }
61
+ }
62
+ return null
63
+ }
64
+
65
+ async function askYN(prompt) {
66
+ return new Promise((resolve) => {
67
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout })
68
+ rl.question(`${prompt} ${chalk.dim("[y/N]")} `, (ans) => {
69
+ rl.close()
70
+ resolve(/^(y|yes)$/i.test(ans.trim()))
71
+ })
72
+ })
73
+ }
74
+
75
+ /**
76
+ * Return Set of top-level component folders inside tarball.
77
+ */
78
+ async function scanComponents(tarPath) {
79
+ const comps = new Set()
80
+ await tar.t({
81
+ file: tarPath,
82
+ onentry: (entry) => {
83
+ const p = entry.path.replace(/\\/g, "/")
84
+ if (!p.startsWith("comps/")) return
85
+
86
+ // Only treat entries inside a top-level folder under comps/
87
+ // e.g. "comps/button/**" → "button"
88
+ const rest = p.slice("comps/".length)
89
+ const firstSlash = rest.indexOf("/")
90
+ if (firstSlash === -1) return // file directly under comps/ → skip
91
+
92
+ const top = rest.slice(0, firstSlash)
93
+ if (top) comps.add(top)
94
+ },
95
+ })
96
+ return comps
97
+ }
98
+
99
+ /* ─────────────────────────────── commander ─────────────────────────────── */
100
+
101
+ const program = new Command()
102
+
103
+ program
104
+ .name("oj")
105
+ .description("OneJS premade UI component manager")
106
+ .version(pkg.version, "-v, --version", "print version")
107
+
108
+ program
109
+ .hook("preAction", (thisCmd, actionCmd) => {
110
+ // Collect global opts and attach to actionCmd for convenience
111
+ actionCmd._globalOpts = {
112
+ yes: thisCmd.opts().yes || thisCmd.opts().force,
113
+ dry: thisCmd.opts().dry,
114
+ assetsDir: thisCmd.opts().assetsDir,
115
+ tarballName: thisCmd.opts().tarball || "premade-uis.tgz.bytes",
116
+ }
117
+ })
118
+ .option("-y, --yes", "skip confirmation prompts")
119
+ .option("--force", "alias for --yes")
120
+ .option("--dry", "dry-run – show actions only")
121
+ .option("--assets-dir <dir>", "override Assets/ directory")
122
+ .option("--tarball <file>", "override tarball filename (default premade-uis.tgz.bytes)")
123
+
124
+ /* ─────────────────────────────── list ─────────────────────────────── */
125
+
126
+ program
127
+ .command("list")
128
+ .description("list available components inside the tarball")
129
+ .action(async function () {
130
+ const { assetsDir, tarballName } = this._globalOpts
131
+ const assets = findAssetsDir(process.cwd(), assetsDir) || findAssetsDir(__dirname, assetsDir)
132
+ if (!assets) {
133
+ console.error(chalk.red("Assets/ folder not found. Are you inside a Unity project?"))
134
+ process.exit(1)
135
+ }
136
+ const tarPath = findTarball(assets, tarballName)
137
+ if (!tarPath) {
138
+ console.error(
139
+ chalk.red(`Tarball '${tarballName}' not found under Assets/. Did you import the OneJS package?`)
140
+ )
141
+ process.exit(1)
142
+ }
143
+ const comps = await scanComponents(tarPath)
144
+ console.log(chalk.bold(`Components in ${path.relative(process.cwd(), tarPath)}:`))
145
+ comps.forEach((c) => console.log(" •", chalk.cyan(c)))
146
+ })
147
+
148
+ /* ─────────────────────────────── doctor ─────────────────────────────── */
149
+
150
+ program
151
+ .command("doctor")
152
+ .description("check Assets directory and tarball presence")
153
+ .action(async function () {
154
+ const { assetsDir, tarballName } = this._globalOpts
155
+ const spinner = ora("Checking environment").start()
156
+ const assets = findAssetsDir(process.cwd(), assetsDir) || findAssetsDir(__dirname, assetsDir)
157
+ if (!assets) {
158
+ spinner.fail("Assets/ folder not found")
159
+ process.exit(1)
160
+ }
161
+ const tarPath = findTarball(assets, tarballName)
162
+ if (!tarPath) {
163
+ spinner.fail(`Tarball '${tarballName}' not found under Assets/`)
164
+ process.exit(1)
165
+ }
166
+ spinner.succeed("Environment OK")
167
+ console.log(`Assets folder : ${chalk.green(path.relative(process.cwd(), assets))}`)
168
+ console.log(`Tarball : ${chalk.green(path.relative(process.cwd(), tarPath))}`)
169
+ })
170
+
171
+ /* ─────────────────────────────── add ─────────────────────────────── */
172
+
173
+ program
174
+ .command("add")
175
+ .argument("<names...>", "component names to add, or 'all'")
176
+ .description("add components into ./comps")
177
+ .action(async function (names) {
178
+ const { yes, dry, assetsDir, tarballName } = this._globalOpts
179
+ const spinner = ora("Preparing").start()
180
+
181
+ const assets = findAssetsDir(process.cwd(), assetsDir) || findAssetsDir(__dirname, assetsDir)
182
+ if (!assets) {
183
+ spinner.fail("Assets/ folder not found")
184
+ process.exit(1)
185
+ }
186
+ const tarPath = findTarball(assets, tarballName)
187
+ if (!tarPath) {
188
+ spinner.fail(`Tarball '${tarballName}' not found`)
189
+ process.exit(1)
190
+ }
191
+
192
+ const allComps = await scanComponents(tarPath)
193
+ const targetAll = names.length === 1 && names[0] === "all"
194
+ const targets = targetAll ? Array.from(allComps) : names
195
+
196
+ // validate unknown comps
197
+ const unknown = targets.filter((c) => !allComps.has(c))
198
+ if (unknown.length) {
199
+ spinner.fail(`Unknown component(s): ${unknown.join(", ")}`)
200
+ process.exit(1)
201
+ }
202
+
203
+ const cwd = process.cwd()
204
+ const compsRoot = path.join(cwd, "comps")
205
+ fs.mkdirSync(compsRoot, { recursive: true })
206
+
207
+ // conflict detect
208
+ const NO_PROMPT = new Set(["LICENSE"])
209
+ const conflicts = targets.filter(
210
+ (comp) => !NO_PROMPT.has(comp) && fs.existsSync(path.join(compsRoot, comp))
211
+ )
212
+ spinner.stop()
213
+
214
+ if (conflicts.length && !yes) {
215
+ for (const c of conflicts) {
216
+ const ok = await askYN(
217
+ `Overwrite existing ${chalk.yellow(`comps/${c}`)}? (backup your changes first)`
218
+ )
219
+ if (!ok) {
220
+ console.log(chalk.yellow("Aborted."))
221
+ process.exit(0)
222
+ }
223
+ }
224
+ }
225
+
226
+ if (dry) {
227
+ console.log(chalk.green("Dry-run: would install"), targets.join(", "))
228
+ process.exit(0)
229
+ }
230
+
231
+ const extractSpinner = ora("Extracting components").start()
232
+
233
+ const filter = (p) => {
234
+ if (!p.startsWith("comps/")) return false
235
+ const [, comp] = p.split("/")
236
+ return targetAll || targets.includes(comp)
237
+ }
238
+
239
+ try {
240
+ await tar.x({ file: tarPath, cwd, gzip: true, filter })
241
+ extractSpinner.succeed("Done.")
242
+ } catch (err) {
243
+ extractSpinner.fail("Extraction failed")
244
+ console.error(err)
245
+ process.exit(1)
246
+ }
247
+ })
248
+
249
+ /* ─────────────────────────────── go ─────────────────────────────── */
250
+
251
+ program.parseAsync().catch((err) => {
252
+ console.error(err)
253
+ process.exit(1)
254
254
  })
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "onejs-core",
3
3
  "description": "The JS part of OneJS, a UI framework and Scripting Engine for Unity.",
4
- "version": "3.0.4",
4
+ "version": "3.0.5",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/Singtaa/onejs-core"
@@ -16,16 +16,17 @@
16
16
  "commander": "^11.0.0",
17
17
  "css-flatten": "^2.0.0",
18
18
  "css-simple-parser": "^3.0.0",
19
+ "fs-extra": "^11.2.0",
19
20
  "ora": "^5.4.1",
20
21
  "progress": "^2.0.3",
22
+ "rimraf": "^5.0.7",
21
23
  "tar": "^7.2.0"
22
24
  },
23
25
  "devDependencies": {
24
26
  "esbuild": "^0.20.0",
25
- "fs-extra": "^11.2.0",
26
27
  "postcss": "^8.4.38",
27
28
  "postcss-cli": "^11.0.0",
28
- "rimraf": "^5.0.7",
29
+ "postcss-import": "^16.1.1",
29
30
  "tailwindcss": "^3.4.17",
30
31
  "tiny-glob": "^0.2.9",
31
32
  "xml2js": "^0.6.2"
@@ -147,12 +147,43 @@ async function getOneJSUnityDir() {
147
147
  }
148
148
  }
149
149
 
150
+ // Step 4: Check for embedded packages in Packages/ directory
151
+ const packagesDir = path.join(projectDir, 'Packages')
152
+ if (fs.existsSync(packagesDir)) {
153
+ for (const key of oneJSKeys) {
154
+ const embeddedPath = path.join(packagesDir, key)
155
+ if (fs.existsSync(embeddedPath) && fs.statSync(embeddedPath).isDirectory()) {
156
+ return embeddedPath
157
+ }
158
+ }
159
+ }
160
+
161
+ // Step 5: Parse .csproj to find OneJS path (handles packages in Assets/)
162
+ const csprojPath = path.join(projectDir, 'OneJS.Runtime.csproj')
163
+ if (fs.existsSync(csprojPath)) {
164
+ try {
165
+ const content = fs.readFileSync(csprojPath, 'utf8')
166
+ const match = content.match(/Include="([^"]*?[/\\]Runtime[/\\]Engine[/\\]ScriptEngine\.cs)"/)
167
+ if (match) {
168
+ const includePath = match[1].replace(/\\/g, '/')
169
+ const idx = includePath.indexOf('/Runtime/Engine/ScriptEngine.cs')
170
+ if (idx !== -1) {
171
+ return path.resolve(projectDir, includePath.substring(0, idx))
172
+ }
173
+ }
174
+ } catch (err) {
175
+ // .csproj not readable, skip
176
+ }
177
+ }
178
+
150
179
  console.error(
151
180
  'Could not find OneJS package directory.\n' +
152
181
  'Please make sure OneJS is installed in your Unity project via one of:\n' +
153
182
  ' - A local path (file:) dependency in Packages/manifest.json\n' +
154
183
  ' - A Git URL dependency in Packages/manifest.json\n' +
155
184
  ' - The Unity Package Manager registry\n' +
185
+ ' - An embedded package in the Packages/ directory\n' +
186
+ ' - A package in the Assets/ directory (requires Unity to generate .csproj files)\n' +
156
187
  'And that this script is run from the OneJS npm project inside the Unity project.'
157
188
  )
158
189
  return null
@@ -1,3 +0,0 @@
1
- export declare function newArray<T>(type: {
2
- new (): T;
3
- }, count: any): CS.System.Array;
@@ -1,3 +0,0 @@
1
- export function newArray(type, count) {
2
- return CS.System.Array.CreateInstance(puer.$typeof(type), count);
3
- }
File without changes
File without changes
@@ -1,4 +0,0 @@
1
- export type Breakpoint = "base" | "xs" | "sm" | "md" | "lg" | "xl";
2
- export type Responsive = number | Partial<Record<Breakpoint, number>>;
3
- /** Pick the right value for the current width. */
4
- export declare function resolveResponsive<T>(val: Responsive, w?: number): number;
@@ -1,23 +0,0 @@
1
- const BP = {
2
- xs: 480,
3
- sm: 640,
4
- md: 768,
5
- lg: 1024,
6
- xl: 1280,
7
- };
8
- /** Current viewport width (UI Toolkit) */
9
- const getWidth = () => document.body.ve.resolvedStyle.width;
10
- /** Pick the right value for the current width. */
11
- export function resolveResponsive(val, w = getWidth()) {
12
- if (typeof val !== "object")
13
- return val;
14
- let picked = val.base;
15
- for (const [bp, px] of Object.entries(BP)) {
16
- if (w >= px && val[bp] !== undefined)
17
- picked = val[bp];
18
- }
19
- setTimeout(() => {
20
- console.log(CS.UnityEngine.Screen.dpi);
21
- }, 1);
22
- return picked;
23
- }
@@ -1 +0,0 @@
1
- export declare function toJsArray(csArr: any): any[];
@@ -1,10 +0,0 @@
1
- export function toJsArray(csArr) {
2
- if (!csArr)
3
- return [];
4
- let arr = new Array(csArr.Length);
5
- var i = csArr.Length;
6
- while (i--) {
7
- arr[i] = csArr.get_Item(i);
8
- }
9
- return arr;
10
- }