@jxsuite/schema 2.3.0 → 3.0.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.
- package/LICENSE +1 -1
- package/package.json +2 -2
- package/schema.json +28 -0
- package/src/asset-paths.ts +18 -0
- package/types.ts +20 -0
package/LICENSE
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"dependencies": {
|
|
3
3
|
"@webref/css": "^8.7.5",
|
|
4
4
|
"@webref/elements": "^2.9.0",
|
|
5
|
-
"@webref/idl": "^3.
|
|
5
|
+
"@webref/idl": "^3.85.0",
|
|
6
6
|
"ajv": "^8.20.0",
|
|
7
7
|
"ajv-formats": "^3.0.1"
|
|
8
8
|
},
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"upgrade": "bun update --latest && bun install"
|
|
61
61
|
},
|
|
62
62
|
"type": "module",
|
|
63
|
-
"version": "
|
|
63
|
+
"version": "3.0.0",
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"json-schema-to-ts": "^3.1.1"
|
|
66
66
|
}
|
package/schema.json
CHANGED
|
@@ -5650,6 +5650,34 @@
|
|
|
5650
5650
|
}
|
|
5651
5651
|
]
|
|
5652
5652
|
},
|
|
5653
|
+
"ontoolactivated": {
|
|
5654
|
+
"description": "Event handler for the \"toolactivated\" event.",
|
|
5655
|
+
"oneOf": [
|
|
5656
|
+
{
|
|
5657
|
+
"$ref": "#/$defs/RefObject"
|
|
5658
|
+
},
|
|
5659
|
+
{
|
|
5660
|
+
"$ref": "#/$defs/ExpressionEntry"
|
|
5661
|
+
},
|
|
5662
|
+
{
|
|
5663
|
+
"$ref": "#/$defs/FunctionDef"
|
|
5664
|
+
}
|
|
5665
|
+
]
|
|
5666
|
+
},
|
|
5667
|
+
"ontoolcancel": {
|
|
5668
|
+
"description": "Event handler for the \"toolcancel\" event.",
|
|
5669
|
+
"oneOf": [
|
|
5670
|
+
{
|
|
5671
|
+
"$ref": "#/$defs/RefObject"
|
|
5672
|
+
},
|
|
5673
|
+
{
|
|
5674
|
+
"$ref": "#/$defs/ExpressionEntry"
|
|
5675
|
+
},
|
|
5676
|
+
{
|
|
5677
|
+
"$ref": "#/$defs/FunctionDef"
|
|
5678
|
+
}
|
|
5679
|
+
]
|
|
5680
|
+
},
|
|
5653
5681
|
"ontoolchange": {
|
|
5654
5682
|
"description": "Event handler for the \"toolchange\" event.",
|
|
5655
5683
|
"oneOf": [
|
package/src/asset-paths.ts
CHANGED
|
@@ -77,6 +77,16 @@ export interface AssetMount {
|
|
|
77
77
|
urlPrefix: string;
|
|
78
78
|
/** Absolute directory the prefix maps onto. */
|
|
79
79
|
dir: string;
|
|
80
|
+
/**
|
|
81
|
+
* Whether the mount serves a file, asked with the file's path relative to {@link dir},
|
|
82
|
+
* `/`-separated. Absent means every file under the directory. A mount over a folder of notes sets
|
|
83
|
+
* it so that what the collection leaves out (`exclude`, hidden files, unpublished documents) is
|
|
84
|
+
* never reachable through the mount either: {@link assetUrlFor} gives a refused file no URL and
|
|
85
|
+
* {@link resolveAssetUrl} resolves a refused URL to nothing, so no host serves or copies it. It is
|
|
86
|
+
* a function, so it exists only where the mount was declared; a host that rebuilds a mount from
|
|
87
|
+
* its two strings (a project-relative copy for Studio) gets none.
|
|
88
|
+
*/
|
|
89
|
+
filter?: (path: string) => boolean;
|
|
80
90
|
}
|
|
81
91
|
|
|
82
92
|
/** Normalize a path or prefix for comparison: forward slashes, no trailing slash. */
|
|
@@ -117,6 +127,10 @@ export function assetUrlFor(mounts: readonly AssetMount[], absolutePath: string)
|
|
|
117
127
|
continue;
|
|
118
128
|
}
|
|
119
129
|
const rest = path.slice(dir.length + 1);
|
|
130
|
+
const { filter: serves } = mount;
|
|
131
|
+
if (serves && !serves(rest)) {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
120
134
|
const encoded = rest
|
|
121
135
|
.split("/")
|
|
122
136
|
.map((segment) => encodeURIComponent(segment))
|
|
@@ -160,6 +174,10 @@ export function resolveAssetUrl(mounts: readonly AssetMount[], url: string): str
|
|
|
160
174
|
if (segments.some((s) => s === "" || s === "." || s === "..")) {
|
|
161
175
|
return null;
|
|
162
176
|
}
|
|
177
|
+
const { filter: serves } = mount;
|
|
178
|
+
if (serves && !serves(segments.join("/"))) {
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
163
181
|
return `${normalizeDir(mount.dir)}/${segments.join("/")}`;
|
|
164
182
|
}
|
|
165
183
|
return null;
|
package/types.ts
CHANGED
|
@@ -857,6 +857,26 @@ export interface ContentLoaderEntry {
|
|
|
857
857
|
mtime?: string;
|
|
858
858
|
/** Authored text of a field the date-coercion pass rewrote, keyed by field name. */
|
|
859
859
|
rawDates?: Record<string, unknown>;
|
|
860
|
+
/**
|
|
861
|
+
* The entry's source file, relative to its content type's source directory, `/`-separated and
|
|
862
|
+
* with its extension (`Frappe/Bench Operations.md`). Stamped by the content loader for every
|
|
863
|
+
* entry it reads from a directory, so a message or an "edit this page" link can name the file
|
|
864
|
+
* an entry came from.
|
|
865
|
+
*/
|
|
866
|
+
path?: string;
|
|
867
|
+
/**
|
|
868
|
+
* The entry's route: the site-absolute path its content type's `route` template gives it,
|
|
869
|
+
* without a locale prefix or a trailing slash (`/kb/frappe/bench-operations`). Present only
|
|
870
|
+
* when the content type declares a `route`. Everything that needs a URL for the entry (links
|
|
871
|
+
* between entries, `$paths`, search, feeds) reads this, so they cannot disagree.
|
|
872
|
+
*/
|
|
873
|
+
route?: string;
|
|
874
|
+
/**
|
|
875
|
+
* The entry's URL as a link target: {@link route} percent-encoded, with the locale prefix of a
|
|
876
|
+
* `{locale}` collection and the site's `build.trailingSlash` applied
|
|
877
|
+
* (`/kb/frappe/bench-operations/`).
|
|
878
|
+
*/
|
|
879
|
+
url?: string;
|
|
860
880
|
/**
|
|
861
881
|
* The locale this entry was loaded for, set only when its content type's `source` carried a
|
|
862
882
|
* `{locale}` placeholder. It is what lets a `[slug]` route under `/fr/` expand the French
|