@jam-overture/loom 0.1.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 +21 -0
- package/README.md +743 -0
- package/dist/catalogue.d.ts +70 -0
- package/dist/catalogue.js +88 -0
- package/dist/cli/args.d.ts +17 -0
- package/dist/cli/args.js +83 -0
- package/dist/cli/filesystem.d.ts +15 -0
- package/dist/cli/filesystem.js +31 -0
- package/dist/cli/index.d.ts +12 -0
- package/dist/cli/index.js +12 -0
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.js +30 -0
- package/dist/cli/namespace.d.ts +40 -0
- package/dist/cli/namespace.js +40 -0
- package/dist/cli/plan.d.ts +84 -0
- package/dist/cli/plan.js +113 -0
- package/dist/cli/run.d.ts +17 -0
- package/dist/cli/run.js +75 -0
- package/dist/cli/templates.d.ts +43 -0
- package/dist/cli/templates.js +134 -0
- package/dist/closed-set.d.ts +34 -0
- package/dist/closed-set.js +34 -0
- package/dist/data/adapter.d.ts +123 -0
- package/dist/data/adapter.js +91 -0
- package/dist/data/binding.d.ts +48 -0
- package/dist/data/binding.js +39 -0
- package/dist/data/catalogue.d.ts +26 -0
- package/dist/data/catalogue.js +6 -0
- package/dist/data/index.d.ts +14 -0
- package/dist/data/index.js +14 -0
- package/dist/data/plan.d.ts +58 -0
- package/dist/data/plan.js +0 -0
- package/dist/data/resolution.d.ts +91 -0
- package/dist/data/resolution.js +96 -0
- package/dist/data/resolve.d.ts +46 -0
- package/dist/data/resolve.js +37 -0
- package/dist/data/source.d.ts +40 -0
- package/dist/data/source.js +45 -0
- package/dist/deadline.d.ts +57 -0
- package/dist/deadline.js +78 -0
- package/dist/frame/catalogue.d.ts +24 -0
- package/dist/frame/catalogue.js +5 -0
- package/dist/frame/index.d.ts +12 -0
- package/dist/frame/index.js +12 -0
- package/dist/frame/origin.d.ts +87 -0
- package/dist/frame/origin.js +114 -0
- package/dist/frame/resolution.d.ts +85 -0
- package/dist/frame/resolution.js +79 -0
- package/dist/grammar.d.ts +26 -0
- package/dist/grammar.js +28 -0
- package/dist/ids.d.ts +57 -0
- package/dist/ids.js +104 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +26 -0
- package/dist/interactivity.d.ts +50 -0
- package/dist/interactivity.js +22 -0
- package/dist/interpretation/anthropic.d.ts +22 -0
- package/dist/interpretation/anthropic.js +76 -0
- package/dist/interpretation/client.d.ts +83 -0
- package/dist/interpretation/client.js +2 -0
- package/dist/interpretation/draft.d.ts +234 -0
- package/dist/interpretation/draft.js +84 -0
- package/dist/interpretation/index.d.ts +15 -0
- package/dist/interpretation/index.js +15 -0
- package/dist/interpretation/interpreter.d.ts +62 -0
- package/dist/interpretation/interpreter.js +151 -0
- package/dist/interpretation/materialize.d.ts +42 -0
- package/dist/interpretation/materialize.js +107 -0
- package/dist/interpretation/prompt.d.ts +229 -0
- package/dist/interpretation/prompt.js +285 -0
- package/dist/interpretation/render.d.ts +76 -0
- package/dist/interpretation/render.js +272 -0
- package/dist/interpretation/schema.d.ts +49 -0
- package/dist/interpretation/schema.js +131 -0
- package/dist/json.d.ts +35 -0
- package/dist/json.js +11 -0
- package/dist/paging.d.ts +60 -0
- package/dist/paging.js +49 -0
- package/dist/primitive-type.d.ts +32 -0
- package/dist/primitive-type.js +39 -0
- package/dist/render/addressing.d.ts +59 -0
- package/dist/render/addressing.js +60 -0
- package/dist/render/anchor.d.ts +105 -0
- package/dist/render/anchor.js +84 -0
- package/dist/render/behaviour-adjust.d.ts +62 -0
- package/dist/render/behaviour-adjust.js +78 -0
- package/dist/render/behaviour-copy.d.ts +53 -0
- package/dist/render/behaviour-copy.js +75 -0
- package/dist/render/behaviour-disclose.d.ts +74 -0
- package/dist/render/behaviour-disclose.js +77 -0
- package/dist/render/behaviour-present.d.ts +123 -0
- package/dist/render/behaviour-present.js +173 -0
- package/dist/render/behaviour.d.ts +243 -0
- package/dist/render/behaviour.js +284 -0
- package/dist/render/control.d.ts +81 -0
- package/dist/render/control.js +80 -0
- package/dist/render/decorative.d.ts +62 -0
- package/dist/render/decorative.js +2 -0
- package/dist/render/diagnostics.d.ts +260 -0
- package/dist/render/diagnostics.js +61 -0
- package/dist/render/disclosed.d.ts +37 -0
- package/dist/render/disclosed.js +37 -0
- package/dist/render/editable.d.ts +34 -0
- package/dist/render/editable.js +35 -0
- package/dist/render/frame.d.ts +42 -0
- package/dist/render/frame.js +31 -0
- package/dist/render/index.d.ts +35 -0
- package/dist/render/index.js +35 -0
- package/dist/render/inline-variables.d.ts +77 -0
- package/dist/render/inline-variables.js +220 -0
- package/dist/render/presented.d.ts +82 -0
- package/dist/render/presented.js +82 -0
- package/dist/render/primitive.d.ts +228 -0
- package/dist/render/primitive.js +36 -0
- package/dist/render/props.d.ts +48 -0
- package/dist/render/props.js +2 -0
- package/dist/render/reads.d.ts +73 -0
- package/dist/render/reads.js +45 -0
- package/dist/render/render.d.ts +164 -0
- package/dist/render/render.js +571 -0
- package/dist/render/request.d.ts +111 -0
- package/dist/render/request.js +60 -0
- package/dist/render/text.d.ts +91 -0
- package/dist/render/text.js +44 -0
- package/dist/render/theme.d.ts +61 -0
- package/dist/render/theme.js +52 -0
- package/dist/reserved-props.d.ts +35 -0
- package/dist/reserved-props.js +45 -0
- package/dist/result.d.ts +27 -0
- package/dist/result.js +30 -0
- package/dist/role.d.ts +71 -0
- package/dist/role.js +22 -0
- package/dist/runtime/analysis.d.ts +149 -0
- package/dist/runtime/analysis.js +187 -0
- package/dist/runtime/assessment.d.ts +35 -0
- package/dist/runtime/assessment.js +13 -0
- package/dist/runtime/disposition.d.ts +102 -0
- package/dist/runtime/disposition.js +59 -0
- package/dist/runtime/events.d.ts +187 -0
- package/dist/runtime/events.js +7 -0
- package/dist/runtime/gate.d.ts +43 -0
- package/dist/runtime/gate.js +169 -0
- package/dist/runtime/index.d.ts +27 -0
- package/dist/runtime/index.js +27 -0
- package/dist/runtime/intent.d.ts +60 -0
- package/dist/runtime/intent.js +36 -0
- package/dist/runtime/interpreter.d.ts +117 -0
- package/dist/runtime/interpreter.js +46 -0
- package/dist/runtime/inverse-interpreter.d.ts +90 -0
- package/dist/runtime/inverse-interpreter.js +56 -0
- package/dist/runtime/inverse.d.ts +87 -0
- package/dist/runtime/inverse.js +48 -0
- package/dist/runtime/narration.d.ts +24 -0
- package/dist/runtime/narration.js +36 -0
- package/dist/runtime/nesting.d.ts +31 -0
- package/dist/runtime/nesting.js +46 -0
- package/dist/runtime/pipeline.d.ts +124 -0
- package/dist/runtime/pipeline.js +178 -0
- package/dist/runtime/policy-fingerprint.d.ts +29 -0
- package/dist/runtime/policy-fingerprint.js +119 -0
- package/dist/runtime/policy-source.d.ts +42 -0
- package/dist/runtime/policy-source.js +8 -0
- package/dist/runtime/policy.d.ts +156 -0
- package/dist/runtime/policy.js +107 -0
- package/dist/runtime/proposal.d.ts +423 -0
- package/dist/runtime/proposal.js +109 -0
- package/dist/runtime/redirection.d.ts +53 -0
- package/dist/runtime/redirection.js +38 -0
- package/dist/runtime/repointing.d.ts +71 -0
- package/dist/runtime/repointing.js +0 -0
- package/dist/runtime/reversibility.d.ts +36 -0
- package/dist/runtime/reversibility.js +39 -0
- package/dist/runtime/stake-level.d.ts +33 -0
- package/dist/runtime/stake-level.js +58 -0
- package/dist/runtime/stakes.d.ts +47 -0
- package/dist/runtime/stakes.js +305 -0
- package/dist/runtime/vocabulary.d.ts +122 -0
- package/dist/runtime/vocabulary.js +87 -0
- package/dist/sdk/audit.d.ts +195 -0
- package/dist/sdk/audit.js +128 -0
- package/dist/sdk/catalogue.d.ts +37 -0
- package/dist/sdk/catalogue.js +16 -0
- package/dist/sdk/conformance.d.ts +342 -0
- package/dist/sdk/conformance.js +494 -0
- package/dist/sdk/copy.d.ts +105 -0
- package/dist/sdk/copy.js +90 -0
- package/dist/sdk/definition.d.ts +242 -0
- package/dist/sdk/definition.js +64 -0
- package/dist/sdk/index.d.ts +19 -0
- package/dist/sdk/index.js +19 -0
- package/dist/sdk/interactivity.d.ts +29 -0
- package/dist/sdk/interactivity.js +34 -0
- package/dist/sdk/pairings.d.ts +124 -0
- package/dist/sdk/pairings.js +81 -0
- package/dist/sdk/registry.d.ts +162 -0
- package/dist/sdk/registry.js +329 -0
- package/dist/sdk/selection.d.ts +46 -0
- package/dist/sdk/selection.js +24 -0
- package/dist/sdk/text.d.ts +100 -0
- package/dist/sdk/text.js +105 -0
- package/dist/sdk/vocabulary.d.ts +39 -0
- package/dist/sdk/vocabulary.js +36 -0
- package/dist/signals/broadcast.d.ts +134 -0
- package/dist/signals/broadcast.js +451 -0
- package/dist/signals/collect.d.ts +184 -0
- package/dist/signals/collect.js +196 -0
- package/dist/signals/deliver.d.ts +64 -0
- package/dist/signals/deliver.js +85 -0
- package/dist/signals/fold.d.ts +112 -0
- package/dist/signals/fold.js +76 -0
- package/dist/signals/index.d.ts +31 -0
- package/dist/signals/index.js +31 -0
- package/dist/signals/ingest.d.ts +51 -0
- package/dist/signals/ingest.js +70 -0
- package/dist/signals/intake.d.ts +149 -0
- package/dist/signals/intake.js +154 -0
- package/dist/signals/journal.d.ts +94 -0
- package/dist/signals/journal.js +11 -0
- package/dist/signals/kinds.d.ts +22 -0
- package/dist/signals/kinds.js +22 -0
- package/dist/signals/ledger.d.ts +46 -0
- package/dist/signals/ledger.js +81 -0
- package/dist/signals/memory.d.ts +17 -0
- package/dist/signals/memory.js +99 -0
- package/dist/signals/migrate.d.ts +27 -0
- package/dist/signals/migrate.js +78 -0
- package/dist/signals/postgres.d.ts +7 -0
- package/dist/signals/postgres.js +295 -0
- package/dist/signals/rollup.d.ts +142 -0
- package/dist/signals/rollup.js +0 -0
- package/dist/signals/schema.d.ts +534 -0
- package/dist/signals/schema.js +92 -0
- package/dist/signals/signal.d.ts +381 -0
- package/dist/signals/signal.js +150 -0
- package/dist/signals/tally.d.ts +70 -0
- package/dist/signals/tally.js +2 -0
- package/dist/signals/view.d.ts +51 -0
- package/dist/signals/view.js +54 -0
- package/dist/store/attribution.d.ts +125 -0
- package/dist/store/attribution.js +116 -0
- package/dist/store/database.d.ts +14 -0
- package/dist/store/database.js +2 -0
- package/dist/store/driver.d.ts +29 -0
- package/dist/store/driver.js +39 -0
- package/dist/store/errors.d.ts +56 -0
- package/dist/store/errors.js +37 -0
- package/dist/store/index.d.ts +16 -0
- package/dist/store/index.js +16 -0
- package/dist/store/memory.d.ts +3 -0
- package/dist/store/memory.js +115 -0
- package/dist/store/migrate.d.ts +54 -0
- package/dist/store/migrate.js +122 -0
- package/dist/store/postgres-holds.d.ts +4 -0
- package/dist/store/postgres-holds.js +192 -0
- package/dist/store/postgres.d.ts +8 -0
- package/dist/store/postgres.js +262 -0
- package/dist/store/replay.d.ts +94 -0
- package/dist/store/replay.js +82 -0
- package/dist/store/revert.d.ts +116 -0
- package/dist/store/revert.js +243 -0
- package/dist/store/schema.d.ts +371 -0
- package/dist/store/schema.js +78 -0
- package/dist/store/source.d.ts +23 -0
- package/dist/store/source.js +37 -0
- package/dist/store/store.d.ts +231 -0
- package/dist/store/store.js +52 -0
- package/dist/store/undone.d.ts +18 -0
- package/dist/store/undone.js +89 -0
- package/dist/submit/catalogue.d.ts +20 -0
- package/dist/submit/catalogue.js +5 -0
- package/dist/submit/declaration.d.ts +39 -0
- package/dist/submit/declaration.js +30 -0
- package/dist/submit/endpoint.d.ts +131 -0
- package/dist/submit/endpoint.js +160 -0
- package/dist/submit/index.d.ts +13 -0
- package/dist/submit/index.js +13 -0
- package/dist/submit/plan.d.ts +49 -0
- package/dist/submit/plan.js +47 -0
- package/dist/submit/resolution.d.ts +61 -0
- package/dist/submit/resolution.js +64 -0
- package/dist/submit/resolve.d.ts +45 -0
- package/dist/submit/resolve.js +36 -0
- package/dist/telemetry/calibration.d.ts +132 -0
- package/dist/telemetry/calibration.js +151 -0
- package/dist/telemetry/episode.d.ts +140 -0
- package/dist/telemetry/episode.js +272 -0
- package/dist/telemetry/event.d.ts +2310 -0
- package/dist/telemetry/event.js +405 -0
- package/dist/telemetry/index.d.ts +15 -0
- package/dist/telemetry/index.js +15 -0
- package/dist/telemetry/journal.d.ts +116 -0
- package/dist/telemetry/journal.js +11 -0
- package/dist/telemetry/memory.d.ts +24 -0
- package/dist/telemetry/memory.js +75 -0
- package/dist/telemetry/migrate.d.ts +26 -0
- package/dist/telemetry/migrate.js +40 -0
- package/dist/telemetry/postgres.d.ts +6 -0
- package/dist/telemetry/postgres.js +139 -0
- package/dist/telemetry/retention.d.ts +131 -0
- package/dist/telemetry/retention.js +217 -0
- package/dist/telemetry/schema.d.ts +113 -0
- package/dist/telemetry/schema.js +33 -0
- package/dist/telemetry/sink.d.ts +42 -0
- package/dist/telemetry/sink.js +61 -0
- package/dist/testing/contracts.d.ts +34 -0
- package/dist/testing/contracts.js +34 -0
- package/dist/testing/definitions.d.ts +15 -0
- package/dist/testing/definitions.js +48 -0
- package/dist/testing/doubles.d.ts +94 -0
- package/dist/testing/doubles.js +141 -0
- package/dist/testing/episode-harness.d.ts +49 -0
- package/dist/testing/episode-harness.js +65 -0
- package/dist/testing/filesystem.d.ts +17 -0
- package/dist/testing/filesystem.js +17 -0
- package/dist/testing/fixtures.d.ts +57 -0
- package/dist/testing/fixtures.js +84 -0
- package/dist/testing/hold-contract.d.ts +19 -0
- package/dist/testing/hold-contract.js +374 -0
- package/dist/testing/index.d.ts +41 -0
- package/dist/testing/index.js +41 -0
- package/dist/testing/journal-contract.d.ts +17 -0
- package/dist/testing/journal-contract.js +353 -0
- package/dist/testing/model-replies.d.ts +34 -0
- package/dist/testing/model-replies.js +101 -0
- package/dist/testing/primitives.d.ts +7 -0
- package/dist/testing/primitives.js +29 -0
- package/dist/testing/reader-signal-contract.d.ts +38 -0
- package/dist/testing/reader-signal-contract.js +318 -0
- package/dist/testing/row-security.d.ts +17 -0
- package/dist/testing/row-security.js +21 -0
- package/dist/testing/store-contract.d.ts +25 -0
- package/dist/testing/store-contract.js +500 -0
- package/dist/theme/apply.d.ts +17 -0
- package/dist/theme/apply.js +60 -0
- package/dist/theme/contrast.d.ts +197 -0
- package/dist/theme/contrast.js +259 -0
- package/dist/theme/derive.d.ts +77 -0
- package/dist/theme/derive.js +167 -0
- package/dist/theme/faces.d.ts +73 -0
- package/dist/theme/faces.js +119 -0
- package/dist/theme/font-packs.d.ts +25 -0
- package/dist/theme/font-packs.js +257 -0
- package/dist/theme/index.d.ts +20 -0
- package/dist/theme/index.js +20 -0
- package/dist/theme/lab.d.ts +30 -0
- package/dist/theme/lab.js +46 -0
- package/dist/theme/library.d.ts +114 -0
- package/dist/theme/library.js +300 -0
- package/dist/theme/measure.d.ts +144 -0
- package/dist/theme/measure.js +145 -0
- package/dist/theme/palettes.d.ts +64 -0
- package/dist/theme/palettes.js +497 -0
- package/dist/theme/registry.d.ts +59 -0
- package/dist/theme/registry.js +60 -0
- package/dist/theme/separation.d.ts +177 -0
- package/dist/theme/separation.js +203 -0
- package/dist/theme/style-presets.d.ts +60 -0
- package/dist/theme/style-presets.js +124 -0
- package/dist/theme/theme.d.ts +253 -0
- package/dist/theme/theme.js +171 -0
- package/dist/tree/apply.d.ts +16 -0
- package/dist/tree/apply.js +104 -0
- package/dist/tree/builders.d.ts +19 -0
- package/dist/tree/builders.js +20 -0
- package/dist/tree/compare.d.ts +68 -0
- package/dist/tree/compare.js +75 -0
- package/dist/tree/configuration.d.ts +25 -0
- package/dist/tree/configuration.js +108 -0
- package/dist/tree/delta.d.ts +288 -0
- package/dist/tree/delta.js +88 -0
- package/dist/tree/errors.d.ts +69 -0
- package/dist/tree/errors.js +34 -0
- package/dist/tree/identity.d.ts +117 -0
- package/dist/tree/identity.js +145 -0
- package/dist/tree/index.d.ts +21 -0
- package/dist/tree/index.js +21 -0
- package/dist/tree/inverse.d.ts +24 -0
- package/dist/tree/inverse.js +112 -0
- package/dist/tree/mutation.d.ts +18 -0
- package/dist/tree/mutation.js +49 -0
- package/dist/tree/naming.d.ts +4 -0
- package/dist/tree/naming.js +35 -0
- package/dist/tree/navigation.d.ts +38 -0
- package/dist/tree/navigation.js +83 -0
- package/dist/tree/node.d.ts +103 -0
- package/dist/tree/node.js +46 -0
- package/dist/tree/outline.d.ts +28 -0
- package/dist/tree/outline.js +10 -0
- package/dist/tree/tree.d.ts +83 -0
- package/dist/tree/tree.js +62 -0
- package/dist/write/commit.d.ts +124 -0
- package/dist/write/commit.js +234 -0
- package/dist/write/held.d.ts +674 -0
- package/dist/write/held.js +185 -0
- package/dist/write/index.d.ts +11 -0
- package/dist/write/index.js +11 -0
- package/dist/write/liveness.d.ts +132 -0
- package/dist/write/liveness.js +91 -0
- package/dist/write/revert.d.ts +79 -0
- package/dist/write/revert.js +134 -0
- package/package.json +160 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a page looks like, as something a tree can name.
|
|
3
|
+
*
|
|
4
|
+
* A palette, a font pack and a style preset, registered by a deployment and
|
|
5
|
+
* selected by id on the root node, resolved into the variables a stylesheet reads.
|
|
6
|
+
*/
|
|
7
|
+
export * from "./apply.js";
|
|
8
|
+
export * from "./contrast.js";
|
|
9
|
+
export * from "./derive.js";
|
|
10
|
+
export * from "./faces.js";
|
|
11
|
+
export * from "./font-packs.js";
|
|
12
|
+
export * from "./lab.js";
|
|
13
|
+
export * from "./library.js";
|
|
14
|
+
export * from "./measure.js";
|
|
15
|
+
export * from "./palettes.js";
|
|
16
|
+
export * from "./separation.js";
|
|
17
|
+
export * from "./style-presets.js";
|
|
18
|
+
export * from "./registry.js";
|
|
19
|
+
export * from "./theme.js";
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A colour in CIELAB, which is where every perceptual question about a palette
|
|
3
|
+
* gets answered.
|
|
4
|
+
*
|
|
5
|
+
* Two modules ask one: `separation.ts` asks *how far apart are these two*, and
|
|
6
|
+
* `measure.ts` asks *how much colour is in this one*. Both are distances in the
|
|
7
|
+
* same space, so the conversion lives here rather than twice — the rule
|
|
8
|
+
* `channelsOf` already set, where two parsers would have been two answers to
|
|
9
|
+
* whether a colour can be measured at all.
|
|
10
|
+
*
|
|
11
|
+
* Nothing here decides anything. It converts, and declines the forms
|
|
12
|
+
* `channelsOf` declines.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* sRGB channel, linearised.
|
|
16
|
+
*
|
|
17
|
+
* The knee is 0.04045, the sRGB specification's own value, where `contrast.ts`
|
|
18
|
+
* uses WCAG's 0.03928 for the same curve. The two differ in the fourth decimal
|
|
19
|
+
* of a rounding and each module keeps the constant its own standard publishes,
|
|
20
|
+
* rather than one of them citing a standard it is not following.
|
|
21
|
+
*/
|
|
22
|
+
export declare const linearise: (value: number) => number;
|
|
23
|
+
/** Lightness, green–red, blue–yellow. */
|
|
24
|
+
export type Lab = readonly [number, number, number];
|
|
25
|
+
/**
|
|
26
|
+
* L*a*b* under D65, the white point sRGB is defined against, or `undefined`
|
|
27
|
+
* when the colour is a form `channelsOf` declines to guess at.
|
|
28
|
+
*/
|
|
29
|
+
export declare const labOf: (colour: string) => Lab | undefined;
|
|
30
|
+
//# sourceMappingURL=lab.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { channelsOf } from "./contrast.js";
|
|
2
|
+
/**
|
|
3
|
+
* A colour in CIELAB, which is where every perceptual question about a palette
|
|
4
|
+
* gets answered.
|
|
5
|
+
*
|
|
6
|
+
* Two modules ask one: `separation.ts` asks *how far apart are these two*, and
|
|
7
|
+
* `measure.ts` asks *how much colour is in this one*. Both are distances in the
|
|
8
|
+
* same space, so the conversion lives here rather than twice — the rule
|
|
9
|
+
* `channelsOf` already set, where two parsers would have been two answers to
|
|
10
|
+
* whether a colour can be measured at all.
|
|
11
|
+
*
|
|
12
|
+
* Nothing here decides anything. It converts, and declines the forms
|
|
13
|
+
* `channelsOf` declines.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* sRGB channel, linearised.
|
|
17
|
+
*
|
|
18
|
+
* The knee is 0.04045, the sRGB specification's own value, where `contrast.ts`
|
|
19
|
+
* uses WCAG's 0.03928 for the same curve. The two differ in the fourth decimal
|
|
20
|
+
* of a rounding and each module keeps the constant its own standard publishes,
|
|
21
|
+
* rather than one of them citing a standard it is not following.
|
|
22
|
+
*/
|
|
23
|
+
export const linearise = (value) => {
|
|
24
|
+
const c = value / 255;
|
|
25
|
+
return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
26
|
+
};
|
|
27
|
+
/** CIE's cube-root transfer, with the linear segment near black. */
|
|
28
|
+
const transfer = (t) => (t > 216 / 24389 ? Math.cbrt(t) : (841 / 108) * t + 4 / 29);
|
|
29
|
+
/**
|
|
30
|
+
* L*a*b* under D65, the white point sRGB is defined against, or `undefined`
|
|
31
|
+
* when the colour is a form `channelsOf` declines to guess at.
|
|
32
|
+
*/
|
|
33
|
+
export const labOf = (colour) => {
|
|
34
|
+
const channels = channelsOf(colour);
|
|
35
|
+
if (!channels)
|
|
36
|
+
return undefined;
|
|
37
|
+
const [red, green, blue] = channels;
|
|
38
|
+
const r = linearise(red);
|
|
39
|
+
const g = linearise(green);
|
|
40
|
+
const b = linearise(blue);
|
|
41
|
+
const x = transfer((0.4124 * r + 0.3576 * g + 0.1805 * b) / 0.95047);
|
|
42
|
+
const y = transfer(0.2126 * r + 0.7152 * g + 0.0722 * b);
|
|
43
|
+
const z = transfer((0.0193 * r + 0.1192 * g + 0.9505 * b) / 1.08883);
|
|
44
|
+
return [116 * y - 16, 500 * (x - y), 200 * (y - z)];
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=lab.js.map
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { type FontPack, type Palette, type StylePreset } from "./theme.js";
|
|
2
|
+
/**
|
|
3
|
+
* The starter vocabulary, ported from the Hermes registry.
|
|
4
|
+
*
|
|
5
|
+
* Two palettes rather than one, deliberately: a single palette cannot show
|
|
6
|
+
* whether a primitive reads its colours from the slots or hard-codes them, and
|
|
7
|
+
* the port of the remaining twenty-seven is only safe once something proves a
|
|
8
|
+
* primitive survives being re-themed.
|
|
9
|
+
*
|
|
10
|
+
* A third arrived on 19 August, and it is the first not ported from Hermes:
|
|
11
|
+
* `minimal` / `minimal-sans` / `precise` is a house theme the maintainer
|
|
12
|
+
* specified, and it is registered here rather than in a surface because all four
|
|
13
|
+
* surfaces build their registry with `createThemeRegistry()` and no arguments.
|
|
14
|
+
* One entry in this list is what makes it reachable from every one of them.
|
|
15
|
+
*/
|
|
16
|
+
export declare const editorialPalette: Palette;
|
|
17
|
+
export declare const boldPalette: Palette;
|
|
18
|
+
/**
|
|
19
|
+
* Families are declared with their own fallback stacks and no loader. Loom does
|
|
20
|
+
* not fetch fonts: a host that wants a webfont links it, and a primitive renders
|
|
21
|
+
* correctly in the fallback until it arrives. Hermes emitted a Google Fonts URL
|
|
22
|
+
* here, which put a network dependency inside a pure function.
|
|
23
|
+
*/
|
|
24
|
+
export declare const editorialSerifFontPack: FontPack;
|
|
25
|
+
export declare const boldSansFontPack: FontPack;
|
|
26
|
+
export declare const comfortableStylePreset: StylePreset;
|
|
27
|
+
export declare const airyModernStylePreset: StylePreset;
|
|
28
|
+
/**
|
|
29
|
+
* The third palette, and the first one specified by the maintainer rather than
|
|
30
|
+
* ported: white paper, black ink, and one green.
|
|
31
|
+
*
|
|
32
|
+
* The green is **Hyperion's**, taken from the one colour that codebase holds
|
|
33
|
+
* constant. Every other token in Hyperion changes with its six themes; the
|
|
34
|
+
* positive-action button does not:
|
|
35
|
+
*
|
|
36
|
+
* ```css
|
|
37
|
+
* --btn-positive-bg: #72e3ad;
|
|
38
|
+
* --btn-positive-text: #0d3d26;
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* Those two are the same hue at two lightnesses — H 151.2° and 151.3°, S 65%
|
|
42
|
+
* and 67%, L 14.5% and 67% — so they are not two greens, they are two stops of
|
|
43
|
+
* one ramp. The stops between them here are computed on that hue and
|
|
44
|
+
* saturation, which is why this palette can fill every slot without inventing a
|
|
45
|
+
* second green.
|
|
46
|
+
*
|
|
47
|
+
* **Where each stop lands is decided by how the library reads the slot, not by
|
|
48
|
+
* how the colour looks in isolation**, and getting that backwards is the whole
|
|
49
|
+
* trap. `accent` is read as *text* far more often than as a fill — a section's
|
|
50
|
+
* eyebrow, an article's kicker, a disclosure marker, the current page in a nav —
|
|
51
|
+
* and the mint at 1.58:1 on white is unreadable at every one of them. So the
|
|
52
|
+
* mint cannot be `accent`, however much it is the colour someone pictures. It
|
|
53
|
+
* goes to `border-accent`, where a hairline, a pill's ring, a quote's rule and a
|
|
54
|
+
* featured tier's border are exactly the "subtle highlight" the brief asks for
|
|
55
|
+
* and where 1.58:1 is a soft mark rather than a failure.
|
|
56
|
+
*
|
|
57
|
+
* **`accent` is black, and that is the maintainer's call after seeing it green.**
|
|
58
|
+
* The first cut gave it the deep stop, `#0d3d26`, on the reasoning that a
|
|
59
|
+
* near-black button with a green cast was the restrained reading. Rendered, it
|
|
60
|
+
* was neither: too dark to read as green and too green to read as black — the
|
|
61
|
+
* review called it "dark hunter green black", which is exactly what it looked
|
|
62
|
+
* like. The brief names three colours, whites, black *and* green, and a black
|
|
63
|
+
* button is the one that leaves the green to be a highlight rather than the
|
|
64
|
+
* largest element on the page.
|
|
65
|
+
*
|
|
66
|
+
* So the green now lives entirely in the places a highlight belongs:
|
|
67
|
+
* `border-accent` for hairlines and rings, `accent-subtle` for a tinted tile,
|
|
68
|
+
* and `accent-strong` — a mid stop rather than the darkest — for the glyph or
|
|
69
|
+
* label sitting on that tile, where being *visibly* green matters more than
|
|
70
|
+
* maximising contrast it already has in hand at 5.91:1.
|
|
71
|
+
*/
|
|
72
|
+
export declare const minimalPalette: Palette;
|
|
73
|
+
/**
|
|
74
|
+
* One grotesque at two weights, which is the typographic half of minimalism.
|
|
75
|
+
*
|
|
76
|
+
* `editorial-serif` pairs two families and `bold-sans` pairs two more, because
|
|
77
|
+
* contrast between headline and body is how most pages establish hierarchy.
|
|
78
|
+
* This one refuses that: heading and body are the same family, and the only
|
|
79
|
+
* difference is weight and size. It is what the reference the maintainer gave —
|
|
80
|
+
* `nextjs.org` — does, and it is why that page reads as a single object rather
|
|
81
|
+
* than as a document with a masthead.
|
|
82
|
+
*
|
|
83
|
+
* **Geist is named first and is not loaded here.** Loom does not fetch fonts
|
|
84
|
+
* (see the note above `editorialSerifFontPack`), so this renders in the system
|
|
85
|
+
* grotesque until a surface links Geist itself, and the stack is ordered so that
|
|
86
|
+
* the fallback is a near-neighbour rather than a lurch — `ui-sans-serif` and the
|
|
87
|
+
* platform faces are all neo-grotesques of the same temperature. A page that
|
|
88
|
+
* never loads Geist still looks like this palette's page.
|
|
89
|
+
*/
|
|
90
|
+
export declare const minimalSansFontPack: FontPack;
|
|
91
|
+
/**
|
|
92
|
+
* Small radii, wide gutters, quick motion.
|
|
93
|
+
*
|
|
94
|
+
* The other two presets vary radius and spacing together on the assumption that
|
|
95
|
+
* a softer page is also a looser one. Minimalism separates them: corners get
|
|
96
|
+
* *tighter* than either existing preset while spacing gets **wider** than both.
|
|
97
|
+
* Space is what does the work when there is no ornament, and a 24px radius is
|
|
98
|
+
* ornament.
|
|
99
|
+
*
|
|
100
|
+
* `full` stays 9999 and is not a style choice — `loom.person`'s avatar and
|
|
101
|
+
* `loom.milestone`'s rail dot are circles, and a preset that set it to a real
|
|
102
|
+
* length would turn them into squircles in every theme that used it.
|
|
103
|
+
*/
|
|
104
|
+
export declare const preciseStylePreset: StylePreset;
|
|
105
|
+
/**
|
|
106
|
+
* The three palettes this file authors by hand, then the eighteen derived ones
|
|
107
|
+
* (`palettes.ts`). The three come first because they are the ones the four
|
|
108
|
+
* surfaces wear and the ones the re-theme tests are written against; the rest
|
|
109
|
+
* are range.
|
|
110
|
+
*/
|
|
111
|
+
export declare const STARTER_PALETTES: readonly Palette[];
|
|
112
|
+
export declare const STARTER_FONT_PACKS: readonly FontPack[];
|
|
113
|
+
export declare const STARTER_STYLE_PRESETS: readonly StylePreset[];
|
|
114
|
+
//# sourceMappingURL=library.d.ts.map
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import { ADDITIONAL_FONT_PACKS } from "./font-packs.js";
|
|
2
|
+
import { DERIVED_PALETTES } from "./palettes.js";
|
|
3
|
+
import { ADDITIONAL_STYLE_PRESETS } from "./style-presets.js";
|
|
4
|
+
import { fontPackSchema, paletteSchema, stylePresetSchema, } from "./theme.js";
|
|
5
|
+
/**
|
|
6
|
+
* The starter vocabulary, ported from the Hermes registry.
|
|
7
|
+
*
|
|
8
|
+
* Two palettes rather than one, deliberately: a single palette cannot show
|
|
9
|
+
* whether a primitive reads its colours from the slots or hard-codes them, and
|
|
10
|
+
* the port of the remaining twenty-seven is only safe once something proves a
|
|
11
|
+
* primitive survives being re-themed.
|
|
12
|
+
*
|
|
13
|
+
* A third arrived on 19 August, and it is the first not ported from Hermes:
|
|
14
|
+
* `minimal` / `minimal-sans` / `precise` is a house theme the maintainer
|
|
15
|
+
* specified, and it is registered here rather than in a surface because all four
|
|
16
|
+
* surfaces build their registry with `createThemeRegistry()` and no arguments.
|
|
17
|
+
* One entry in this list is what makes it reachable from every one of them.
|
|
18
|
+
*/
|
|
19
|
+
export const editorialPalette = paletteSchema.parse({
|
|
20
|
+
id: "editorial",
|
|
21
|
+
name: "Editorial",
|
|
22
|
+
description: "Restrained, high-contrast magazine palette with a single muted accent.",
|
|
23
|
+
slots: {
|
|
24
|
+
"bg-canvas": "#fafaf7",
|
|
25
|
+
"bg-surface": "#ffffff",
|
|
26
|
+
"bg-surface-muted": "#f0eee9",
|
|
27
|
+
"bg-overlay": "#ffffff",
|
|
28
|
+
"fg-default": "#0a0a0a",
|
|
29
|
+
"fg-muted": "#525252",
|
|
30
|
+
/** Third step of the ink ramp, and it still has to be readable (0074). */
|
|
31
|
+
"fg-subtle": "#6a6a6a",
|
|
32
|
+
"fg-on-accent": "#ffffff",
|
|
33
|
+
accent: "#4a5b78",
|
|
34
|
+
"accent-strong": "#34425a",
|
|
35
|
+
"accent-subtle": "#e6ebf2",
|
|
36
|
+
"brand-secondary": "#4a5b78",
|
|
37
|
+
"brand-secondary-strong": "#34425a",
|
|
38
|
+
"border-default": "#e5e5e5",
|
|
39
|
+
"border-strong": "#0a0a0a",
|
|
40
|
+
"border-subtle": "#efefe9",
|
|
41
|
+
"border-accent": "#4a5b78",
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
export const boldPalette = paletteSchema.parse({
|
|
45
|
+
id: "bold",
|
|
46
|
+
name: "Bold",
|
|
47
|
+
description: "Black canvas with bright yellow and red accents. High-energy, graphic.",
|
|
48
|
+
slots: {
|
|
49
|
+
"bg-canvas": "#0a0a0a",
|
|
50
|
+
"bg-surface": "#1a1a1a",
|
|
51
|
+
"bg-surface-muted": "#0f0f0f",
|
|
52
|
+
"bg-overlay": "#1a1a1a",
|
|
53
|
+
"fg-default": "#f5f5f5",
|
|
54
|
+
"fg-muted": "#a3a3a3",
|
|
55
|
+
/** Third step of the ink ramp, and it still has to be readable (0074). */
|
|
56
|
+
"fg-subtle": "#8a8a8a",
|
|
57
|
+
"fg-on-accent": "#0a0a0a",
|
|
58
|
+
accent: "#ffd400",
|
|
59
|
+
"accent-strong": "#e0b800",
|
|
60
|
+
"accent-subtle": "#3a3000",
|
|
61
|
+
"brand-secondary": "#ff3344",
|
|
62
|
+
"brand-secondary-strong": "#d81f2f",
|
|
63
|
+
"border-default": "#2a2a2a",
|
|
64
|
+
"border-strong": "#f5f5f5",
|
|
65
|
+
"border-subtle": "#1f1f1f",
|
|
66
|
+
"border-accent": "#ffd400",
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
/**
|
|
70
|
+
* Families are declared with their own fallback stacks and no loader. Loom does
|
|
71
|
+
* not fetch fonts: a host that wants a webfont links it, and a primitive renders
|
|
72
|
+
* correctly in the fallback until it arrives. Hermes emitted a Google Fonts URL
|
|
73
|
+
* here, which put a network dependency inside a pure function.
|
|
74
|
+
*/
|
|
75
|
+
export const editorialSerifFontPack = fontPackSchema.parse({
|
|
76
|
+
id: "editorial-serif",
|
|
77
|
+
name: "Editorial Serif",
|
|
78
|
+
description: "Serif headlines over a humanist sans body. Reads as considered rather than loud.",
|
|
79
|
+
headingFamily: 'Georgia, "Iowan Old Style", "Times New Roman", serif',
|
|
80
|
+
bodyFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
81
|
+
headingWeight: 600,
|
|
82
|
+
bodyWeight: 400,
|
|
83
|
+
scaleRamp: [12, 14, 16, 18, 24, 32, 48, 72],
|
|
84
|
+
});
|
|
85
|
+
export const boldSansFontPack = fontPackSchema.parse({
|
|
86
|
+
id: "bold-sans",
|
|
87
|
+
name: "Bold Sans",
|
|
88
|
+
description: "Compressed display headlines over a clean body. Leans on weight rather than ornament.",
|
|
89
|
+
headingFamily: 'Impact, "Haettenschweiler", "Arial Narrow Bold", sans-serif',
|
|
90
|
+
bodyFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
91
|
+
headingWeight: 400,
|
|
92
|
+
bodyWeight: 400,
|
|
93
|
+
scaleRamp: [12, 14, 16, 18, 24, 32, 56, 88],
|
|
94
|
+
});
|
|
95
|
+
export const comfortableStylePreset = stylePresetSchema.parse({
|
|
96
|
+
id: "comfortable",
|
|
97
|
+
name: "Comfortable",
|
|
98
|
+
description: "Moderate radii and generous spacing. The safe default for reading-led pages.",
|
|
99
|
+
radii: { sm: 6, md: 12, lg: 24, full: 9999 },
|
|
100
|
+
spacingScale: [4, 8, 12, 20, 32, 48, 64, 96],
|
|
101
|
+
motion: { fast: 150, medium: 250, slow: 400 },
|
|
102
|
+
density: "comfortable",
|
|
103
|
+
});
|
|
104
|
+
export const airyModernStylePreset = stylePresetSchema.parse({
|
|
105
|
+
id: "airy-modern",
|
|
106
|
+
name: "Airy Modern",
|
|
107
|
+
description: "Larger radii and looser spacing. Pairs with vibrant palettes.",
|
|
108
|
+
radii: { sm: 8, md: 16, lg: 32, full: 9999 },
|
|
109
|
+
spacingScale: [4, 8, 14, 22, 32, 48, 72, 96],
|
|
110
|
+
motion: { fast: 180, medium: 280, slow: 450 },
|
|
111
|
+
density: "comfortable",
|
|
112
|
+
});
|
|
113
|
+
/**
|
|
114
|
+
* The third palette, and the first one specified by the maintainer rather than
|
|
115
|
+
* ported: white paper, black ink, and one green.
|
|
116
|
+
*
|
|
117
|
+
* The green is **Hyperion's**, taken from the one colour that codebase holds
|
|
118
|
+
* constant. Every other token in Hyperion changes with its six themes; the
|
|
119
|
+
* positive-action button does not:
|
|
120
|
+
*
|
|
121
|
+
* ```css
|
|
122
|
+
* --btn-positive-bg: #72e3ad;
|
|
123
|
+
* --btn-positive-text: #0d3d26;
|
|
124
|
+
* ```
|
|
125
|
+
*
|
|
126
|
+
* Those two are the same hue at two lightnesses — H 151.2° and 151.3°, S 65%
|
|
127
|
+
* and 67%, L 14.5% and 67% — so they are not two greens, they are two stops of
|
|
128
|
+
* one ramp. The stops between them here are computed on that hue and
|
|
129
|
+
* saturation, which is why this palette can fill every slot without inventing a
|
|
130
|
+
* second green.
|
|
131
|
+
*
|
|
132
|
+
* **Where each stop lands is decided by how the library reads the slot, not by
|
|
133
|
+
* how the colour looks in isolation**, and getting that backwards is the whole
|
|
134
|
+
* trap. `accent` is read as *text* far more often than as a fill — a section's
|
|
135
|
+
* eyebrow, an article's kicker, a disclosure marker, the current page in a nav —
|
|
136
|
+
* and the mint at 1.58:1 on white is unreadable at every one of them. So the
|
|
137
|
+
* mint cannot be `accent`, however much it is the colour someone pictures. It
|
|
138
|
+
* goes to `border-accent`, where a hairline, a pill's ring, a quote's rule and a
|
|
139
|
+
* featured tier's border are exactly the "subtle highlight" the brief asks for
|
|
140
|
+
* and where 1.58:1 is a soft mark rather than a failure.
|
|
141
|
+
*
|
|
142
|
+
* **`accent` is black, and that is the maintainer's call after seeing it green.**
|
|
143
|
+
* The first cut gave it the deep stop, `#0d3d26`, on the reasoning that a
|
|
144
|
+
* near-black button with a green cast was the restrained reading. Rendered, it
|
|
145
|
+
* was neither: too dark to read as green and too green to read as black — the
|
|
146
|
+
* review called it "dark hunter green black", which is exactly what it looked
|
|
147
|
+
* like. The brief names three colours, whites, black *and* green, and a black
|
|
148
|
+
* button is the one that leaves the green to be a highlight rather than the
|
|
149
|
+
* largest element on the page.
|
|
150
|
+
*
|
|
151
|
+
* So the green now lives entirely in the places a highlight belongs:
|
|
152
|
+
* `border-accent` for hairlines and rings, `accent-subtle` for a tinted tile,
|
|
153
|
+
* and `accent-strong` — a mid stop rather than the darkest — for the glyph or
|
|
154
|
+
* label sitting on that tile, where being *visibly* green matters more than
|
|
155
|
+
* maximising contrast it already has in hand at 5.91:1.
|
|
156
|
+
*/
|
|
157
|
+
export const minimalPalette = paletteSchema.parse({
|
|
158
|
+
id: "minimal",
|
|
159
|
+
name: "Minimal",
|
|
160
|
+
description: "White paper, black ink, one green. Components are outlined rather than filled; the green appears only as rules, rings and tinted marks.",
|
|
161
|
+
slots: {
|
|
162
|
+
/**
|
|
163
|
+
* **`bg-surface` is the canvas white, and that is the whole outline-first
|
|
164
|
+
* decision.** It is the fill behind a card, a nav, a footer, a hero panel
|
|
165
|
+
* and a `tone: "surface"` section — so setting it to the page colour means
|
|
166
|
+
* every one of those is defined by its border instead of by a change of
|
|
167
|
+
* background, without a single primitive being touched. The instruction was
|
|
168
|
+
* to prefer outlined components and use fills sparingly; this is the one
|
|
169
|
+
* slot that turns the entire library over.
|
|
170
|
+
*
|
|
171
|
+
* It also means `border-subtle` is now load-bearing rather than decorative,
|
|
172
|
+
* which is why it is a step darker here than the palettes that back their
|
|
173
|
+
* borders with a fill.
|
|
174
|
+
*/
|
|
175
|
+
"bg-canvas": "#ffffff",
|
|
176
|
+
"bg-surface": "#ffffff",
|
|
177
|
+
/**
|
|
178
|
+
* The one fill left, and it stays a real one because it is *functional*
|
|
179
|
+
* rather than structural: the well behind an image that has not loaded, a
|
|
180
|
+
* person's monogram, a neutral badge. Nine primitives read it, and a
|
|
181
|
+
* placeholder the same colour as the page is a placeholder nobody can see.
|
|
182
|
+
*/
|
|
183
|
+
"bg-surface-muted": "#f4f4f5",
|
|
184
|
+
"bg-overlay": "#ffffff",
|
|
185
|
+
/** Never pure black. #000 on #fff is a glare a printed page never produces. */
|
|
186
|
+
"fg-default": "#0a0a0a",
|
|
187
|
+
"fg-muted": "#52525b",
|
|
188
|
+
/** Third step of the ink ramp, keeping this palette's cool cast (0074). */
|
|
189
|
+
"fg-subtle": "#6e6e78",
|
|
190
|
+
"fg-on-accent": "#ffffff",
|
|
191
|
+
/** Black, so the green is a highlight and not the biggest thing on the page. */
|
|
192
|
+
accent: "#0a0a0a",
|
|
193
|
+
/** A mid stop on Hyperion's ramp: the glyph on a tinted tile, visibly green at 5.91:1. */
|
|
194
|
+
"accent-strong": "#176e44",
|
|
195
|
+
"accent-subtle": "#effbf5",
|
|
196
|
+
"brand-secondary": "#72e3ad",
|
|
197
|
+
"brand-secondary-strong": "#1f985e",
|
|
198
|
+
/** Carrying structure now, so a step darker than a fill-backed palette needs. */
|
|
199
|
+
"border-default": "#d4d4d9",
|
|
200
|
+
"border-strong": "#0a0a0a",
|
|
201
|
+
"border-subtle": "#e6e6ea",
|
|
202
|
+
/** Hyperion's `--btn-positive-bg`, exactly. The green you actually see. */
|
|
203
|
+
"border-accent": "#72e3ad",
|
|
204
|
+
},
|
|
205
|
+
});
|
|
206
|
+
/**
|
|
207
|
+
* One grotesque at two weights, which is the typographic half of minimalism.
|
|
208
|
+
*
|
|
209
|
+
* `editorial-serif` pairs two families and `bold-sans` pairs two more, because
|
|
210
|
+
* contrast between headline and body is how most pages establish hierarchy.
|
|
211
|
+
* This one refuses that: heading and body are the same family, and the only
|
|
212
|
+
* difference is weight and size. It is what the reference the maintainer gave —
|
|
213
|
+
* `nextjs.org` — does, and it is why that page reads as a single object rather
|
|
214
|
+
* than as a document with a masthead.
|
|
215
|
+
*
|
|
216
|
+
* **Geist is named first and is not loaded here.** Loom does not fetch fonts
|
|
217
|
+
* (see the note above `editorialSerifFontPack`), so this renders in the system
|
|
218
|
+
* grotesque until a surface links Geist itself, and the stack is ordered so that
|
|
219
|
+
* the fallback is a near-neighbour rather than a lurch — `ui-sans-serif` and the
|
|
220
|
+
* platform faces are all neo-grotesques of the same temperature. A page that
|
|
221
|
+
* never loads Geist still looks like this palette's page.
|
|
222
|
+
*/
|
|
223
|
+
export const minimalSansFontPack = fontPackSchema.parse({
|
|
224
|
+
id: "minimal-sans",
|
|
225
|
+
name: "Minimal Sans",
|
|
226
|
+
description: "One neo-grotesque for headings and body, separated by weight alone. Prefers Geist; falls back to the system grotesque.",
|
|
227
|
+
headingFamily: 'Geist, "Geist Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
|
|
228
|
+
bodyFamily: 'Geist, "Geist Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
|
|
229
|
+
/**
|
|
230
|
+
* The one face in this pack a surface already serves and the library could
|
|
231
|
+
* not previously ask for. `(docs)` links Geist Mono for its own chrome, so a
|
|
232
|
+
* `loom.code` panel on that site rendered in the system stack beside prose
|
|
233
|
+
* set in Geist and a `<pre>` set in Geist Mono — three faces where the pack
|
|
234
|
+
* describes one pairing. Ordered like the other two: the served face first,
|
|
235
|
+
* a real stack behind it (0085).
|
|
236
|
+
*/
|
|
237
|
+
monoFamily: '"Geist Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace',
|
|
238
|
+
headingWeight: 700,
|
|
239
|
+
bodyWeight: 400,
|
|
240
|
+
/**
|
|
241
|
+
* A gentle middle and a decisive top. Steps 1–5 are the reading sizes and move
|
|
242
|
+
* in small increments; 6–8 are display sizes and jump, because a headline that
|
|
243
|
+
* is merely larger than its body copy reads as emphasis rather than as a
|
|
244
|
+
* headline.
|
|
245
|
+
*
|
|
246
|
+
* Step 8 is 72 and not more. `loom.heading` maps level 1 to the top step and
|
|
247
|
+
* `loom.hero` holds its text to a 44rem measure, so an ambitious top step does
|
|
248
|
+
* not produce a bigger headline — it produces the same headline on four lines.
|
|
249
|
+
* Tuned against a render rather than against the numbers.
|
|
250
|
+
*/
|
|
251
|
+
scaleRamp: [12, 14, 16, 20, 26, 32, 44, 72],
|
|
252
|
+
});
|
|
253
|
+
/**
|
|
254
|
+
* Small radii, wide gutters, quick motion.
|
|
255
|
+
*
|
|
256
|
+
* The other two presets vary radius and spacing together on the assumption that
|
|
257
|
+
* a softer page is also a looser one. Minimalism separates them: corners get
|
|
258
|
+
* *tighter* than either existing preset while spacing gets **wider** than both.
|
|
259
|
+
* Space is what does the work when there is no ornament, and a 24px radius is
|
|
260
|
+
* ornament.
|
|
261
|
+
*
|
|
262
|
+
* `full` stays 9999 and is not a style choice — `loom.person`'s avatar and
|
|
263
|
+
* `loom.milestone`'s rail dot are circles, and a preset that set it to a real
|
|
264
|
+
* length would turn them into squircles in every theme that used it.
|
|
265
|
+
*/
|
|
266
|
+
export const preciseStylePreset = stylePresetSchema.parse({
|
|
267
|
+
id: "precise",
|
|
268
|
+
name: "Precise",
|
|
269
|
+
description: "Tight radii and wide gutters. Space does the work where ornament is not wanted.",
|
|
270
|
+
radii: { sm: 4, md: 8, lg: 12, full: 9999 },
|
|
271
|
+
spacingScale: [4, 8, 12, 20, 32, 48, 72, 112],
|
|
272
|
+
/** Faster than either other preset. Restraint applies to duration as well. */
|
|
273
|
+
motion: { fast: 120, medium: 200, slow: 320 },
|
|
274
|
+
density: "comfortable",
|
|
275
|
+
});
|
|
276
|
+
/**
|
|
277
|
+
* The three palettes this file authors by hand, then the eighteen derived ones
|
|
278
|
+
* (`palettes.ts`). The three come first because they are the ones the four
|
|
279
|
+
* surfaces wear and the ones the re-theme tests are written against; the rest
|
|
280
|
+
* are range.
|
|
281
|
+
*/
|
|
282
|
+
export const STARTER_PALETTES = [
|
|
283
|
+
minimalPalette,
|
|
284
|
+
editorialPalette,
|
|
285
|
+
boldPalette,
|
|
286
|
+
...DERIVED_PALETTES,
|
|
287
|
+
];
|
|
288
|
+
export const STARTER_FONT_PACKS = [
|
|
289
|
+
minimalSansFontPack,
|
|
290
|
+
editorialSerifFontPack,
|
|
291
|
+
boldSansFontPack,
|
|
292
|
+
...ADDITIONAL_FONT_PACKS,
|
|
293
|
+
];
|
|
294
|
+
export const STARTER_STYLE_PRESETS = [
|
|
295
|
+
preciseStylePreset,
|
|
296
|
+
comfortableStylePreset,
|
|
297
|
+
airyModernStylePreset,
|
|
298
|
+
...ADDITIONAL_STYLE_PRESETS,
|
|
299
|
+
];
|
|
300
|
+
//# sourceMappingURL=library.js.map
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { Palette, PaletteSlot, ThemeId } from "./theme.js";
|
|
2
|
+
/**
|
|
3
|
+
* What a palette *is*, as numbers a stylesheet can use.
|
|
4
|
+
*
|
|
5
|
+
* A palette hands a primitive seventeen strings. `var(--loom-accent-strong)` is
|
|
6
|
+
* a colour to a reader and an opaque token to everything else: CSS cannot ask
|
|
7
|
+
* how much colour is in it, and a primitive that spreads it over half a band has
|
|
8
|
+
* no way to find out before it does.
|
|
9
|
+
*
|
|
10
|
+
* Two things the library builds needed exactly that and could not have it, both
|
|
11
|
+
* filed on 11 September by the lane that builds the primitives:
|
|
12
|
+
*
|
|
13
|
+
* - **A paint assumes there is chroma to spend.** The same aurora that is
|
|
14
|
+
* luminous behind `bold`'s gold and red is a grey blob behind `editorial`'s
|
|
15
|
+
* two slates, because a low-chroma tint spread over a light canvas is
|
|
16
|
+
* indistinguishable from dirt. One opacity was serving both, and no primitive
|
|
17
|
+
* could know which palette it was in.
|
|
18
|
+
* - **A dark wash is not expressible.** `bg-overlay` is a *surface* — white
|
|
19
|
+
* under most of the starter palettes — so reading it as a scrim gives white
|
|
20
|
+
* text on a white veil. A hard-coded black would render one page correctly and
|
|
21
|
+
* break re-theming for every other palette (0049).
|
|
22
|
+
*
|
|
23
|
+
* Both are answered here, and answered the same way: **measured from the
|
|
24
|
+
* palette, never declared on it.** A declared field would have to be added to
|
|
25
|
+
* `paletteSchema`, which every palette must satisfy in full — so every host
|
|
26
|
+
* palette in existence would stop validating, and a host that did fill it in
|
|
27
|
+
* could fill it in wrongly. Nothing checks a claim about how much colour a
|
|
28
|
+
* colour has. Measuring it cannot be wrong and costs a host nothing (0131).
|
|
29
|
+
*
|
|
30
|
+
* It reports; it does not decide — the bargain `auditPalette` and
|
|
31
|
+
* `auditSeparation` both make, for the same reason (0076). How strong a wash to
|
|
32
|
+
* draw with these numbers is the primitive's call, and which pair to hand a
|
|
33
|
+
* reader is the palette's.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* The greatest chroma sRGB can reach: pure blue, `#0000ff`, at C* 133.82.
|
|
37
|
+
*
|
|
38
|
+
* Chroma is reported as a fraction of it, so `1` means *as saturated as a screen
|
|
39
|
+
* goes* and the scale does not depend on which palettes happen to be registered.
|
|
40
|
+
* A normalisation against the library's own maximum would be a number that moved
|
|
41
|
+
* whenever somebody added a palette.
|
|
42
|
+
*/
|
|
43
|
+
export declare const MAX_SRGB_CHROMA = 133.82;
|
|
44
|
+
/**
|
|
45
|
+
* The slots a palette puts its colour in, and the only ones whose chroma tells
|
|
46
|
+
* anybody anything.
|
|
47
|
+
*
|
|
48
|
+
* The neutral tiers are near-grey **on purpose** — `derivePalette` builds every
|
|
49
|
+
* background, ink and rule from the canvas hue at a saturation it caps in the
|
|
50
|
+
* teens, so measuring them would report the tint of the paper rather than what a
|
|
51
|
+
* paint has to work with. The accent tier and the brand tier are where a palette
|
|
52
|
+
* spends its chroma, and they are what a band spreads behind content.
|
|
53
|
+
*
|
|
54
|
+
* Declared rather than derived, for the reason `PALETTE_TEXT_GROUNDS` is: which
|
|
55
|
+
* slots mean *colour* rather than *paper* is what the vocabulary means, not
|
|
56
|
+
* something a probe can read off a component.
|
|
57
|
+
*/
|
|
58
|
+
export declare const PALETTE_CHROMA_SLOTS: readonly PaletteSlot[];
|
|
59
|
+
/**
|
|
60
|
+
* Relative luminance at or under which a wash genuinely darkens what is beneath
|
|
61
|
+
* it.
|
|
62
|
+
*
|
|
63
|
+
* Derived rather than chosen. A wash drawn at full strength brings what is under
|
|
64
|
+
* it to its own luminance `L`; for the ink it carries to clear the body-text bar
|
|
65
|
+
* against that, the ink needs a luminance of at least `4.5 × (L + 0.05) − 0.05`,
|
|
66
|
+
* which at `L = 0.15` is 0.85 — a near-white and nothing else. Above this a
|
|
67
|
+
* "dark" scrim is dark in name only, so the pair is reported as one that does not
|
|
68
|
+
* darken rather than silently offered as one that does.
|
|
69
|
+
*
|
|
70
|
+
* Every starter palette's scrim sits under 0.015, two orders of magnitude
|
|
71
|
+
* inside it; the ceiling exists for host palettes, where it is a real question.
|
|
72
|
+
*/
|
|
73
|
+
export declare const SCRIM_DARK_CEILING = 0.15;
|
|
74
|
+
/**
|
|
75
|
+
* A ground that darkens what is under it, and the ink that is guaranteed to read
|
|
76
|
+
* on it.
|
|
77
|
+
*
|
|
78
|
+
* A pair rather than a colour, because the guarantee is the point: the two are
|
|
79
|
+
* the palette's **own body-copy pair, whichever way round is darker**. Under a
|
|
80
|
+
* light palette that is the ink used as the ground and the page used as the ink;
|
|
81
|
+
* under a dark one it is the page used as the ground and the ink left where it
|
|
82
|
+
* is. Either way both ends come from the palette, so a scrim re-themes like
|
|
83
|
+
* everything else, and its contrast is one the palette already owes a reader —
|
|
84
|
+
* `fg-default` on `bg-canvas` is a painted pairing the contrast bar asserts
|
|
85
|
+
* (0074), so a scrim cannot be legible in one palette and not in another.
|
|
86
|
+
*
|
|
87
|
+
* Inverting is what makes it free. The alternative — deriving a new dark colour
|
|
88
|
+
* from the palette's hue — invents a colour nobody approved, and then owes the
|
|
89
|
+
* reader a foreground that has never been measured against it.
|
|
90
|
+
*/
|
|
91
|
+
export type Scrim = {
|
|
92
|
+
readonly ground: PaletteSlot;
|
|
93
|
+
readonly foreground: PaletteSlot;
|
|
94
|
+
/** Of the ground. How much this wash can actually darken. */
|
|
95
|
+
readonly luminance: number;
|
|
96
|
+
/** Of the pair, which is the palette's own body-copy ratio. */
|
|
97
|
+
readonly ratio: number;
|
|
98
|
+
/** Whether the ground is under `SCRIM_DARK_CEILING`. */
|
|
99
|
+
readonly darkens: boolean;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* How much colour is in one slot, as a fraction of the most sRGB can hold, or
|
|
103
|
+
* `undefined` when the colour is a form `channelsOf` declines to guess at.
|
|
104
|
+
*
|
|
105
|
+
* CIELAB chroma rather than HSL saturation: a palette is judged by eye, and
|
|
106
|
+
* `hsl()`'s saturation says a pale mint and a deep forest hold the same amount
|
|
107
|
+
* of colour when a reader can see that one of them is grey. This is the space
|
|
108
|
+
* `separation.ts` already measures difference in, for the same reason.
|
|
109
|
+
*/
|
|
110
|
+
export declare const slotChroma: (colour: string) => number | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* The palette's scrim pair, or `undefined` when either end is a colour this
|
|
113
|
+
* cannot measure — `undefined` rather than a guess, so a host whose palette is
|
|
114
|
+
* written in `hsl()` is told the wash is unavailable instead of being handed a
|
|
115
|
+
* pair that might be the wrong way round.
|
|
116
|
+
*/
|
|
117
|
+
export declare const paletteScrim: (palette: Palette) => Scrim | undefined;
|
|
118
|
+
/** Everything measurable about one palette that its slots do not say. */
|
|
119
|
+
export type PaletteMeasures = {
|
|
120
|
+
readonly palette: ThemeId;
|
|
121
|
+
/**
|
|
122
|
+
* Chroma per slot, normalised, for the slots that carry colour. A slot whose
|
|
123
|
+
* colour could not be measured is **absent** rather than zero: zero is a real
|
|
124
|
+
* answer meaning grey, and `graphite`'s accent really is 0.000.
|
|
125
|
+
*/
|
|
126
|
+
readonly chroma: Readonly<Partial<Record<PaletteSlot, number>>>;
|
|
127
|
+
readonly scrim: Scrim | undefined;
|
|
128
|
+
};
|
|
129
|
+
/** Measures one palette. Refuses nothing, and reports what it could not measure by leaving it out. */
|
|
130
|
+
export declare const paletteMeasures: (palette: Palette) => PaletteMeasures;
|
|
131
|
+
/**
|
|
132
|
+
* The decimal places a chroma is emitted to.
|
|
133
|
+
*
|
|
134
|
+
* Fixed rather than trimmed, and the reason is not tidiness: a variable whose
|
|
135
|
+
* text length varied with the palette would make the page describing a tree a
|
|
136
|
+
* few bytes longer in one palette than in another, and *the same tree in every
|
|
137
|
+
* palette, byte for byte* is a promise the theme model makes and a marketing
|
|
138
|
+
* page now measures and prints (0049). Three places resolve a step of 0.4 in
|
|
139
|
+
* C*, finer than the 1/255 a hex can express.
|
|
140
|
+
*/
|
|
141
|
+
export declare const CHROMA_PLACES = 3;
|
|
142
|
+
/** A chroma as a stylesheet reads it: unitless, so `calc()` can multiply by it. */
|
|
143
|
+
export declare const chromaValue: (chroma: number) => string;
|
|
144
|
+
//# sourceMappingURL=measure.d.ts.map
|