kireji 0.7.3 → 0.8.2
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 +4 -4
- package/package.json +1 -1
- package/src/app/kireji/description +1 -1
- package/src/app/kireji/editor/sections/state-space/part.html_.js +5 -5
- package/src/app/kireji/editor/static.css +7 -0
- package/src/app/kireji/editor/tab-group/mathML-subpart.js +8 -0
- package/src/app/kireji/sidebar/static.css +51 -15
- package/src/app/kireji/static.css +0 -4
- package/src/app/kireji/tool-bar/part.css +1 -1
- package/src/application-goto.js +8 -5
- package/src/build.js +89 -13
- package/src/kireji.schema.json +205 -0
- package/src/part.css_.js +20 -0
- package/src/part.html_.js +20 -8
- package/src/parts/abstract/clip/mathML-subpart.js +4 -0
- package/src/parts/abstract/match/mathML-subpart.js +9 -0
- package/src/parts/abstract/mesh/data-get.js +11 -0
- package/src/parts/abstract/mesh/mathML-subpart.js +10 -0
- package/src/parts/abstract/mesh/ray-cast.js +4 -4
- package/src/parts/abstract/mesh/type.d.ts +10 -0
- package/src/parts/abstract/mix/mathML-subpart.js +9 -0
- package/src/parts/abstract/part/mathML-subpart.js +3 -0
- package/src/parts/abstract/part/mathML.js +22 -0
- package/src/parts/abstract/part/part.json +11 -0
- package/src/parts/abstract/part/type.d.ts +4 -0
- package/src/parts/abstract/part-mask/mathML-subpart.js +1 -0
- package/src/parts/abstract/part-outliner/itemHTML-recursive.js +1 -1
- package/src/parts/abstract/part.json +1 -1
- package/src/parts/abstract/permutation/mathML-subpart.js +10 -0
- package/src/parts/abstract/scroller/mathML-subpart.js +1 -0
- package/src/parts/abstract/scroller/onscroll.js +3 -1
- package/src/parts/abstract/scroller/point-thumb.js +1 -1
- package/src/parts/core/client/async-install.js +1 -1
- package/src/parts/core/part.json +1 -1
- package/src/parts/core/server/sync-install.js +1 -1
- package/src/parts/core/worker/async-take-control.js +1 -1
- package/src/parts/desktop/era/modern/part.css +5 -1
- package/src/parts/desktop/era/vintage/static.css +5 -1
- package/src/parts/desktop/task-bar/menu/menu.html_.js +23 -12
- package/src/parts/desktop/task-bar/part.html_.js +3 -1
- package/src/parts/desktop/task-bar/view-hydrate.js +1 -1
- package/src/parts/desktop/type.d.ts +5 -5
- package/src/parts/desktop/windows/point.js +1 -1
- package/src/parts/desktop/windows/superset-get.js +1 -1
- package/src/{part.css → static.css} +1 -10
- package/src/type.d.ts +172 -10
- package/src/validate.js +3 -3
- package/src/app/kireji/editor/tab-group/equation.html_.js +0 -42
- package/src/parts/abstract/boolean/equation-variable.html +0 -1
- package/src/parts/abstract/box/build.js +0 -24
- package/src/parts/abstract/box/constants.js +0 -1
- package/src/parts/abstract/box/description-abstract +0 -1
- package/src/parts/abstract/box/dimensions_.js +0 -1
- package/src/parts/abstract/box/equation.html_.js +0 -1
- package/src/parts/abstract/box/model_.js +0 -1
- package/src/parts/abstract/box/part.json +0 -3
- package/src/parts/abstract/box/routeID-distribute.js +0 -7
- package/src/parts/abstract/box/routeID-model-to.js +0 -18
- package/src/parts/abstract/box/title-abstract +0 -1
- package/src/parts/abstract/box/type.d.ts +0 -20
- package/src/parts/abstract/match/equation.html_.js +0 -11
- package/src/parts/abstract/mix/equation.html_.js +0 -11
- package/src/parts/abstract/part/equation-variable.html_.js +0 -1
- package/src/parts/abstract/part/equation.html_.js +0 -3
- package/src/parts/abstract/part-mask/equation-variable.html_.js +0 -1
- package/src/parts/abstract/part-mask/equation.html_.js +0 -1
- package/src/parts/abstract/permutation/equation.html_.js +0 -1
- package/src/parts/abstract/scroller/equation-variable.html +0 -1
- package/src/parts/abstract/scroller/equation.html +0 -1
- package/src/parts/user/part.json +0 -3
- package/src/parts/user/title +0 -1
- package/src/parts/user/type.d.ts +0 -2
package/src/type.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
declare interface IEcosystem
|
|
2
2
|
extends IMix<null, ITopLevelDomainAny>,
|
|
3
|
+
IKirejiConfig,
|
|
3
4
|
IWebComponent {
|
|
4
5
|
|
|
5
6
|
// Subparts.
|
|
@@ -10,10 +11,6 @@ declare interface IEcosystem
|
|
|
10
11
|
readonly parts: IParts
|
|
11
12
|
|
|
12
13
|
// Serialized Properties.
|
|
13
|
-
/** One of three strings representing the severity of the API change. Used to automatically compute the correct semantic version at build time. */
|
|
14
|
-
readonly "change": "major" | "minor" | "patch"
|
|
15
|
-
/** A number used to control the detail in logs. Only messages with a priority less than or equal to this number will be logged. */
|
|
16
|
-
readonly "verbosity": number
|
|
17
14
|
/** The git branch for the current build version. */
|
|
18
15
|
readonly "branch": string
|
|
19
16
|
/** Returns a packed version of the entire repo as a stand-alone script that boots the ecosystem. */
|
|
@@ -26,16 +23,12 @@ declare interface IEcosystem
|
|
|
26
23
|
readonly "ETag": string
|
|
27
24
|
/** The current unix timestamp, acquired using the high-precision performance.now() + performance.timeOrigin. */
|
|
28
25
|
readonly "now": DOMHighResTimeStamp
|
|
29
|
-
/** The host of the desired default app. The server will redirect to this when the user visits localhost at the designated port to test locally. */
|
|
30
|
-
readonly "defaultApplicationHost": string
|
|
31
26
|
/** A stylesheet containing CSS variables with `url()` values that correspond to images. Used to seamlessly hand-off image rendering from the server-rendered page to the client-rendered page without modifying the DOM. */
|
|
32
27
|
readonly "images.css": string
|
|
33
28
|
/** The current application's PWA manifest. */
|
|
34
29
|
readonly "manifest.json": string
|
|
35
30
|
/** A JSON object serializing the desired landing model of the ecosystem. */
|
|
36
31
|
readonly "landing-model.json": string
|
|
37
|
-
/** The internal port (typically between 3000 and 4000) where the server will be hosted for both the reverse proxy in production and when testing locally via `localhost`. */
|
|
38
|
-
readonly "port": number
|
|
39
32
|
/** Returns the given HTML document with images (using `early-*` compressed images for server- or worker-rendered snapshots) into the head as style tag(s). This is used for enhancing the first page appearance when using server-side rendering. When injecting early images, it scans the given document for image usages to determine which early images the snapshot requires. */
|
|
40
33
|
readonly injectImages(HTML_DOCUMENT: string): string
|
|
41
34
|
/** Handles standard anchor link clicks in one of four ways:
|
|
@@ -69,7 +62,104 @@ declare interface IEcosystem
|
|
|
69
62
|
/** A boolean that is set to `true` as soon as the route ID is set for the first time. */
|
|
70
63
|
readonly initialized: undefined | true
|
|
71
64
|
}
|
|
65
|
+
declare interface IKirejiConfig {
|
|
66
|
+
/** * Determines which color mode features will be included in the ecosystem.
|
|
67
|
+
* - `none`: The color component will never be included.
|
|
68
|
+
* - `light`: Dark mode will never be included.
|
|
69
|
+
* - `dark`: Light mode will never be included.
|
|
70
|
+
* - `debug-dark`: Dark mode will only be included in local builds.
|
|
71
|
+
* - `debug-light`: Light mode will only be included in local builds.
|
|
72
|
+
* - `full`: The full color component will always be included.
|
|
73
|
+
* * @remarks When the menu and both colors are included, the color control will appear in the menu.
|
|
74
|
+
*/
|
|
75
|
+
readonly "includeColor": "none" | "light" | "dark" | "debug-dark" | "debug-light" | "full";
|
|
72
76
|
|
|
77
|
+
/** * Determines which era mode features will be included in the ecosystem.
|
|
78
|
+
* - `none`: The era component will never be included.
|
|
79
|
+
* - `vintage`: Modern mode will never be included.
|
|
80
|
+
* - `modern`: Vintage mode will never be included.
|
|
81
|
+
* - `debug-modern`: Modern mode will only be included in local builds.
|
|
82
|
+
* - `debug-vintage`: Vintage mode will only be included in local builds.
|
|
83
|
+
* - `full`: The full era component will always be included.
|
|
84
|
+
* * @remarks When the menu and both eras are included, the era control will appear in the menu.
|
|
85
|
+
*/
|
|
86
|
+
readonly "includeEra": "none" | "vintage" | "modern" | "debug-modern" | "debug-vintage" | "full";
|
|
87
|
+
|
|
88
|
+
/** * Determines whether a list of apps should be included in the menu.
|
|
89
|
+
* - `none`: Apps will never appear in the menu.
|
|
90
|
+
* - `local-only`: Apps will only appear in the menu in local builds.
|
|
91
|
+
* - `full`: Apps will always appear in the menu.
|
|
92
|
+
* * @remarks Has no effect on builds where the menu is not included or when there are no defined menu apps.
|
|
93
|
+
*/
|
|
94
|
+
readonly "includeMenuApps": "none" | "local-only" | "full";
|
|
95
|
+
|
|
96
|
+
/** * Determines whether or not the version updating features should be included in the menu.
|
|
97
|
+
* - `none`: Update features will never appear in the menu.
|
|
98
|
+
* - `local-only`: Update features will only appear in the menu in local builds.
|
|
99
|
+
* - `full`: Update features will always appear in the menu.
|
|
100
|
+
* * @remarks Has no effect on builds where the menu is not included.
|
|
101
|
+
*/
|
|
102
|
+
readonly "includeUpdates": "none" | "local-only" | "full";
|
|
103
|
+
|
|
104
|
+
/** * Determines whether or not the Kireji IDE should be included in the ecosystem.
|
|
105
|
+
* - `none`: kireji.app will never be included.
|
|
106
|
+
* - `full`: kireji.app will only be included in local builds.
|
|
107
|
+
* - `demo`: kireji.app will always be included (used only for Demo App Ecosystem).
|
|
108
|
+
*/
|
|
109
|
+
readonly "includeKirejiApp": "none" | "full" | "demo";
|
|
110
|
+
|
|
111
|
+
/** * Determines whether or not the ecosystem should include desktop-like features.
|
|
112
|
+
* - `none`: The desktop experience will never be included.
|
|
113
|
+
* - `menu-only`: Only the menu will be included, and it will always be included.
|
|
114
|
+
* - `local-only`: The full desktop experience will only be included in local builds.
|
|
115
|
+
* - `full`: The menu will always be included. The desktop experience will only be included in local builds.
|
|
116
|
+
* - `demo`: The full desktop experience will always be included (used only for Demo App Ecosystem).
|
|
117
|
+
*/
|
|
118
|
+
readonly "includeDesktop": "none" | "menu-only" | "local-only" | "full" | "demo";
|
|
119
|
+
|
|
120
|
+
/** * One of three strings representing the severity of the API change.
|
|
121
|
+
* - `major`: A breaking change which breaks existing hash assignments.
|
|
122
|
+
* - `minor`: A non-breaking change which adds new hash assignments.
|
|
123
|
+
* - `patch`: A non-breaking change which does not impact hash assignments.
|
|
124
|
+
*/
|
|
125
|
+
readonly "change": "major" | "minor" | "patch";
|
|
126
|
+
|
|
127
|
+
/** A number used to control the detail in logs. Only messages with a priority <= this number will be logged. */
|
|
128
|
+
readonly "verbosity": string;
|
|
129
|
+
|
|
130
|
+
/** The host of the desired default app. The server will redirect to this when testing locally. */
|
|
131
|
+
readonly "defaultApplicationHost": string;
|
|
132
|
+
|
|
133
|
+
/** The internal port (typically 3000-4000) where the server will be hosted. */
|
|
134
|
+
readonly "port": string;
|
|
135
|
+
|
|
136
|
+
/** * Determines whether or not the artifact should be output with embedded source map data.
|
|
137
|
+
* - `0`: Disabled
|
|
138
|
+
* - `1`: Enabled
|
|
139
|
+
*/
|
|
140
|
+
readonly "mapping": "disabled" | "enabled";
|
|
141
|
+
|
|
142
|
+
/** * If enabled, halts the hydration of the application completely. Useful for debugging FOUC.
|
|
143
|
+
* - `0`: Disabled
|
|
144
|
+
* - `1`: Enabled
|
|
145
|
+
*/
|
|
146
|
+
readonly "haltHydration": "disabled" | "enabled";
|
|
147
|
+
|
|
148
|
+
/** * If enabled, a warning line appears at the top of all applications regarding alpha status.
|
|
149
|
+
* - `0`: Disabled
|
|
150
|
+
* - `1`: Enabled
|
|
151
|
+
*/
|
|
152
|
+
readonly "includeWarning": "disabled" | "enabled";
|
|
153
|
+
|
|
154
|
+
/** * If enabled, applications running locally will reset to their landing hash when the service worker is replaced.
|
|
155
|
+
* - `0`: Disabled
|
|
156
|
+
* - `1`: Enabled
|
|
157
|
+
*/
|
|
158
|
+
readonly "resetLocalState": "disabled" | "enabled";
|
|
159
|
+
|
|
160
|
+
/** A string representing how long the main thread should hang to simulate loading. Useful for debugging FOUC. */
|
|
161
|
+
readonly "hangHydration": string;
|
|
162
|
+
}
|
|
73
163
|
/** This is the root part of the ecosystem, considered the ecosystem itself. @remarks When JSON stringified, it should inline all information compiled from the git repo in node by the build process. The serialized version should not include any values that are added during or after recursively hydrating the part tree. This means that all runtime values should be non-enumerable and defined using the `define()` method. */
|
|
74
164
|
declare const _: IEcosystem
|
|
75
165
|
/** A shorthand for document.querySelector */
|
|
@@ -283,7 +373,7 @@ declare function hydratePartsRecursive(part: string | IPartAny, domains: string[
|
|
|
283
373
|
declare function resolveRelativeHost(relativeHost: string, base: string | string[]): string
|
|
284
374
|
/** The immutable list of runtime instances for the root space, in order of when the were reached during recursive part hydration. */
|
|
285
375
|
declare const instances: IPartAny[]
|
|
286
|
-
/** The immutable list of every part
|
|
376
|
+
/** The immutable list of every part of the root space, in order of when the were reached during recursive part hydration. */
|
|
287
377
|
declare const allParts: IPartAny[]
|
|
288
378
|
/** The immutable list of every part host and filename combination, in order of when the were reached during recursive part hydration. */
|
|
289
379
|
declare const allSubjects: [host: string, filename?: string]
|
|
@@ -322,4 +412,76 @@ declare class Vector {
|
|
|
322
412
|
}
|
|
323
413
|
|
|
324
414
|
declare type IVector = Record<string, number>
|
|
325
|
-
declare type IVector2 = { x: number, y: number }
|
|
415
|
+
declare type IVector2 = { x: number, y: number }
|
|
416
|
+
|
|
417
|
+
declare type KirejiConfigColor =
|
|
418
|
+
/** The color component will never be included. */
|
|
419
|
+
| "none"
|
|
420
|
+
/** Dark mode will never be included. */
|
|
421
|
+
| "light"
|
|
422
|
+
/** Light mode will never be included. */
|
|
423
|
+
| "dark"
|
|
424
|
+
/** Dark mode will only be included in local builds. */
|
|
425
|
+
| "debug-dark"
|
|
426
|
+
/** Light mode will only be included in local builds. */
|
|
427
|
+
| "debug-light"
|
|
428
|
+
/** The full color component will always be included. */
|
|
429
|
+
| "full"
|
|
430
|
+
|
|
431
|
+
declare type KirejiConfigEra =
|
|
432
|
+
/** The era component will never be included. */
|
|
433
|
+
| "none"
|
|
434
|
+
/** Modern mode will never be included. */
|
|
435
|
+
| "vintage"
|
|
436
|
+
/** Vintage mode will never be included. */
|
|
437
|
+
| "modern"
|
|
438
|
+
/** Modern mode will only be included in local builds. */
|
|
439
|
+
| "debug-modern"
|
|
440
|
+
/** Vintage mode will only be included in local builds. */
|
|
441
|
+
| "debug-vintage"
|
|
442
|
+
/** The full era component will always be included. */
|
|
443
|
+
| "full"
|
|
444
|
+
|
|
445
|
+
declare type KirejiConfigMenuApps =
|
|
446
|
+
/** Apps will never appear in the menu. */
|
|
447
|
+
| "none"
|
|
448
|
+
/** Apps will only appear in the menu in local builds. */
|
|
449
|
+
| "local-only"
|
|
450
|
+
/** Apps will always appear in the menu. */
|
|
451
|
+
| "full"
|
|
452
|
+
|
|
453
|
+
declare type KirejiConfigUpdates =
|
|
454
|
+
/** Update features will never appear in the menu. */
|
|
455
|
+
| "none"
|
|
456
|
+
/** Update features will only appear in the menu in local builds. */
|
|
457
|
+
| "local-only"
|
|
458
|
+
/** Update features will always appear in the menu. */
|
|
459
|
+
| "full"
|
|
460
|
+
|
|
461
|
+
declare type KirejiConfigKirejiApp =
|
|
462
|
+
/** kireji.app will never be included. */
|
|
463
|
+
| "none"
|
|
464
|
+
/** kireji.app will only be included in local builds. */
|
|
465
|
+
| "full"
|
|
466
|
+
/** kireji.app will always be included (used only for Demo App Ecosystem). */
|
|
467
|
+
| "demo"
|
|
468
|
+
|
|
469
|
+
declare type KirejiConfigDesktop =
|
|
470
|
+
/** The desktop experience will never be included. */
|
|
471
|
+
| "none"
|
|
472
|
+
/** Only the menu will be included, and it will always be included. */
|
|
473
|
+
| "menu-only"
|
|
474
|
+
/** The full desktop experience will only be included in local builds. */
|
|
475
|
+
| "local-only"
|
|
476
|
+
/** The menu will always be included. The desktop experience will only be included in local builds. */
|
|
477
|
+
| "full"
|
|
478
|
+
/** The full desktop experience will always be included (used only for Demo App Ecosystem). */
|
|
479
|
+
| "demo"
|
|
480
|
+
|
|
481
|
+
declare type KirejiConfigChange =
|
|
482
|
+
/** A breaking change which breaks existing hash assignments. */
|
|
483
|
+
| "major"
|
|
484
|
+
/** A non-breaking change which adds new hash assignments but doesn't break existing ones. */
|
|
485
|
+
| "minor"
|
|
486
|
+
/** A non-breaking change which does not impact hash assignments at all. */
|
|
487
|
+
| "patch"
|
package/src/validate.js
CHANGED
|
@@ -25,9 +25,9 @@ if (environment === "node-main") {
|
|
|
25
25
|
})
|
|
26
26
|
logScope(1, "\nSerialization Test", log => {
|
|
27
27
|
const postHydrationArchive = serialize(_)
|
|
28
|
-
if (postHydrationArchive !== preHydrationArchive) {
|
|
29
|
-
warn(`The post-hydration archive was ${postHydrationArchive.length - preHydrationArchive.length} bytes longer than the pre-hydration archive.`)
|
|
30
|
-
const lines1 = preHydrationArchive.split('\n')
|
|
28
|
+
if (postHydrationArchive !== _.preHydrationArchive) {
|
|
29
|
+
warn(`The post-hydration archive was ${postHydrationArchive.length - _.preHydrationArchive.length} bytes longer than the pre-hydration archive.`)
|
|
30
|
+
const lines1 = _.preHydrationArchive.split('\n')
|
|
31
31
|
const lines2 = postHydrationArchive.split('\n')
|
|
32
32
|
const maxLength = Math.max(lines1.length, lines2.length)
|
|
33
33
|
for (let i = 0; i < maxLength; i++) {
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
return `<math>
|
|
2
|
-
<mn>1</mn>
|
|
3
|
-
<mo>+</mo>
|
|
4
|
-
<munderover>
|
|
5
|
-
<mo>∑</mo>
|
|
6
|
-
<mrow>
|
|
7
|
-
<msub><mi>𝑛</mi><mi>tabs</mi></msub>
|
|
8
|
-
<mo>=</mo>
|
|
9
|
-
<mn>1</mn>
|
|
10
|
-
</mrow>
|
|
11
|
-
<mi>${allSubjects.length}</mi>
|
|
12
|
-
</munderover>
|
|
13
|
-
<mrow>
|
|
14
|
-
<mo>(</mo>
|
|
15
|
-
<msub><mi>𝑛</mi><mi>tabs</mi></msub>
|
|
16
|
-
<mo>+</mo>
|
|
17
|
-
<mn>1</mn>
|
|
18
|
-
<mo>)</mo>
|
|
19
|
-
<msub><mi>𝑛</mi><mi>tabs</mi></msub>
|
|
20
|
-
<mo>×</mo>
|
|
21
|
-
<munderover>
|
|
22
|
-
<mo>∏</mo>
|
|
23
|
-
<mrow>
|
|
24
|
-
<mi>i</mi>
|
|
25
|
-
<mo>=</mo>
|
|
26
|
-
<mn>1</mn>
|
|
27
|
-
</mrow>
|
|
28
|
-
<mrow>
|
|
29
|
-
<msub><mi>𝑛</mi><mi>tabs</mi></msub>
|
|
30
|
-
</mrow>
|
|
31
|
-
</munderover>
|
|
32
|
-
<mrow>
|
|
33
|
-
<mo>(</mo>
|
|
34
|
-
<mi>${allSubjects.length}</mi>
|
|
35
|
-
<mo>-</mo>
|
|
36
|
-
<mi>i</mi>
|
|
37
|
-
<mo>-</mo>
|
|
38
|
-
<mn>1</mn>
|
|
39
|
-
<mo>)</mo>
|
|
40
|
-
</mrow>
|
|
41
|
-
</mrow>
|
|
42
|
-
</math>`
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<math><mi>𝑏</mi></math>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const { dimensions } = box
|
|
2
|
-
|
|
3
|
-
if (!Array.isArray(dimensions) || dimensions.some(member => typeof member !== "bigint" && isNaN(member)))
|
|
4
|
-
throw `The "dimensions" property of a box must be an array whose members are numeric.`
|
|
5
|
-
|
|
6
|
-
const placeValues = []
|
|
7
|
-
const placeStates = []
|
|
8
|
-
const placeLimits = []
|
|
9
|
-
|
|
10
|
-
let product = 1n
|
|
11
|
-
|
|
12
|
-
for (const dimension of dimensions) {
|
|
13
|
-
placeValues.push(product)
|
|
14
|
-
placeStates.push(-1)
|
|
15
|
-
placeLimits.push(dimension)
|
|
16
|
-
product *= BigInt(dimension)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
box.define({
|
|
20
|
-
cardinality: { value: product },
|
|
21
|
-
placeValues: { value: placeValues },
|
|
22
|
-
placeStates: { value: placeStates },
|
|
23
|
-
placeLimits: { value: placeLimits }
|
|
24
|
-
})
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const box = this
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
This part provides a set of independent state variables just like the mix but the box keeps its factors self-contained instead of distributing them across subparts. The box is ideal for cartesian product spaces whose factors don't need to handle their own view updates or store any data beyond their cardinality.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
return []
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
return `<math>${box.dimensions.map(dimension => `<mn>${dimension}</mn>`).join("<mo>⋅</mo>")}</math>`
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
return [...box.placeStates]
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
if (!Array.isArray(MODEL))
|
|
2
|
-
throw new TypeError(`Model To RouteID Error: Box "${box.host}" does not support computing a route ID from a model of type "${typeof MODEL}".`)
|
|
3
|
-
|
|
4
|
-
if (MODEL.length !== box.placeValues.length)
|
|
5
|
-
throw new RangeError(`Model To RouteID Error: Box "${box.host}" does not support computing a route ID from an array with a different length than the number of dimensions the box has.`)
|
|
6
|
-
|
|
7
|
-
if (MODEL.some(member => isNaN(member)))
|
|
8
|
-
throw new RangeError(`Model To RouteID Error: Box "${box.host}" does not support computing a route ID from an array with element(s) which are not numeric.`)
|
|
9
|
-
|
|
10
|
-
const resultRouteID = box.placeValues.reduce((resultRouteID, placeValue, i) => resultRouteID + BigInt(placeValue) * BigInt(Math.max(Math.min(Math.round(MODEL[i]), box.placeLimits[i] - 1), 0)), 0n)
|
|
11
|
-
|
|
12
|
-
if (resultRouteID >= part.cardinality)
|
|
13
|
-
throw new RangeError(`Model To RouteID Error: Part "${part.host}" returned a route ID that was too large (${resultRouteID}) (max ${part.cardinality}).`)
|
|
14
|
-
|
|
15
|
-
if (resultRouteID < 0n)
|
|
16
|
-
throw new RangeError(`Model To RouteID Error: Part "${part.host}" returned a negative route ID.`)
|
|
17
|
-
|
|
18
|
-
return resultRouteID
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Box Prototype
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
declare interface IBox<TOwner>
|
|
2
|
-
extends IPart<TOwner, null> {
|
|
3
|
-
|
|
4
|
-
// Serialized Properties.
|
|
5
|
-
readonly "dimensions": [number]
|
|
6
|
-
// Runtime Properties.
|
|
7
|
-
/** The array of dimension multipliers, (the value of a unit for each of the defined dimensions) where the box is viewed as a fixed-length mixed-radix string.
|
|
8
|
-
*
|
|
9
|
-
* Used to speed up computation. */
|
|
10
|
-
readonly placeValues: bigint[]
|
|
11
|
-
/** A cache of the individual dimension values as extracted from the box's overall route ID. */
|
|
12
|
-
readonly placeStates: number[]
|
|
13
|
-
/** A cache of the "dimensions" property, so that the array is not duplicated during arithmetic and so that the values are guaranteed to be bigints. */
|
|
14
|
-
readonly placeLimits: number[]
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
declare type IBoxAny =
|
|
18
|
-
IBox<IPartAny>
|
|
19
|
-
|
|
20
|
-
declare const box: IBoxAny
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
return "<math>" + (
|
|
2
|
-
match.length ? (
|
|
3
|
-
match.length > 4 ? (
|
|
4
|
-
`<mo>∑</mo><msub><mi>𝑘</mi><mi>𝑝</mi></msub><mtext>,</mtext><mspace width="0.5em"/><mi>𝑝</mi><mo>∈</mo><mi>subparts</mi><mo>(</mo><msub><mi>P</mi><mi>${part.key ?? "ecosystem"}</mi></msub><mo>)</mo>`
|
|
5
|
-
) : (
|
|
6
|
-
match.map(arm => arm["equation-variable.html"]).join("<mo>+</mo>")
|
|
7
|
-
)
|
|
8
|
-
) : (
|
|
9
|
-
"<mn>1</mn>"
|
|
10
|
-
)
|
|
11
|
-
) + "</math>"
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
return "<math>" + (
|
|
2
|
-
mix.length ? (
|
|
3
|
-
mix.length > 4 ? (
|
|
4
|
-
`<mo>∏</mo><msub><mi>𝑘</mi><mi>𝑝</mi></msub><mtext>,</mtext><mspace width="0.5em"/><mi>𝑝</mi><mo>∈</mo><mi>subparts</mi><mo>(</mo><msub><mi>P</mi><mi>${part.key ?? "ecosystem"}</mi></msub><mo>)</mo>`
|
|
5
|
-
) : (
|
|
6
|
-
mix.map(factor => factor["equation-variable.html"]).join("<mo>⋅</mo>")
|
|
7
|
-
)
|
|
8
|
-
) : (
|
|
9
|
-
"<mn>1</mn>"
|
|
10
|
-
)
|
|
11
|
-
) + "</math>"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
return `<math><msub><mi>𝑘</mi><mi>${part.key ?? "ecosystem"}</mi></msub></math>`
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
return `<math><msup><mn>2</mn><mn>${partMask.superset.length}</mn></msup></math>`
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
return `<math>${partMask["equation-variable.html"]}</math>`
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
return `<math><mtext>TBD for ${permutation.maxInstanceCount} max instances.</mtext></math>`
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<math><mi>𝑠</mi></math>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<math><msup><mn>10</mn><mn>4</mn></msup></math>
|
package/src/parts/user/part.json
DELETED
package/src/parts/user/title
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
User Parts
|
package/src/parts/user/type.d.ts
DELETED