dazscript-framework 1.0.18 → 1.0.20
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
CHANGED
|
@@ -175,7 +175,7 @@ npx dazscript init --menu-path /MyScripts --scripts-path ./src --out-dir ./out -
|
|
|
175
175
|
| `--out-dir` | Where `build` writes `.dsa` files and copies icons |
|
|
176
176
|
| `--app-data-path` | AppData namespace for launcher fallback (`Author/Product` format) |
|
|
177
177
|
|
|
178
|
-
Builds also accept `--log-level <trace|debug|info|warn|error|off>`. This sets the minimum runtime log level for the compiled scripts.
|
|
178
|
+
Builds also accept `--log-level <trace|debug|info|warn|error|off>`. This sets the minimum runtime log level for the compiled scripts. When omitted, builds default to `trace`; use `warn` for release packages.
|
|
179
179
|
|
|
180
180
|
Use `--scripts-path ./src/scripts` when runnable files live under a subfolder; use `--scripts-path ./src` when they are at the source root.
|
|
181
181
|
|
package/package.json
CHANGED
package/src/common/log.test.ts
CHANGED
|
@@ -42,4 +42,11 @@ describe('log levels', () => {
|
|
|
42
42
|
expect(getLogLevel()).toBe('debug')
|
|
43
43
|
expect(shouldLog('debug')).toBe(true)
|
|
44
44
|
})
|
|
45
|
+
|
|
46
|
+
it('normalizes an empty build level to trace', () => {
|
|
47
|
+
setLogLevel('')
|
|
48
|
+
|
|
49
|
+
expect(getLogLevel()).toBe('trace')
|
|
50
|
+
expect(shouldLog('trace')).toBe(true)
|
|
51
|
+
})
|
|
45
52
|
})
|
package/src/common/log.ts
CHANGED
|
@@ -15,7 +15,7 @@ const logLevelWeights: { [key in LogLevel]: number } = {
|
|
|
15
15
|
let currentLogLevel: LogLevel = normalizeLogLevel(
|
|
16
16
|
typeof __DAZSCRIPT_LOG_LEVEL__ === 'string'
|
|
17
17
|
? __DAZSCRIPT_LOG_LEVEL__
|
|
18
|
-
: '
|
|
18
|
+
: 'trace'
|
|
19
19
|
)
|
|
20
20
|
|
|
21
21
|
export const setLogLevel = (level: string): LogLevel => {
|
|
@@ -26,7 +26,7 @@ export const setLogLevel = (level: string): LogLevel => {
|
|
|
26
26
|
export const getLogLevel = (): LogLevel => currentLogLevel
|
|
27
27
|
|
|
28
28
|
export function normalizeLogLevel(level: string): LogLevel {
|
|
29
|
-
if (!level) return '
|
|
29
|
+
if (!level) return 'trace'
|
|
30
30
|
const normalized = level.toLowerCase() as LogLevel
|
|
31
31
|
return logLevels.indexOf(normalized) >= 0 ? normalized : 'debug'
|
|
32
32
|
}
|
|
@@ -81,7 +81,6 @@ export class ListViewBuilder<TItem, TData> implements IWidgetBuilder<DzListView>
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
sortOnBuild(onOff: boolean = true): this {
|
|
84
|
-
this.context.sortOnBuild = onOff
|
|
85
84
|
return this
|
|
86
85
|
}
|
|
87
86
|
|
|
@@ -141,7 +140,6 @@ class ListViewBuilderContext<TItem, TData> {
|
|
|
141
140
|
data: (item: TreeNode<TItem>) => TData
|
|
142
141
|
sorting: number = 0
|
|
143
142
|
sortAscending: boolean = true
|
|
144
|
-
sortOnBuild: boolean = true
|
|
145
143
|
selectionMode: number | null = null
|
|
146
144
|
selected: Observable<TData>
|
|
147
145
|
filter: ListViewFilterOptions
|
|
@@ -333,7 +331,6 @@ const build = <TItem, TData>(context: ListViewBuilderContext<TItem, TData>): DzL
|
|
|
333
331
|
}
|
|
334
332
|
|
|
335
333
|
listView.rootIsDecorated = context.decorated
|
|
336
|
-
if (context.sorting >= 0 && context.sortOnBuild) listView.sort()
|
|
337
334
|
|
|
338
335
|
if (context.filter?.keywords.value || context.filter?.filters)
|
|
339
336
|
filterList()
|
|
@@ -403,7 +400,6 @@ const build = <TItem, TData>(context: ListViewBuilderContext<TItem, TData>): DzL
|
|
|
403
400
|
if (!incomingPaths[path]) listView.deleteItem(li)
|
|
404
401
|
})
|
|
405
402
|
|
|
406
|
-
listView.sort()
|
|
407
403
|
}
|
|
408
404
|
|
|
409
405
|
const onSelectionChanged = (callback: (item: DzListViewItem, data: TData) => void) => {
|
|
@@ -417,6 +413,7 @@ const build = <TItem, TData>(context: ListViewBuilderContext<TItem, TData>): DzL
|
|
|
417
413
|
buildColumns(columns)
|
|
418
414
|
})
|
|
419
415
|
|
|
416
|
+
listView.showSortIndicator = context.sorting >= 0
|
|
420
417
|
listView.setSorting(context.sorting, context.sortAscending)
|
|
421
418
|
if (context.selectionMode !== null) {
|
|
422
419
|
listView.selectionMode = context.selectionMode
|