@graview/core 0.1.73 → 0.2.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/README.md +7 -0
- package/dist/app-places.d.ts +1 -0
- package/dist/app-places.d.ts.map +1 -1
- package/dist/app-places.js +117 -1
- package/dist/app-places.js.map +1 -1
- package/dist/app.d.ts +13 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js.map +1 -1
- package/dist/arrangement.d.ts.map +1 -1
- package/dist/arrangement.js +3 -0
- package/dist/arrangement.js.map +1 -1
- package/dist/blocks.d.ts +1 -0
- package/dist/blocks.d.ts.map +1 -1
- package/dist/blocks.js +2 -0
- package/dist/blocks.js.map +1 -1
- package/dist/check.d.ts +1 -1
- package/dist/check.d.ts.map +1 -1
- package/dist/check.js +1 -1
- package/dist/check.js.map +1 -1
- package/dist/cli/check/devices.d.ts +12 -0
- package/dist/cli/check/devices.d.ts.map +1 -0
- package/dist/cli/check/devices.js +25 -0
- package/dist/cli/check/devices.js.map +1 -0
- package/dist/cli/check/index.d.ts +1 -0
- package/dist/cli/check/index.d.ts.map +1 -1
- package/dist/cli/check/index.js +1 -0
- package/dist/cli/check/index.js.map +1 -1
- package/dist/cli/check/lenses.js +2 -2
- package/dist/cli/check/lenses.js.map +1 -1
- package/dist/cli/check/relations.js +1 -1
- package/dist/cli/check/relations.js.map +1 -1
- package/dist/cli/check.d.ts.map +1 -1
- package/dist/cli/check.js +2 -1
- package/dist/cli/check.js.map +1 -1
- package/dist/cli/create.d.ts +1 -1
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +34 -3
- package/dist/cli/create.js.map +1 -1
- package/dist/cli/document-schema.d.ts.map +1 -1
- package/dist/cli/document-schema.js +7 -0
- package/dist/cli/document-schema.js.map +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +23 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/types.d.ts.map +1 -1
- package/dist/cli/types.js +1 -0
- package/dist/cli/types.js.map +1 -1
- package/dist/compose-home.d.ts +48 -0
- package/dist/compose-home.d.ts.map +1 -0
- package/dist/compose-home.js +190 -0
- package/dist/compose-home.js.map +1 -0
- package/dist/compose.d.ts +8 -0
- package/dist/compose.d.ts.map +1 -1
- package/dist/compose.js +21 -17
- package/dist/compose.js.map +1 -1
- package/dist/days.d.ts +15 -1
- package/dist/days.d.ts.map +1 -1
- package/dist/days.js +56 -3
- package/dist/days.js.map +1 -1
- package/dist/device-findings.d.ts +27 -0
- package/dist/device-findings.d.ts.map +1 -0
- package/dist/device-findings.js +100 -0
- package/dist/device-findings.js.map +1 -0
- package/dist/device-screens.d.ts +50 -0
- package/dist/device-screens.d.ts.map +1 -0
- package/dist/device-screens.js +92 -0
- package/dist/device-screens.js.map +1 -0
- package/dist/device-shape.d.ts +41 -0
- package/dist/device-shape.d.ts.map +1 -0
- package/dist/device-shape.js +81 -0
- package/dist/device-shape.js.map +1 -0
- package/dist/devices.d.ts +7 -0
- package/dist/devices.d.ts.map +1 -0
- package/dist/devices.js +16 -0
- package/dist/devices.js.map +1 -0
- package/dist/document/act-findings.d.ts.map +1 -1
- package/dist/document/act-findings.js +1 -0
- package/dist/document/act-findings.js.map +1 -1
- package/dist/document/blocks.d.ts.map +1 -1
- package/dist/document/blocks.js +11 -3
- package/dist/document/blocks.js.map +1 -1
- package/dist/document/compile-checked.d.ts.map +1 -1
- package/dist/document/compile-checked.js +3 -2
- package/dist/document/compile-checked.js.map +1 -1
- package/dist/document/compiled.d.ts.map +1 -1
- package/dist/document/compiled.js +43 -16
- package/dist/document/compiled.js.map +1 -1
- package/dist/document/describe-forms.d.ts.map +1 -1
- package/dist/document/describe-forms.js +2 -0
- package/dist/document/describe-forms.js.map +1 -1
- package/dist/document/describe-place.d.ts.map +1 -1
- package/dist/document/describe-place.js +30 -6
- package/dist/document/describe-place.js.map +1 -1
- package/dist/document/devices-spec.d.ts +14 -0
- package/dist/document/devices-spec.d.ts.map +1 -0
- package/dist/document/devices-spec.js +22 -0
- package/dist/document/devices-spec.js.map +1 -0
- package/dist/document/edit.d.ts +1 -1
- package/dist/document/edit.d.ts.map +1 -1
- package/dist/document/edit.js +172 -0
- package/dist/document/edit.js.map +1 -1
- package/dist/document/expr/typing.d.ts.map +1 -1
- package/dist/document/expr/typing.js +1 -0
- package/dist/document/expr/typing.js.map +1 -1
- package/dist/document/graview-template.d.ts +79 -1
- package/dist/document/graview-template.d.ts.map +1 -1
- package/dist/document/graview-template.js +150 -7
- package/dist/document/graview-template.js.map +1 -1
- package/dist/document/index.d.ts +2 -2
- package/dist/document/index.d.ts.map +1 -1
- package/dist/document/index.js +1 -1
- package/dist/document/index.js.map +1 -1
- package/dist/document/instantiate-template.d.ts +12 -0
- package/dist/document/instantiate-template.d.ts.map +1 -1
- package/dist/document/instantiate-template.js +14 -0
- package/dist/document/instantiate-template.js.map +1 -1
- package/dist/document/migrate.d.ts.map +1 -1
- package/dist/document/migrate.js +9 -0
- package/dist/document/migrate.js.map +1 -1
- package/dist/document/says-the-line.d.ts +18 -0
- package/dist/document/says-the-line.d.ts.map +1 -0
- package/dist/document/says-the-line.js +46 -0
- package/dist/document/says-the-line.js.map +1 -0
- package/dist/document/schema.d.ts +10 -2
- package/dist/document/schema.d.ts.map +1 -1
- package/dist/document/schema.js +9 -2
- package/dist/document/schema.js.map +1 -1
- package/dist/document/template.d.ts +6 -1
- package/dist/document/template.d.ts.map +1 -1
- package/dist/document/template.js +29 -2
- package/dist/document/template.js.map +1 -1
- package/dist/document/to-document.d.ts.map +1 -1
- package/dist/document/to-document.js +2 -0
- package/dist/document/to-document.js.map +1 -1
- package/dist/document.schema.json +37 -4
- package/dist/graph/graph.d.ts +48 -0
- package/dist/graph/graph.d.ts.map +1 -1
- package/dist/graph/graph.js +103 -48
- package/dist/graph/graph.js.map +1 -1
- package/dist/graph/would-refuse.d.ts +13 -0
- package/dist/graph/would-refuse.d.ts.map +1 -0
- package/dist/graph/would-refuse.js +69 -0
- package/dist/graph/would-refuse.js.map +1 -0
- package/dist/import/coerce.d.ts.map +1 -1
- package/dist/import/coerce.js +7 -0
- package/dist/import/coerce.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/kind-date.d.ts +18 -0
- package/dist/kind-date.d.ts.map +1 -0
- package/dist/kind-date.js +10 -0
- package/dist/kind-date.js.map +1 -0
- package/dist/kind-list.js +1 -1
- package/dist/kind-list.js.map +1 -1
- package/dist/may-run.d.ts +46 -0
- package/dist/may-run.d.ts.map +1 -0
- package/dist/may-run.js +162 -0
- package/dist/may-run.js.map +1 -0
- package/dist/mutations/arg-shape.d.ts +4 -0
- package/dist/mutations/arg-shape.d.ts.map +1 -1
- package/dist/mutations/arg-shape.js +3 -0
- package/dist/mutations/arg-shape.js.map +1 -1
- package/dist/mutations/derive-edits.d.ts.map +1 -1
- package/dist/mutations/derive-edits.js +4 -1
- package/dist/mutations/derive-edits.js.map +1 -1
- package/dist/mutations/form.d.ts +2 -1
- package/dist/mutations/form.d.ts.map +1 -1
- package/dist/mutations/form.js +6 -0
- package/dist/mutations/form.js.map +1 -1
- package/dist/mutations/node-ref.d.ts +7 -0
- package/dist/mutations/node-ref.d.ts.map +1 -1
- package/dist/mutations/node-ref.js +17 -0
- package/dist/mutations/node-ref.js.map +1 -1
- package/dist/mutations/types.d.ts +11 -0
- package/dist/mutations/types.d.ts.map +1 -1
- package/dist/permissions/policy.d.ts.map +1 -1
- package/dist/permissions/policy.js +1 -0
- package/dist/permissions/policy.js.map +1 -1
- package/dist/permissions/types.d.ts +6 -0
- package/dist/permissions/types.d.ts.map +1 -1
- package/dist/permissions/types.js.map +1 -1
- package/dist/places.d.ts +2 -0
- package/dist/places.d.ts.map +1 -1
- package/dist/places.js.map +1 -1
- package/dist/scaffold/from-template.d.ts +16 -0
- package/dist/scaffold/from-template.d.ts.map +1 -1
- package/dist/scaffold/from-template.js +29 -0
- package/dist/scaffold/from-template.js.map +1 -1
- package/dist/scaffold/index.d.ts +9 -0
- package/dist/scaffold/index.d.ts.map +1 -1
- package/dist/scaffold/index.js +2 -2
- package/dist/scaffold/index.js.map +1 -1
- package/dist/schema/field-words.d.ts +1 -1
- package/dist/schema/field-words.d.ts.map +1 -1
- package/dist/schema/field-words.js +4 -2
- package/dist/schema/field-words.js.map +1 -1
- package/dist/schema/json-schema.d.ts.map +1 -1
- package/dist/schema/json-schema.js +2 -1
- package/dist/schema/json-schema.js.map +1 -1
- package/dist/schema/reading.d.ts +7 -0
- package/dist/schema/reading.d.ts.map +1 -1
- package/dist/schema/reading.js +27 -3
- package/dist/schema/reading.js.map +1 -1
- package/dist/schema/typed-field-builders.d.ts +2 -0
- package/dist/schema/typed-field-builders.d.ts.map +1 -1
- package/dist/schema/typed-field-builders.js +5 -0
- package/dist/schema/typed-field-builders.js.map +1 -1
- package/dist/schema/typed-fields.d.ts +2 -2
- package/dist/schema/typed-fields.d.ts.map +1 -1
- package/dist/schema/typed-fields.js +2 -2
- package/dist/schema/typed-fields.js.map +1 -1
- package/dist/seat.d.ts +4 -1
- package/dist/seat.d.ts.map +1 -1
- package/dist/seat.js +5 -1
- package/dist/seat.js.map +1 -1
- package/dist/store.d.ts +39 -0
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +160 -38
- package/dist/store.js.map +1 -1
- package/dist/theme/accent.d.ts.map +1 -1
- package/dist/theme/accent.js +13 -16
- package/dist/theme/accent.js.map +1 -1
- package/dist/theme/derive.d.ts +8 -0
- package/dist/theme/derive.d.ts.map +1 -1
- package/dist/theme/derive.js +1 -1
- package/dist/theme/derive.js.map +1 -1
- package/dist/theme/layers.d.ts +15 -0
- package/dist/theme/layers.d.ts.map +1 -1
- package/dist/theme/layers.js +8 -0
- package/dist/theme/layers.js.map +1 -1
- package/dist/time-typed.d.ts +7 -0
- package/dist/time-typed.d.ts.map +1 -0
- package/dist/time-typed.js +31 -0
- package/dist/time-typed.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/words.d.ts +1 -0
- package/dist/words.d.ts.map +1 -1
- package/dist/words.js +2 -0
- package/dist/words.js.map +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as z from "../schema/zod.js";
|
|
2
|
+
export declare const DeviceScreenSpec: z.ZodMiniLazy<z.ZodMiniObject<{
|
|
3
|
+
place: z.ZodMiniString<string>;
|
|
4
|
+
label: z.ZodMiniString<string>;
|
|
5
|
+
}, z.core.$strict>>;
|
|
6
|
+
export declare const DevicesSpec: z.ZodMiniLazy<z.ZodMiniObject<{
|
|
7
|
+
screens: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
8
|
+
place: z.ZodMiniString<string>;
|
|
9
|
+
label: z.ZodMiniString<string>;
|
|
10
|
+
}, z.core.$strict>>>;
|
|
11
|
+
}, z.core.$strict>>;
|
|
12
|
+
export type DeviceScreenSpec = z.infer<typeof DeviceScreenSpec>;
|
|
13
|
+
export type DevicesSpec = z.infer<typeof DevicesSpec>;
|
|
14
|
+
//# sourceMappingURL=devices-spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devices-spec.d.ts","sourceRoot":"","sources":["../../src/document/devices-spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,kBAAkB,CAAC;AAsBtC,eAAO,MAAM,gBAAgB;;;mBAA0C,CAAC;AACxE,eAAO,MAAM,WAAW;;;;;mBAAqC,CAAC;AAC9D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAChE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as z from "../schema/zod.js";
|
|
2
|
+
/*
|
|
3
|
+
* A DOCUMENT'S DEVICE SCREENS, as a shape (Roadmap f-device-nav-bar): a page
|
|
4
|
+
* that draws an app reads `devices` loosely and offers no strip, so this is
|
|
5
|
+
* reached only by the checker (`documentDeviceFindings`), an edit
|
|
6
|
+
* (`add-device-screen`) and the JSON schema an editor reads. What a screen
|
|
7
|
+
* names and how long its word is are the checker's (`device-*`), in words.
|
|
8
|
+
*/
|
|
9
|
+
/* Built the first time a screen is read (each shape is `z.lazy` over it), not when the module loads. */
|
|
10
|
+
function build() {
|
|
11
|
+
const str = (min, max) => z.string().check(z.minLength(min), z.maxLength(max));
|
|
12
|
+
/** One press of the strip: the place it shows (`home`, `tasks`, `/places/the-week`, `job:<name>`) and the word under it. */
|
|
13
|
+
const DeviceScreenSpec = z.strictObject({ place: str(1, 200), label: str(1, 200) });
|
|
14
|
+
/** The strip's screens in order; the checker holds how many (`device-screens-too-many`). */
|
|
15
|
+
const DevicesSpec = z.strictObject({ screens: z.optional(z.array(DeviceScreenSpec).check(z.maxLength(40))) });
|
|
16
|
+
return { DeviceScreenSpec, DevicesSpec };
|
|
17
|
+
}
|
|
18
|
+
let built;
|
|
19
|
+
const shapes = () => (built ??= build());
|
|
20
|
+
export const DeviceScreenSpec = z.lazy(() => shapes().DeviceScreenSpec);
|
|
21
|
+
export const DevicesSpec = z.lazy(() => shapes().DevicesSpec);
|
|
22
|
+
//# sourceMappingURL=devices-spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devices-spec.js","sourceRoot":"","sources":["../../src/document/devices-spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,kBAAkB,CAAC;AAEtC;;;;;;GAMG;AAEH,wGAAwG;AACxG,SAAS,KAAK;IACZ,MAAM,GAAG,GAAG,CAAC,GAAW,EAAE,GAAW,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/F,4HAA4H;IAC5H,MAAM,gBAAgB,GAAG,CAAC,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;IACpF,4FAA4F;IAC5F,MAAM,WAAW,GAAG,CAAC,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC9G,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAC;AAC3C,CAAC;AACD,IAAI,KAA2C,CAAC;AAChD,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC,CAAC;AAEzC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,gBAAgB,CAAC,CAAC;AACxE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,CAAC"}
|
package/dist/document/edit.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export interface EditOptions {
|
|
|
40
40
|
readonly resolveFarApp?: FarAppResolver;
|
|
41
41
|
}
|
|
42
42
|
/** The ops, for tool schemas and the guide. */
|
|
43
|
-
export declare const EDIT_OPS: readonly ["add-kind", "rename-kind", "remove-kind", "add-field", "rename-field", "retype-field", "set-options", "set-range", "set-format", "set-required", "set-default", "set-repeats", "remove-field", "add-relation", "rename-relation", "remove-relation", "add-act", "remove-act", "add-rule", "remove-rule", "set-brand", "set-name", "set-description", "set-label", "set-describe", "set-view", "rename-view", "set-glance", "set-page-fields", "add-lens", "remove-lens", "set-lens-hidden", "set-lens-export", "set-home", "arrange-pages", "set-computed", "set-people", "set-archives", "set-tidying", "set-app-tidying", "set-derives", "add-grant", "remove-grant", "add-sight", "remove-sight", "set-purpose", "add-job", "edit-job", "remove-job", "add-alias", "set-aliases", "set-connection", "add-workflow", "set-workflow", "remove-workflow", "pause-workflow", "resume-workflow"];
|
|
43
|
+
export declare const EDIT_OPS: readonly ["add-kind", "rename-kind", "remove-kind", "add-field", "rename-field", "retype-field", "set-options", "set-range", "set-format", "set-required", "set-default", "set-repeats", "remove-field", "add-relation", "rename-relation", "remove-relation", "add-act", "remove-act", "add-rule", "remove-rule", "set-brand", "set-name", "set-description", "set-label", "set-describe", "set-view", "rename-view", "set-glance", "set-page-fields", "add-lens", "remove-lens", "set-lens-hidden", "set-lens-export", "set-home", "arrange-pages", "set-computed", "set-people", "set-archives", "set-tidying", "set-app-tidying", "set-derives", "add-grant", "remove-grant", "add-sight", "remove-sight", "set-purpose", "add-job", "edit-job", "remove-job", "add-device-screen", "move-device-screen", "remove-device-screen", "add-alias", "set-aliases", "set-connection", "add-workflow", "set-workflow", "remove-workflow", "pause-workflow", "resume-workflow"];
|
|
44
44
|
export type EditOp = (typeof EDIT_OPS)[number];
|
|
45
45
|
/** One edit as `editDocument` takes it: an op from EDIT_OPS and that op's own keys. */
|
|
46
46
|
export type DocumentEdit = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../src/document/edit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAQ1D,OAAO,EAAS,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../src/document/edit.ts"],"names":[],"mappings":"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E,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAiBjL"}
|
package/dist/document/edit.js
CHANGED
|
@@ -17,6 +17,11 @@ const refusedFormat = (format, type) => {
|
|
|
17
17
|
import { farEnd } from "./far-end.js";
|
|
18
18
|
import { jobFindings, jobWorldOfDocument } from "../job-findings.js";
|
|
19
19
|
import { JobSpec } from "./purpose-spec.js";
|
|
20
|
+
import { DeviceScreenSpec } from "./devices-spec.js";
|
|
21
|
+
import { deviceFindings } from "../device-findings.js";
|
|
22
|
+
import { screenGo, screenPlaceOf } from "../device-screens.js";
|
|
23
|
+
import { placesOf } from "../app-places.js";
|
|
24
|
+
import { compileDocumentWithoutCheck } from "./compile.js";
|
|
20
25
|
import { WORKFLOW_JUDGING } from "../workflows/judging.js";
|
|
21
26
|
import { aliasWord, documentAliasFindings } from "../alias-findings.js";
|
|
22
27
|
import { humanizeField, withArticle } from "../schema/define-node.js";
|
|
@@ -98,6 +103,9 @@ export const EDIT_OPS = [
|
|
|
98
103
|
"add-job",
|
|
99
104
|
"edit-job",
|
|
100
105
|
"remove-job",
|
|
106
|
+
"add-device-screen",
|
|
107
|
+
"move-device-screen",
|
|
108
|
+
"remove-device-screen",
|
|
101
109
|
"add-alias",
|
|
102
110
|
"set-aliases",
|
|
103
111
|
"set-connection",
|
|
@@ -300,6 +308,11 @@ function buildShapes() {
|
|
|
300
308
|
})
|
|
301
309
|
.strict(),
|
|
302
310
|
"remove-job": z.object({ op: z.literal("remove-job"), name: jobName }).strict(),
|
|
311
|
+
// A device's screen (`devices.screens[]`, Roadmap f-device-nav-bar): a place and the word under its press, placed at `at` or last.
|
|
312
|
+
"add-device-screen": z.object({ op: z.literal("add-device-screen"), screen: z.record(z.string(), z.unknown()), at: z.number().int().min(0).optional() }).strict(),
|
|
313
|
+
// A screen by the place it shows, moved to `to` (0 first).
|
|
314
|
+
"move-device-screen": z.object({ op: z.literal("move-device-screen"), place: z.string().min(1).max(200), to: z.number().int().min(0) }).strict(),
|
|
315
|
+
"remove-device-screen": z.object({ op: z.literal("remove-device-screen"), place: z.string().min(1).max(200) }).strict(),
|
|
303
316
|
// Another word people use for a kind, or for one of its fields (Roadmap f-learned-suggestions).
|
|
304
317
|
"add-alias": z.object({ op: z.literal("add-alias"), kind: kindName, field: fieldName.optional(), alias: z.string().min(1).max(40) }).strict(),
|
|
305
318
|
// All of a kind's or a field's other words at once; null or [] takes them away.
|
|
@@ -625,6 +638,8 @@ class Editor {
|
|
|
625
638
|
kindOrigin = new Map();
|
|
626
639
|
fieldOrigin = new Map();
|
|
627
640
|
edgeOrigin = new Map();
|
|
641
|
+
/** A lens drawn anew under another title: its title's address word now, and the one it had in the base document. */
|
|
642
|
+
lensOrigin = new Map();
|
|
628
643
|
constructor(doc, base, options = {}) {
|
|
629
644
|
this.doc = doc;
|
|
630
645
|
this.options = options;
|
|
@@ -1162,6 +1177,12 @@ class Editor {
|
|
|
1162
1177
|
return this.editJob(i, e);
|
|
1163
1178
|
case "remove-job":
|
|
1164
1179
|
return this.removeJob(i, e.name);
|
|
1180
|
+
case "add-device-screen":
|
|
1181
|
+
return this.addDeviceScreen(i, e);
|
|
1182
|
+
case "move-device-screen":
|
|
1183
|
+
return this.moveDeviceScreen(i, e);
|
|
1184
|
+
case "remove-device-screen":
|
|
1185
|
+
return this.removeDeviceScreen(i, e.place);
|
|
1165
1186
|
case "add-alias":
|
|
1166
1187
|
return this.setAliases(i, e.kind, e.field, [...this.aliasesOf(e.kind, e.field), e.alias], e.alias);
|
|
1167
1188
|
case "set-aliases":
|
|
@@ -1333,6 +1354,144 @@ class Editor {
|
|
|
1333
1354
|
this.keepPurpose({ ...this.doc.purpose });
|
|
1334
1355
|
this.said.push(`The job "${job.name}" (${quotedAtTheEnd(job.ask)}) is removed.`);
|
|
1335
1356
|
}
|
|
1357
|
+
// ── the screens a device offers (Roadmap f-device-nav-bar) ──
|
|
1358
|
+
/** The screens as they now stand, or no `devices` when there are none. */
|
|
1359
|
+
keepScreens(screens) {
|
|
1360
|
+
if (screens.length === 0)
|
|
1361
|
+
delete this.doc.devices;
|
|
1362
|
+
else
|
|
1363
|
+
this.doc.devices = { ...(this.doc.devices ?? {}), screens };
|
|
1364
|
+
}
|
|
1365
|
+
/** The screen that shows a place, by the word the document names it with; -1 having said why. */
|
|
1366
|
+
screenIndex(i, place) {
|
|
1367
|
+
const screens = this.doc.devices?.screens ?? [];
|
|
1368
|
+
const index = screens.findIndex((screen) => screen.place === place);
|
|
1369
|
+
if (index < 0)
|
|
1370
|
+
this.fail(i, "place", `no device screen shows "${place}"${screens.length > 0 ? `; the screens show ${screens.map((screen) => `"${screen.place}"`).join(", ")}` : ""}`);
|
|
1371
|
+
return index;
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* The screens placed, judged as `graview check` judges them (`device-*`)
|
|
1375
|
+
* over the app the document compiles to: kept only when this change makes
|
|
1376
|
+
* nothing wrong. A document that does not compile yet is judged by what a
|
|
1377
|
+
* screen says alone, and its own faults are the compile's to say.
|
|
1378
|
+
*/
|
|
1379
|
+
placeScreens(i, screens, at) {
|
|
1380
|
+
const compiled = compileDocumentWithoutCheck({ ...this.doc, devices: { screens } });
|
|
1381
|
+
// The screen placed is held to all it says — and to the screen already there for its place, wherever along the strip either stands.
|
|
1382
|
+
const goes = (index) => {
|
|
1383
|
+
if (!compiled.ok || index === undefined || typeof screens[index]?.place !== "string")
|
|
1384
|
+
return undefined;
|
|
1385
|
+
const found = screenPlaceOf(compiled.app, screens[index].place);
|
|
1386
|
+
return found ? screenGo(found) : undefined;
|
|
1387
|
+
};
|
|
1388
|
+
const wrong = compiled.ok
|
|
1389
|
+
? deviceFindings({ screens: screens }, compiled.app).filter((finding) => finding.severity === "error" &&
|
|
1390
|
+
(finding.index === undefined || finding.index === at || (finding.code === "device-screen-twice" && goes(finding.index) !== undefined && goes(finding.index) === goes(at))))
|
|
1391
|
+
: [];
|
|
1392
|
+
for (const finding of wrong)
|
|
1393
|
+
this.failAs(finding.code, i, finding.index === undefined ? "" : `screen.${finding.key ?? ""}`, finding.message, finding.fix);
|
|
1394
|
+
if (wrong.length > 0)
|
|
1395
|
+
return false;
|
|
1396
|
+
this.keepScreens(screens);
|
|
1397
|
+
return true;
|
|
1398
|
+
}
|
|
1399
|
+
addDeviceScreen(i, e) {
|
|
1400
|
+
const parsed = DeviceScreenSpec.safeParse(e.screen);
|
|
1401
|
+
if (!parsed.success)
|
|
1402
|
+
return this.refuse(i, parsed.error.issues.map((issue) => ({ ...issue, path: ["screen", ...issue.path] })), "a device screen");
|
|
1403
|
+
const screen = parsed.data;
|
|
1404
|
+
const screens = [...(this.doc.devices?.screens ?? [])];
|
|
1405
|
+
const at = Math.min(e.at ?? screens.length, screens.length);
|
|
1406
|
+
screens.splice(at, 0, screen);
|
|
1407
|
+
if (!this.placeScreens(i, screens, at))
|
|
1408
|
+
return;
|
|
1409
|
+
this.said.push(`A device screen, ${quoted(screen.label)}, shows ${quoted(screen.place)}${screens.length > 1 ? `, ${at === 0 ? "first" : at === screens.length - 1 ? "last" : `at ${at + 1} of ${screens.length}`} along the strip` : ""}.`);
|
|
1410
|
+
}
|
|
1411
|
+
moveDeviceScreen(i, e) {
|
|
1412
|
+
const index = this.screenIndex(i, e.place);
|
|
1413
|
+
if (index < 0)
|
|
1414
|
+
return;
|
|
1415
|
+
const screens = [...this.doc.devices.screens];
|
|
1416
|
+
const [screen] = screens.splice(index, 1);
|
|
1417
|
+
const to = Math.min(e.to, screens.length);
|
|
1418
|
+
screens.splice(to, 0, screen);
|
|
1419
|
+
this.keepScreens(screens);
|
|
1420
|
+
this.said.push(`The device screen ${quoted(screen.label)} is now ${to === 0 ? "first" : to === screens.length - 1 ? "last" : `${to + 1} of ${screens.length}`} along the strip.`);
|
|
1421
|
+
}
|
|
1422
|
+
removeDeviceScreen(i, place) {
|
|
1423
|
+
const index = this.screenIndex(i, place);
|
|
1424
|
+
if (index < 0)
|
|
1425
|
+
return;
|
|
1426
|
+
const screens = [...this.doc.devices.screens];
|
|
1427
|
+
const [screen] = screens.splice(index, 1);
|
|
1428
|
+
this.keepScreens(screens);
|
|
1429
|
+
this.said.push(`The device screen ${quoted(screen.label)} (${quotedAtTheEnd(screen.place)}) is taken off the strip${screens.length === 0 ? "; with none declared, a device offers the home and the app's jobs, else its bar" : ""}.`);
|
|
1430
|
+
}
|
|
1431
|
+
/**
|
|
1432
|
+
* THE STRIP FOLLOWS WHAT IT SHOWS, as a job follows its kind: once the
|
|
1433
|
+
* change is whole, a screen whose place was renamed — a kind's list under
|
|
1434
|
+
* its new plural, a lens drawn anew under another title — names it by its
|
|
1435
|
+
* new address word, and a screen whose place is gone (a kind, a lens or a
|
|
1436
|
+
* job taken away) leaves the strip. A screen that named nothing before is
|
|
1437
|
+
* its own edit's to answer for.
|
|
1438
|
+
*/
|
|
1439
|
+
followScreens(base) {
|
|
1440
|
+
const screens = this.doc.devices?.screens;
|
|
1441
|
+
if (!Array.isArray(screens) || screens.length === 0)
|
|
1442
|
+
return;
|
|
1443
|
+
// Nothing a place is made of changed — kinds and their words, lenses, jobs, the arrangement: no screen moved, and nothing is compiled.
|
|
1444
|
+
if (placesSaid(base) === placesSaid(this.doc))
|
|
1445
|
+
return;
|
|
1446
|
+
const before = compileDocumentWithoutCheck(base);
|
|
1447
|
+
const after = compileDocumentWithoutCheck(this.doc);
|
|
1448
|
+
if (!before.ok || !after.ok)
|
|
1449
|
+
return;
|
|
1450
|
+
const placesBefore = placesOf(before.app);
|
|
1451
|
+
const placesAfter = placesOf(after.app);
|
|
1452
|
+
const kept = [];
|
|
1453
|
+
for (const screen of screens) {
|
|
1454
|
+
const was = typeof screen.place === "string" ? screenPlaceOf(before.app, screen.place, placesBefore) : undefined;
|
|
1455
|
+
if (!was) {
|
|
1456
|
+
kept.push(screen);
|
|
1457
|
+
continue;
|
|
1458
|
+
}
|
|
1459
|
+
const moved = this.followedPlace(was, after.app, placesAfter);
|
|
1460
|
+
if (!moved) {
|
|
1461
|
+
this.said.push(`The device screen ${quoted(screen.label)} is taken off the strip: ${quoted(screen.place)} is no longer a place of the app.`);
|
|
1462
|
+
continue;
|
|
1463
|
+
}
|
|
1464
|
+
const now = screenPlaceOf(after.app, screen.place, placesAfter);
|
|
1465
|
+
if (now && screenGo(now) === screenGo(moved)) {
|
|
1466
|
+
kept.push(screen);
|
|
1467
|
+
continue;
|
|
1468
|
+
}
|
|
1469
|
+
// By its address, which no other place answers to: a lens titled as a kind's list takes the word, not the address.
|
|
1470
|
+
const word = moved.is === "job" ? `job:${moved.job.name}` : moved.place.address;
|
|
1471
|
+
this.said.push(moved.is === "place" && was.is === "place" && moved.place.address === was.place.address
|
|
1472
|
+
? `The device screen ${quoted(screen.label)} names its place by its address, ${quoted(word)}: another place now answers to ${quoted(screen.place)}.`
|
|
1473
|
+
: `The device screen ${quoted(screen.label)} follows its place to ${quoted(word)}.`);
|
|
1474
|
+
kept.push({ ...screen, place: word });
|
|
1475
|
+
}
|
|
1476
|
+
this.keepScreens(kept);
|
|
1477
|
+
}
|
|
1478
|
+
/** Where a place of the base document is now: the same job, the home, a kind's list under the kind's new name, a lens under its new title. */
|
|
1479
|
+
followedPlace(was, app, places) {
|
|
1480
|
+
if (was.is === "job")
|
|
1481
|
+
return screenPlaceOf(app, `job:${was.job.name}`, places);
|
|
1482
|
+
const place = was.place;
|
|
1483
|
+
if (place.kind === null) {
|
|
1484
|
+
const same = places.find((one) => one.slug === place.slug);
|
|
1485
|
+
return same ? { is: "place", place: same } : undefined;
|
|
1486
|
+
}
|
|
1487
|
+
const kind = [...this.kindOrigin].find(([, origin]) => origin === place.kind)?.[0];
|
|
1488
|
+
if (kind === undefined)
|
|
1489
|
+
return undefined;
|
|
1490
|
+
const pictured = place.address.startsWith("/places/");
|
|
1491
|
+
const slug = pictured ? ([...this.lensOrigin].find(([, origin]) => origin === place.slug)?.[0] ?? place.slug) : undefined;
|
|
1492
|
+
const found = places.find((one) => one.kind === kind && (pictured ? one.address.startsWith("/places/") && one.slug === slug : !one.address.startsWith("/places/")));
|
|
1493
|
+
return found ? { is: "place", place: found } : undefined;
|
|
1494
|
+
}
|
|
1336
1495
|
// ── what the app does on its own, and when (Roadmap f-jobs-declared) ──
|
|
1337
1496
|
/** The workflow a name names, or undefined having said why. */
|
|
1338
1497
|
workflowNamed(i, name) {
|
|
@@ -1507,6 +1666,13 @@ class Editor {
|
|
|
1507
1666
|
if (at < 0)
|
|
1508
1667
|
return;
|
|
1509
1668
|
was = lenses[at];
|
|
1669
|
+
// A device's screen of the lens follows it to its new title (`followScreens`).
|
|
1670
|
+
const before = typeof was?.["title"] === "string" ? placeSlug(was["title"]) : undefined;
|
|
1671
|
+
if (before !== undefined && placeSlug(e.title) !== before) {
|
|
1672
|
+
// Retitled again in the same change, onward or back: one entry, from the title it had in the base document.
|
|
1673
|
+
this.lensOrigin.set(placeSlug(e.title), this.lensOrigin.get(before) ?? before);
|
|
1674
|
+
this.lensOrigin.delete(before);
|
|
1675
|
+
}
|
|
1510
1676
|
}
|
|
1511
1677
|
// A lens drawn anew in another's place stays off the lists if that one was.
|
|
1512
1678
|
const lens = { name, title: e.title, ...(e.on !== undefined ? { on: e.on } : {}), ...(e.bindings !== undefined ? { bindings: e.bindings } : {}), ...(e.options !== undefined ? { options: e.options } : {}), ...(was?.["hidden"] === true ? { hidden: true } : {}), ...(was?.["export"] === false ? { export: false } : {}), ...(e.create === false ? { create: false } : {}) };
|
|
@@ -4385,6 +4551,8 @@ export function editDocument(document, edits, options = {}) {
|
|
|
4385
4551
|
});
|
|
4386
4552
|
if (editor.findings.length > 0)
|
|
4387
4553
|
return { ok: false, findings: editor.findings };
|
|
4554
|
+
// A device's screens follow a place renamed, and leave with one taken away (Roadmap f-device-nav-bar).
|
|
4555
|
+
editor.followScreens(current);
|
|
4388
4556
|
/*
|
|
4389
4557
|
* WHAT THE PEOPLE AND THE POLICY MAKE TOGETHER, judged once the change is
|
|
4390
4558
|
* whole (FR-170): moving the people from one kind to another is two edits,
|
|
@@ -4410,6 +4578,10 @@ export function editDocument(document, edits, options = {}) {
|
|
|
4410
4578
|
}
|
|
4411
4579
|
return { ok: true, document: editor.doc, said: editor.said, fills: editor.fills };
|
|
4412
4580
|
}
|
|
4581
|
+
/** What a document's places are made of, as one string: its kinds and their words, its lenses, its jobs and its arrangement. */
|
|
4582
|
+
function placesSaid(doc) {
|
|
4583
|
+
return JSON.stringify([Object.entries(doc.kinds ?? {}).map(([kind, spec]) => [kind, spec.plural ?? null, spec.noun ?? null]), doc.lenses ?? null, (doc.purpose?.jobs ?? []).map((job) => [job.name, job.kind, job.roles ?? null]), doc.pages ?? null, Boolean(doc.views?.home)]);
|
|
4584
|
+
}
|
|
4413
4585
|
/**
|
|
4414
4586
|
* ONE RENAME, WHEREVER IT IS WRITTEN (FR-34). The walk `editDocument` renames
|
|
4415
4587
|
* with — which kind each bare name reads from, a quoted word left alone,
|