@gramlot/gramlot 0.3.34 → 0.3.35
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/dist/collections/typst.js +3 -0
- package/dist/declared-collections.js +2 -0
- package/dist/gramlot.js +27 -7497
- package/dist/gramlot.min.js +48 -53
- package/dist/runtime-notices.json +0 -12
- package/dist/standard-collections.js +1 -1
- package/package.json +2 -1
- package/src/server/assets.d.ts +3 -2
- package/src/server/assets.js +6 -3
- package/src/server/gramlot-server.js +6 -1
- package/src/server/index.d.ts +1 -1
- package/src/server/index.js +1 -1
- package/src/shared-modules.js +2 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gramlot/gramlot",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.35",
|
|
4
4
|
"description": "Declarative HTML/SVG interfaces with live data binding, authored in JavaScript or Python.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -82,6 +82,7 @@
|
|
|
82
82
|
"./components/tree": "./src/components/tree.js",
|
|
83
83
|
"./components/editors": "./src/components/editors.js",
|
|
84
84
|
"./components/typst": "./src/components/typst.js",
|
|
85
|
+
"./collections/typst": "./dist/collections/typst.js",
|
|
85
86
|
"./components/grouplets": "./src/components/grouplets.js",
|
|
86
87
|
"./components/uploads": "./src/components/uploads.js",
|
|
87
88
|
"./device-frames": "./src/device-frames.js",
|
package/src/server/assets.d.ts
CHANGED
|
@@ -11,5 +11,6 @@ export function gramlotDev(): 'YES' | 'DEBUG' | null;
|
|
|
11
11
|
* when `GRAMLOT_DEV=DEBUG`, `gramlot.min.js` otherwise. Another name throws a `TypeError`. */
|
|
12
12
|
export function runtimeAsset(name?: 'gramlot.js' | 'gramlot.min.js' | 'gramlot-markdown.js' | 'runtime-notices.json' | null): URL;
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
|
|
14
|
+
/** The entry points of every collection the core packages, standard and declared (`typst`), for host artifact
|
|
15
|
+
* verification. */
|
|
16
|
+
export function collectionAssets(): Array<{url: string; file: URL}>;
|
package/src/server/assets.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* @ts-self-types="./assets.d.ts" */
|
|
2
2
|
import {standardCollections} from '../../dist/standard-collections.js';
|
|
3
|
+
import {declaredCollections} from '../../dist/declared-collections.js';
|
|
3
4
|
/**
|
|
4
5
|
* Development mode and the runtime file to serve. `gramlotDev` imports nothing from Node.js, so the
|
|
5
6
|
* neutral `GramlotServer` can read it in a serverless Worker, where it is null without `process`.
|
|
@@ -30,9 +31,11 @@ export function runtimeAsset(name = null) {
|
|
|
30
31
|
return new URL(`../../dist/${name}`, import.meta.url);
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
/** The entry points of every collection the core packages: the standard set, which every page receives, and the
|
|
35
|
+
* collections a page declares in `Page.gramlots` (`typst`). A host serves the collections of its page graph from
|
|
36
|
+
* them, as Python reads a declared collection from its package; hosts verify the complete artifact inventories. */
|
|
37
|
+
export function collectionAssets() {
|
|
38
|
+
return [...standardCollections, ...declaredCollections].map(collection => ({
|
|
36
39
|
url: collection.module,
|
|
37
40
|
file: new URL(`../../dist/components/${collection.name}/assets/index.js`, import.meta.url),
|
|
38
41
|
}));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* @ts-self-types="./gramlot-server.d.ts" */
|
|
2
2
|
import {standardCollections} from '../../dist/standard-collections.js';
|
|
3
|
+
import {declaredCollections} from '../../dist/declared-collections.js';
|
|
3
4
|
/**
|
|
4
5
|
* The neutral server: registers pages and builds their Sources, with no HTTP engine.
|
|
5
6
|
*
|
|
@@ -368,11 +369,15 @@ export class GramlotServer {
|
|
|
368
369
|
head.link({rel: 'manifest', href: prefix + '/app.webmanifest'});
|
|
369
370
|
}
|
|
370
371
|
// A page module served for its Logic imports the core from the runtime already loaded.
|
|
372
|
+
const declared = new Set(declaredCollections.map(({name}) => name));
|
|
371
373
|
head.script(scriptJson({imports: {'@gramlot/gramlot/page': prefixed(prefix, this.runtimeUrl),
|
|
372
374
|
'@gramlot/gramlot': prefixed(prefix, this.runtimeUrl),
|
|
373
375
|
'@gramlot/gramlot/components':prefixed(prefix,this.runtimeUrl),
|
|
374
376
|
'@gramlot/gramlot/markdown':prefixed(prefix,this.markdownUrl),
|
|
375
|
-
...Object.fromEntries((resources.collections ?? []).map(({name,url})=>[`@gramlot/collections/${encodeURIComponent(name)}`,prefixed(prefix,url)]))
|
|
377
|
+
...Object.fromEntries((resources.collections ?? []).map(({name,url})=>[`@gramlot/collections/${encodeURIComponent(name)}`,prefixed(prefix,url)])),
|
|
378
|
+
// A page module imports a declared core collection for gramlots.
|
|
379
|
+
...Object.fromEntries((resources.collections ?? []).filter(({name})=>declared.has(name))
|
|
380
|
+
.map(({name,url})=>[`@gramlot/gramlot/collections/${name}`,prefixed(prefix,url)]))},
|
|
376
381
|
...(this.librarySource === 'cdn' ? {integrity: Object.fromEntries(Object.values(this.libraries)
|
|
377
382
|
.filter(entry => entry.url !== null && entry.format !== 'style').map(entry => [entry.url, entry.integrity]))} : {})}),
|
|
378
383
|
{type: 'importmap', nonce});
|
package/src/server/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export type {GramlotServerOptions, OpenedPage, RegisteredPage} from './gramlot-s
|
|
|
11
11
|
export {GramlotBuilder} from '../builder/gramlot-builder.js';
|
|
12
12
|
export {GramlotFileServer} from './gramlot-file-server.js';
|
|
13
13
|
export type {GramlotFileServerOptions} from './gramlot-file-server.js';
|
|
14
|
-
export {gramlotDev, runtimeAsset,
|
|
14
|
+
export {gramlotDev, runtimeAsset, collectionAssets} from './assets.js';
|
|
15
15
|
export {checkProtocol} from './conformance.js';
|
|
16
16
|
export {InvalidResourceName, parseRequires} from './resources.js';
|
|
17
17
|
export type {Resources} from './resources.js';
|
package/src/server/index.js
CHANGED
|
@@ -11,7 +11,7 @@ export {GramlotServer, EndpointNotFound, InvalidRequest, NotAuthenticated, NotAu
|
|
|
11
11
|
SourceNotFound, ServerCapacity} from './gramlot-server.js';
|
|
12
12
|
export {GramlotBuilder} from '../builder/gramlot-builder.js';
|
|
13
13
|
export {GramlotFileServer} from './gramlot-file-server.js';
|
|
14
|
-
export {gramlotDev, runtimeAsset,
|
|
14
|
+
export {gramlotDev, runtimeAsset, collectionAssets} from './assets.js';
|
|
15
15
|
export {checkProtocol} from './conformance.js';
|
|
16
16
|
export {InvalidResourceName, parseRequires} from './resources.js';
|
|
17
17
|
export {NAME_SYNTAX, NameSyntax} from '../builder/name-syntax.js';
|
package/src/shared-modules.js
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
*
|
|
9
9
|
* A key is the import specifier: the package name for a library, the path relative to this
|
|
10
10
|
* directory for a runtime module. The generator refuses a collection that would bundle a module of
|
|
11
|
-
* the runtime missing from this table.
|
|
11
|
+
* the runtime missing from this table. big.js and @xmldom/xmldom are not shared: the browser runtime
|
|
12
|
+
* does not ship them (see `scripts/runtime-options.mjs`).
|
|
12
13
|
*
|
|
13
14
|
* @module
|
|
14
15
|
*/
|
|
@@ -16,9 +17,7 @@ import * as genrojsBag from '@genrojs/bag';
|
|
|
16
17
|
import * as genrojsBuilders from '@genrojs/builders';
|
|
17
18
|
import * as genrojsToolbox from '@genrojs/toolbox';
|
|
18
19
|
import * as genrojsTytx from '@genrojs/tytx';
|
|
19
|
-
import * as xmldom from '@xmldom/xmldom';
|
|
20
20
|
import * as decimal from 'decimal.js';
|
|
21
|
-
import * as big from 'big.js';
|
|
22
21
|
import * as msgpack from '@msgpack/msgpack';
|
|
23
22
|
import * as dompurify from 'dompurify';
|
|
24
23
|
import * as randomId from './random-id.js';
|
|
@@ -49,9 +48,7 @@ export const sharedModules = Object.freeze({
|
|
|
49
48
|
'@genrojs/builders': genrojsBuilders,
|
|
50
49
|
'@genrojs/toolbox': genrojsToolbox,
|
|
51
50
|
'@genrojs/tytx': genrojsTytx,
|
|
52
|
-
'@xmldom/xmldom': xmldom,
|
|
53
51
|
'decimal.js': decimal,
|
|
54
|
-
'big.js': big,
|
|
55
52
|
'@msgpack/msgpack': msgpack,
|
|
56
53
|
'dompurify': dompurify,
|
|
57
54
|
'./random-id.js': randomId,
|