@fundamental-engine/core 0.4.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 +128 -0
- package/dist/agents/element-agent.d.ts +38 -0
- package/dist/agents/element-agent.d.ts.map +1 -0
- package/dist/agents/element-agent.js +70 -0
- package/dist/agents/element-agent.js.map +1 -0
- package/dist/agents/event-agent.d.ts +47 -0
- package/dist/agents/event-agent.d.ts.map +1 -0
- package/dist/agents/event-agent.js +82 -0
- package/dist/agents/event-agent.js.map +1 -0
- package/dist/agents/index.d.ts +17 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +57 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/region-agents.d.ts +40 -0
- package/dist/agents/region-agents.d.ts.map +1 -0
- package/dist/agents/region-agents.js +22 -0
- package/dist/agents/region-agents.js.map +1 -0
- package/dist/agents/relationship.d.ts +55 -0
- package/dist/agents/relationship.d.ts.map +1 -0
- package/dist/agents/relationship.js +40 -0
- package/dist/agents/relationship.js.map +1 -0
- package/dist/agents/user-agent.d.ts +57 -0
- package/dist/agents/user-agent.d.ts.map +1 -0
- package/dist/agents/user-agent.js +45 -0
- package/dist/agents/user-agent.js.map +1 -0
- package/dist/config/forces.config.d.ts +101 -0
- package/dist/config/forces.config.d.ts.map +1 -0
- package/dist/config/forces.config.js +239 -0
- package/dist/config/forces.config.js.map +1 -0
- package/dist/config/manual.d.ts +134 -0
- package/dist/config/manual.d.ts.map +1 -0
- package/dist/config/manual.js +604 -0
- package/dist/config/manual.js.map +1 -0
- package/dist/config/palettes.d.ts +18 -0
- package/dist/config/palettes.d.ts.map +1 -0
- package/dist/config/palettes.js +34 -0
- package/dist/config/palettes.js.map +1 -0
- package/dist/config/presets.d.ts +48 -0
- package/dist/config/presets.d.ts.map +1 -0
- package/dist/config/presets.js +87 -0
- package/dist/config/presets.js.map +1 -0
- package/dist/config/tokens.d.ts +3 -0
- package/dist/config/tokens.d.ts.map +1 -0
- package/dist/config/tokens.js +16 -0
- package/dist/config/tokens.js.map +1 -0
- package/dist/conformance/expectations.d.ts +40 -0
- package/dist/conformance/expectations.d.ts.map +1 -0
- package/dist/conformance/expectations.js +347 -0
- package/dist/conformance/expectations.js.map +1 -0
- package/dist/conformance/experiments.d.ts +17 -0
- package/dist/conformance/experiments.d.ts.map +1 -0
- package/dist/conformance/experiments.js +875 -0
- package/dist/conformance/experiments.js.map +1 -0
- package/dist/conformance/run.d.ts +18 -0
- package/dist/conformance/run.d.ts.map +1 -0
- package/dist/conformance/run.js +240 -0
- package/dist/conformance/run.js.map +1 -0
- package/dist/conformance/types.d.ts +100 -0
- package/dist/conformance/types.d.ts.map +1 -0
- package/dist/conformance/types.js +2 -0
- package/dist/conformance/types.js.map +1 -0
- package/dist/contracts/guards.d.ts +51 -0
- package/dist/contracts/guards.d.ts.map +1 -0
- package/dist/contracts/guards.js +100 -0
- package/dist/contracts/guards.js.map +1 -0
- package/dist/contracts/index.d.ts +18 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +107 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/passport.d.ts +88 -0
- package/dist/contracts/passport.d.ts.map +1 -0
- package/dist/contracts/passport.js +135 -0
- package/dist/contracts/passport.js.map +1 -0
- package/dist/contracts/types.d.ts +120 -0
- package/dist/contracts/types.d.ts.map +1 -0
- package/dist/contracts/types.js +24 -0
- package/dist/contracts/types.js.map +1 -0
- package/dist/core/accretion.d.ts +50 -0
- package/dist/core/accretion.d.ts.map +1 -0
- package/dist/core/accretion.js +98 -0
- package/dist/core/accretion.js.map +1 -0
- package/dist/core/agents.d.ts +31 -0
- package/dist/core/agents.d.ts.map +1 -0
- package/dist/core/agents.js +51 -0
- package/dist/core/agents.js.map +1 -0
- package/dist/core/attention.d.ts +72 -0
- package/dist/core/attention.d.ts.map +1 -0
- package/dist/core/attention.js +122 -0
- package/dist/core/attention.js.map +1 -0
- package/dist/core/causality.d.ts +38 -0
- package/dist/core/causality.d.ts.map +1 -0
- package/dist/core/causality.js +64 -0
- package/dist/core/causality.js.map +1 -0
- package/dist/core/conditions.d.ts +10 -0
- package/dist/core/conditions.d.ts.map +1 -0
- package/dist/core/conditions.js +22 -0
- package/dist/core/conditions.js.map +1 -0
- package/dist/core/currents.d.ts +53 -0
- package/dist/core/currents.d.ts.map +1 -0
- package/dist/core/currents.js +65 -0
- package/dist/core/currents.js.map +1 -0
- package/dist/core/dock.d.ts +35 -0
- package/dist/core/dock.d.ts.map +1 -0
- package/dist/core/dock.js +39 -0
- package/dist/core/dock.js.map +1 -0
- package/dist/core/events.d.ts +23 -0
- package/dist/core/events.d.ts.map +1 -0
- package/dist/core/events.js +34 -0
- package/dist/core/events.js.map +1 -0
- package/dist/core/feedback-sink.d.ts +32 -0
- package/dist/core/feedback-sink.d.ts.map +1 -0
- package/dist/core/feedback-sink.js +53 -0
- package/dist/core/feedback-sink.js.map +1 -0
- package/dist/core/feedback.d.ts +11 -0
- package/dist/core/feedback.d.ts.map +1 -0
- package/dist/core/feedback.js +16 -0
- package/dist/core/feedback.js.map +1 -0
- package/dist/core/field-store.d.ts +26 -0
- package/dist/core/field-store.d.ts.map +1 -0
- package/dist/core/field-store.js +54 -0
- package/dist/core/field-store.js.map +1 -0
- package/dist/core/field.d.ts +18 -0
- package/dist/core/field.d.ts.map +1 -0
- package/dist/core/field.js +1943 -0
- package/dist/core/field.js.map +1 -0
- package/dist/core/fieldline-seeds.d.ts +25 -0
- package/dist/core/fieldline-seeds.d.ts.map +1 -0
- package/dist/core/fieldline-seeds.js +32 -0
- package/dist/core/fieldline-seeds.js.map +1 -0
- package/dist/core/fieldlines.d.ts +75 -0
- package/dist/core/fieldlines.d.ts.map +1 -0
- package/dist/core/fieldlines.js +111 -0
- package/dist/core/fieldlines.js.map +1 -0
- package/dist/core/flow.d.ts +38 -0
- package/dist/core/flow.d.ts.map +1 -0
- package/dist/core/flow.js +27 -0
- package/dist/core/flow.js.map +1 -0
- package/dist/core/formations.d.ts +11 -0
- package/dist/core/formations.d.ts.map +1 -0
- package/dist/core/formations.js +22 -0
- package/dist/core/formations.js.map +1 -0
- package/dist/core/geometry.d.ts +67 -0
- package/dist/core/geometry.d.ts.map +1 -0
- package/dist/core/geometry.js +68 -0
- package/dist/core/geometry.js.map +1 -0
- package/dist/core/heatmap.d.ts +22 -0
- package/dist/core/heatmap.d.ts.map +1 -0
- package/dist/core/heatmap.js +55 -0
- package/dist/core/heatmap.js.map +1 -0
- package/dist/core/host.d.ts +46 -0
- package/dist/core/host.d.ts.map +1 -0
- package/dist/core/host.js +11 -0
- package/dist/core/host.js.map +1 -0
- package/dist/core/integrator.d.ts +24 -0
- package/dist/core/integrator.d.ts.map +1 -0
- package/dist/core/integrator.js +375 -0
- package/dist/core/integrator.js.map +1 -0
- package/dist/core/math.d.ts +37 -0
- package/dist/core/math.d.ts.map +1 -0
- package/dist/core/math.js +77 -0
- package/dist/core/math.js.map +1 -0
- package/dist/core/reactions.d.ts +32 -0
- package/dist/core/reactions.d.ts.map +1 -0
- package/dist/core/reactions.js +45 -0
- package/dist/core/reactions.js.map +1 -0
- package/dist/core/registry.d.ts +13 -0
- package/dist/core/registry.d.ts.map +1 -0
- package/dist/core/registry.js +20 -0
- package/dist/core/registry.js.map +1 -0
- package/dist/core/render-backend.d.ts +46 -0
- package/dist/core/render-backend.d.ts.map +1 -0
- package/dist/core/render-backend.js +75 -0
- package/dist/core/render-backend.js.map +1 -0
- package/dist/core/render-modes.d.ts +42 -0
- package/dist/core/render-modes.d.ts.map +1 -0
- package/dist/core/render-modes.js +141 -0
- package/dist/core/render-modes.js.map +1 -0
- package/dist/core/reservoir.d.ts +43 -0
- package/dist/core/reservoir.d.ts.map +1 -0
- package/dist/core/reservoir.js +207 -0
- package/dist/core/reservoir.js.map +1 -0
- package/dist/core/scalar-grid.d.ts +51 -0
- package/dist/core/scalar-grid.d.ts.map +1 -0
- package/dist/core/scalar-grid.js +146 -0
- package/dist/core/scalar-grid.js.map +1 -0
- package/dist/core/scanner.d.ts +59 -0
- package/dist/core/scanner.d.ts.map +1 -0
- package/dist/core/scanner.js +260 -0
- package/dist/core/scanner.js.map +1 -0
- package/dist/core/shadow.d.ts +69 -0
- package/dist/core/shadow.d.ts.map +1 -0
- package/dist/core/shadow.js +84 -0
- package/dist/core/shadow.js.map +1 -0
- package/dist/core/spatial-hash.d.ts +30 -0
- package/dist/core/spatial-hash.d.ts.map +1 -0
- package/dist/core/spatial-hash.js +64 -0
- package/dist/core/spatial-hash.js.map +1 -0
- package/dist/core/streamlines.d.ts +29 -0
- package/dist/core/streamlines.d.ts.map +1 -0
- package/dist/core/streamlines.js +70 -0
- package/dist/core/streamlines.js.map +1 -0
- package/dist/core/surface.d.ts +19 -0
- package/dist/core/surface.d.ts.map +1 -0
- package/dist/core/surface.js +21 -0
- package/dist/core/surface.js.map +1 -0
- package/dist/core/temporal.d.ts +110 -0
- package/dist/core/temporal.d.ts.map +1 -0
- package/dist/core/temporal.js +139 -0
- package/dist/core/temporal.js.map +1 -0
- package/dist/core/thermo.d.ts +48 -0
- package/dist/core/thermo.d.ts.map +1 -0
- package/dist/core/thermo.js +48 -0
- package/dist/core/thermo.js.map +1 -0
- package/dist/core/types.d.ts +610 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +2 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/weights.d.ts +111 -0
- package/dist/core/weights.d.ts.map +1 -0
- package/dist/core/weights.js +128 -0
- package/dist/core/weights.js.map +1 -0
- package/dist/diagnostics/energy.d.ts +21 -0
- package/dist/diagnostics/energy.d.ts.map +1 -0
- package/dist/diagnostics/energy.js +27 -0
- package/dist/diagnostics/energy.js.map +1 -0
- package/dist/diagnostics/fields.d.ts +23 -0
- package/dist/diagnostics/fields.d.ts.map +1 -0
- package/dist/diagnostics/fields.js +30 -0
- package/dist/diagnostics/fields.js.map +1 -0
- package/dist/diagnostics/index.d.ts +46 -0
- package/dist/diagnostics/index.d.ts.map +1 -0
- package/dist/diagnostics/index.js +23 -0
- package/dist/diagnostics/index.js.map +1 -0
- package/dist/diagnostics/modes.d.ts +108 -0
- package/dist/diagnostics/modes.d.ts.map +1 -0
- package/dist/diagnostics/modes.js +181 -0
- package/dist/diagnostics/modes.js.map +1 -0
- package/dist/diagnostics/potential.d.ts +30 -0
- package/dist/diagnostics/potential.d.ts.map +1 -0
- package/dist/diagnostics/potential.js +43 -0
- package/dist/diagnostics/potential.js.map +1 -0
- package/dist/diagnostics/probes.d.ts +31 -0
- package/dist/diagnostics/probes.d.ts.map +1 -0
- package/dist/diagnostics/probes.js +61 -0
- package/dist/diagnostics/probes.js.map +1 -0
- package/dist/diagnostics/render.d.ts +49 -0
- package/dist/diagnostics/render.d.ts.map +1 -0
- package/dist/diagnostics/render.js +132 -0
- package/dist/diagnostics/render.js.map +1 -0
- package/dist/export.d.ts +18 -0
- package/dist/export.d.ts.map +1 -0
- package/dist/export.js +17 -0
- package/dist/export.js.map +1 -0
- package/dist/forces/extended.d.ts +121 -0
- package/dist/forces/extended.d.ts.map +1 -0
- package/dist/forces/extended.js +674 -0
- package/dist/forces/extended.js.map +1 -0
- package/dist/forces/index.d.ts +33 -0
- package/dist/forces/index.d.ts.map +1 -0
- package/dist/forces/index.js +237 -0
- package/dist/forces/index.js.map +1 -0
- package/dist/forces/natural.d.ts +106 -0
- package/dist/forces/natural.d.ts.map +1 -0
- package/dist/forces/natural.js +385 -0
- package/dist/forces/natural.js.map +1 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +71 -0
- package/dist/index.js.map +1 -0
- package/dist/inspect/budget.d.ts +17 -0
- package/dist/inspect/budget.d.ts.map +1 -0
- package/dist/inspect/budget.js +19 -0
- package/dist/inspect/budget.js.map +1 -0
- package/dist/inspect/index.d.ts +10 -0
- package/dist/inspect/index.d.ts.map +1 -0
- package/dist/inspect/index.js +10 -0
- package/dist/inspect/index.js.map +1 -0
- package/dist/inspect/report.d.ts +17 -0
- package/dist/inspect/report.d.ts.map +1 -0
- package/dist/inspect/report.js +44 -0
- package/dist/inspect/report.js.map +1 -0
- package/dist/inspect/snapshot.d.ts +21 -0
- package/dist/inspect/snapshot.d.ts.map +1 -0
- package/dist/inspect/snapshot.js +30 -0
- package/dist/inspect/snapshot.js.map +1 -0
- package/dist/recipes/catalog.d.ts +51 -0
- package/dist/recipes/catalog.d.ts.map +1 -0
- package/dist/recipes/catalog.js +1496 -0
- package/dist/recipes/catalog.js.map +1 -0
- package/dist/recipes/charge.d.ts +18 -0
- package/dist/recipes/charge.d.ts.map +1 -0
- package/dist/recipes/charge.js +27 -0
- package/dist/recipes/charge.js.map +1 -0
- package/dist/recipes/compile.d.ts +93 -0
- package/dist/recipes/compile.d.ts.map +1 -0
- package/dist/recipes/compile.js +113 -0
- package/dist/recipes/compile.js.map +1 -0
- package/dist/recipes/explain.d.ts +8 -0
- package/dist/recipes/explain.d.ts.map +1 -0
- package/dist/recipes/explain.js +46 -0
- package/dist/recipes/explain.js.map +1 -0
- package/dist/recipes/gallery.d.ts +6 -0
- package/dist/recipes/gallery.d.ts.map +1 -0
- package/dist/recipes/gallery.js +6 -0
- package/dist/recipes/gallery.js.map +1 -0
- package/dist/recipes/gravity.d.ts +16 -0
- package/dist/recipes/gravity.d.ts.map +1 -0
- package/dist/recipes/gravity.js +27 -0
- package/dist/recipes/gravity.js.map +1 -0
- package/dist/recipes/index.d.ts +18 -0
- package/dist/recipes/index.d.ts.map +1 -0
- package/dist/recipes/index.js +36 -0
- package/dist/recipes/index.js.map +1 -0
- package/dist/recipes/intent.d.ts +44 -0
- package/dist/recipes/intent.d.ts.map +1 -0
- package/dist/recipes/intent.js +46 -0
- package/dist/recipes/intent.js.map +1 -0
- package/dist/recipes/schema.d.ts +103 -0
- package/dist/recipes/schema.d.ts.map +1 -0
- package/dist/recipes/schema.js +123 -0
- package/dist/recipes/schema.js.map +1 -0
- package/dist/recipes/wayfinding.d.ts +39 -0
- package/dist/recipes/wayfinding.d.ts.map +1 -0
- package/dist/recipes/wayfinding.js +77 -0
- package/dist/recipes/wayfinding.js.map +1 -0
- package/dist/semantic/index.d.ts +13 -0
- package/dist/semantic/index.d.ts.map +1 -0
- package/dist/semantic/index.js +31 -0
- package/dist/semantic/index.js.map +1 -0
- package/dist/semantic/layers.d.ts +24 -0
- package/dist/semantic/layers.d.ts.map +1 -0
- package/dist/semantic/layers.js +27 -0
- package/dist/semantic/layers.js.map +1 -0
- package/dist/semantic/materials.d.ts +20 -0
- package/dist/semantic/materials.d.ts.map +1 -0
- package/dist/semantic/materials.js +17 -0
- package/dist/semantic/materials.js.map +1 -0
- package/dist/semantic/states.d.ts +11 -0
- package/dist/semantic/states.d.ts.map +1 -0
- package/dist/semantic/states.js +26 -0
- package/dist/semantic/states.js.map +1 -0
- package/dist/visual/channels.d.ts +71 -0
- package/dist/visual/channels.d.ts.map +1 -0
- package/dist/visual/channels.js +70 -0
- package/dist/visual/channels.js.map +1 -0
- package/dist/visual/index.d.ts +39 -0
- package/dist/visual/index.d.ts.map +1 -0
- package/dist/visual/index.js +30 -0
- package/dist/visual/index.js.map +1 -0
- package/dist/visual/lint.d.ts +41 -0
- package/dist/visual/lint.d.ts.map +1 -0
- package/dist/visual/lint.js +58 -0
- package/dist/visual/lint.js.map +1 -0
- package/dist/visual/mapping.d.ts +13 -0
- package/dist/visual/mapping.d.ts.map +1 -0
- package/dist/visual/mapping.js +43 -0
- package/dist/visual/mapping.js.map +1 -0
- package/dist/visual/semantic-text.d.ts +28 -0
- package/dist/visual/semantic-text.d.ts.map +1 -0
- package/dist/visual/semantic-text.js +36 -0
- package/dist/visual/semantic-text.js.map +1 -0
- package/dist/visual/tokens.d.ts +23 -0
- package/dist/visual/tokens.d.ts.map +1 -0
- package/dist/visual/tokens.js +54 -0
- package/dist/visual/tokens.js.map +1 -0
- package/dist/visual/visualization.d.ts +31 -0
- package/dist/visual/visualization.d.ts.map +1 -0
- package/dist/visual/visualization.js +47 -0
- package/dist/visual/visualization.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"materials.d.ts","sourceRoot":"","sources":["../../src/semantic/materials.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,MAAM,mBAAmB,GAC3B,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,OAAO,GACP,QAAQ,GACR,OAAO,GACP,OAAO,GACP,OAAO,CAAC;AAEZ,MAAM,WAAW,cAAc;IAC7B,oDAAoD;IACpD,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,kCAAkC;IAClC,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,MAAM,CAAC,mBAAmB,EAAE,cAAc,CAAC,CAWvF,CAAC;AAEF,mDAAmD;AACnD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,mBAAmB,GAAG,MAAM,CAElE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const INTERACTION_MATERIALS = {
|
|
2
|
+
glass: { tokens: ['lens', 'wall'], note: 'lens + reflect + low drag' },
|
|
3
|
+
rubber: { tokens: ['tether', 'viscosity'], note: 'spring + damping' },
|
|
4
|
+
liquid: { tokens: ['cohesion', 'pressure'], render: ['metaballs'], note: 'cohesion + pressure' },
|
|
5
|
+
plasma: { tokens: ['fieldflow', 'thermal'], render: ['trails', 'field-lines'], note: 'fieldflow + thermal + trails' },
|
|
6
|
+
dust: { tokens: ['diffuse'], note: 'diffuse + low mass' },
|
|
7
|
+
metal: { tokens: ['magnetism', 'wall'], note: 'magnetism + reflect' },
|
|
8
|
+
fabric: { tokens: ['link', 'shear'], note: 'link + shear' },
|
|
9
|
+
paper: { tokens: ['memory'], note: 'low motion + memory' },
|
|
10
|
+
stone: { tokens: ['wall'], note: 'high mass + low response' },
|
|
11
|
+
smoke: { tokens: ['diffuse', 'stream'], render: ['trails'], note: 'diffuse + stream + entropy' },
|
|
12
|
+
};
|
|
13
|
+
/** The `data-body` token string for a material. */
|
|
14
|
+
export function materialBody(material) {
|
|
15
|
+
return INTERACTION_MATERIALS[material].tokens.join(' ');
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=materials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"materials.js","sourceRoot":"","sources":["../../src/semantic/materials.ts"],"names":[],"mappings":"AA6BA,MAAM,CAAC,MAAM,qBAAqB,GAA0D;IAC1F,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,2BAA2B,EAAE;IACtE,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE;IACrE,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,qBAAqB,EAAE;IAChG,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC,QAAQ,EAAE,aAAa,CAAC,EAAE,IAAI,EAAE,8BAA8B,EAAE;IACrH,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,oBAAoB,EAAE;IACzD,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,qBAAqB,EAAE;IACrE,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE;IAC3D,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,qBAAqB,EAAE;IAC1D,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,0BAA0B,EAAE;IAC7D,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,4BAA4B,EAAE;CACjG,CAAC;AAEF,mDAAmD;AACnD,MAAM,UAAU,YAAY,CAAC,QAA6B;IACxD,OAAO,qBAAqB,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Field states (worldclass §9, interaction §23 "state machines as physical scenes"). A small,
|
|
3
|
+
* named state set plus the field behavior each implies — so a component's state machine can map
|
|
4
|
+
* directly onto field behavior. Pure data + transition validation; node-testable.
|
|
5
|
+
*/
|
|
6
|
+
export type FieldState = 'idle' | 'focused' | 'searching' | 'navigating' | 'reading' | 'warning' | 'critical' | 'celebrating' | 'hovered' | 'pressed' | 'loading' | 'success' | 'error';
|
|
7
|
+
/** state → the field behavior it produces (interaction §23 table). */
|
|
8
|
+
export declare const FIELD_STATES: Readonly<Record<FieldState, string>>;
|
|
9
|
+
/** Whether a string is a known field state. */
|
|
10
|
+
export declare function isFieldState(s: string): s is FieldState;
|
|
11
|
+
//# sourceMappingURL=states.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"states.d.ts","sourceRoot":"","sources":["../../src/semantic/states.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,UAAU,GAElB,MAAM,GACN,SAAS,GACT,WAAW,GACX,YAAY,GACZ,SAAS,GACT,SAAS,GACT,UAAU,GACV,aAAa,GAEb,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,OAAO,CAAC;AAEZ,sEAAsE;AACtE,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAc7D,CAAC;AAEF,+CAA+C;AAC/C,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,IAAI,UAAU,CAEvD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Field states (worldclass §9, interaction §23 "state machines as physical scenes"). A small,
|
|
3
|
+
* named state set plus the field behavior each implies — so a component's state machine can map
|
|
4
|
+
* directly onto field behavior. Pure data + transition validation; node-testable.
|
|
5
|
+
*/
|
|
6
|
+
/** state → the field behavior it produces (interaction §23 table). */
|
|
7
|
+
export const FIELD_STATES = {
|
|
8
|
+
idle: 'ambient',
|
|
9
|
+
focused: 'attract + feedback',
|
|
10
|
+
searching: 'scatter → wells',
|
|
11
|
+
navigating: 'stream',
|
|
12
|
+
reading: 'memory trail',
|
|
13
|
+
warning: 'entropy / thermal',
|
|
14
|
+
critical: 'reduce sources / warn',
|
|
15
|
+
celebrating: 'burst / emission',
|
|
16
|
+
hovered: 'attract',
|
|
17
|
+
pressed: 'sink (absorb)',
|
|
18
|
+
loading: 'stream / swirl',
|
|
19
|
+
success: 'release',
|
|
20
|
+
error: 'repel + thermal',
|
|
21
|
+
};
|
|
22
|
+
/** Whether a string is a known field state. */
|
|
23
|
+
export function isFieldState(s) {
|
|
24
|
+
return s in FIELD_STATES;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=states.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"states.js","sourceRoot":"","sources":["../../src/semantic/states.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAmBH,sEAAsE;AACtE,MAAM,CAAC,MAAM,YAAY,GAAyC;IAChE,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,oBAAoB;IAC7B,SAAS,EAAE,iBAAiB;IAC5B,UAAU,EAAE,QAAQ;IACpB,OAAO,EAAE,cAAc;IACvB,OAAO,EAAE,mBAAmB;IAC5B,QAAQ,EAAE,uBAAuB;IACjC,WAAW,EAAE,kBAAkB;IAC/B,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,eAAe;IACxB,OAAO,EAAE,gBAAgB;IACzB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,iBAAiB;CACzB,CAAC;AAEF,+CAA+C;AAC/C,MAAM,UAAU,YAAY,CAAC,CAAS;IACpC,OAAO,CAAC,IAAI,YAAY,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visual channels (visual-language §3, §5, §6, §9) — the metric→appearance mappings, as pure
|
|
3
|
+
* functions returning plain value objects plus CSS string builders. Every channel is bounded so a
|
|
4
|
+
* runaway metric can't blow out contrast, saturation, or glow (the §5.2 accessibility caps). The
|
|
5
|
+
* caller writes the strings to the DOM; nothing here touches it.
|
|
6
|
+
*/
|
|
7
|
+
import type { ElementMetrics } from '../agents/element-agent.ts';
|
|
8
|
+
export interface TypographyOpts {
|
|
9
|
+
/** variable-font weight range. */
|
|
10
|
+
weight?: [number, number];
|
|
11
|
+
/** optical-size range. */
|
|
12
|
+
opsz?: [number, number];
|
|
13
|
+
/** letter-spacing range in em. */
|
|
14
|
+
tracking?: [number, number];
|
|
15
|
+
}
|
|
16
|
+
export interface TypographyValue {
|
|
17
|
+
weight: number;
|
|
18
|
+
opsz: number;
|
|
19
|
+
tracking: number;
|
|
20
|
+
/** text-shadow glow radius in px (from attention). */
|
|
21
|
+
glow: number;
|
|
22
|
+
}
|
|
23
|
+
/** Map density (presence) and attention (emphasis) to live variable-font axes + glow. */
|
|
24
|
+
export declare function typography(m: ElementMetrics, opts?: TypographyOpts): TypographyValue;
|
|
25
|
+
/** The CSS a `TypographyValue` produces (font-variation-settings + text-shadow). */
|
|
26
|
+
export declare function typographyCss(v: TypographyValue, glowColor?: string): Record<string, string>;
|
|
27
|
+
export interface Hsl {
|
|
28
|
+
h: number;
|
|
29
|
+
s: number;
|
|
30
|
+
l: number;
|
|
31
|
+
a: number;
|
|
32
|
+
}
|
|
33
|
+
export interface ColorCaps {
|
|
34
|
+
/** max saturation (a11y §5.2). */
|
|
35
|
+
maxSat: number;
|
|
36
|
+
/** lightness floor/ceiling to keep contrast. */
|
|
37
|
+
minL: number;
|
|
38
|
+
maxL: number;
|
|
39
|
+
}
|
|
40
|
+
export declare const DEFAULT_COLOR_CAPS: ColorCaps;
|
|
41
|
+
/**
|
|
42
|
+
* Field-driven color (§5.1): density deepens tone, heat warms the hue + lifts it, attention raises
|
|
43
|
+
* saturation, entropy desaturates and jitters the hue, coherence pulls back toward the base hue,
|
|
44
|
+
* memory adds a persistent tint. Bounded by the accessibility caps so it never blows out.
|
|
45
|
+
*/
|
|
46
|
+
export declare function fieldColor(base: Hsl, m: ElementMetrics, caps?: ColorCaps): Hsl;
|
|
47
|
+
export declare function hslString(c: Hsl): string;
|
|
48
|
+
export interface ShapeValue {
|
|
49
|
+
/** scale multiplier. */
|
|
50
|
+
scale: number;
|
|
51
|
+
/** corner radius in px. */
|
|
52
|
+
radius: number;
|
|
53
|
+
/** stroke width in px. */
|
|
54
|
+
stroke: number;
|
|
55
|
+
}
|
|
56
|
+
/** Pressure swells scale; coherence sharpens corners; attention thickens the stroke. */
|
|
57
|
+
export declare function shape(m: ElementMetrics): ShapeValue;
|
|
58
|
+
export interface EmissionValue {
|
|
59
|
+
/** glow radius in px. */
|
|
60
|
+
radius: number;
|
|
61
|
+
/** glow alpha. */
|
|
62
|
+
alpha: number;
|
|
63
|
+
}
|
|
64
|
+
export interface EmissionOpts {
|
|
65
|
+
maxGlow?: number;
|
|
66
|
+
/** under reduced motion, emission becomes a flat static highlight, not a pulsing bloom. */
|
|
67
|
+
reducedMotion?: boolean;
|
|
68
|
+
}
|
|
69
|
+
/** Heat drives emission; capped by maxGlow and flattened under reduced motion. */
|
|
70
|
+
export declare function emission(m: ElementMetrics, opts?: EmissionOpts): EmissionValue;
|
|
71
|
+
//# sourceMappingURL=channels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../src/visual/channels.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAKjE,MAAM,WAAW,cAAc;IAC7B,kCAAkC;IAClC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,0BAA0B;IAC1B,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7B;AACD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;CACd;AAED,yFAAyF;AACzF,wBAAgB,UAAU,CAAC,CAAC,EAAE,cAAc,EAAE,IAAI,GAAE,cAAmB,GAAG,eAAe,CAYxF;AAED,oFAAoF;AACpF,wBAAgB,aAAa,CAAC,CAAC,EAAE,eAAe,EAAE,SAAS,SAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMpG;AAGD,MAAM,WAAW,GAAG;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AACD,MAAM,WAAW,SAAS;IACxB,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AACD,eAAO,MAAM,kBAAkB,EAAE,SAAmD,CAAC;AAErF;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,cAAc,EAAE,IAAI,GAAE,SAA8B,GAAG,GAAG,CAsBlG;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAExC;AAGD,MAAM,WAAW,UAAU;IACzB,wBAAwB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC;CAChB;AACD,wFAAwF;AACxF,wBAAgB,KAAK,CAAC,CAAC,EAAE,cAAc,GAAG,UAAU,CAMnD;AAGD,MAAM,WAAW,aAAa;IAC5B,yBAAyB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AACD,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2FAA2F;IAC3F,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AACD,kFAAkF;AAClF,wBAAgB,QAAQ,CAAC,CAAC,EAAE,cAAc,EAAE,IAAI,GAAE,YAAiB,GAAG,aAAa,CAKlF"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { clamp, lerp } from "../core/math.js";
|
|
2
|
+
import { clamp01, mapRange } from "./mapping.js";
|
|
3
|
+
/** Map density (presence) and attention (emphasis) to live variable-font axes + glow. */
|
|
4
|
+
export function typography(m, opts = {}) {
|
|
5
|
+
const d = clamp01(m.density ?? 0);
|
|
6
|
+
const a = clamp01(m.attention ?? 0);
|
|
7
|
+
const [wLo, wHi] = opts.weight ?? [300, 800];
|
|
8
|
+
const [oLo, oHi] = opts.opsz ?? [12, 48];
|
|
9
|
+
const [tLo, tHi] = opts.tracking ?? [0, -0.02];
|
|
10
|
+
return {
|
|
11
|
+
weight: Math.round(lerp(wLo, wHi, d)),
|
|
12
|
+
opsz: Math.round(lerp(oLo, oHi, d)),
|
|
13
|
+
tracking: lerp(tLo, tHi, d),
|
|
14
|
+
glow: lerp(0, 12, a),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/** The CSS a `TypographyValue` produces (font-variation-settings + text-shadow). */
|
|
18
|
+
export function typographyCss(v, glowColor = 'currentColor') {
|
|
19
|
+
return {
|
|
20
|
+
'font-variation-settings': `"wght" ${v.weight}, "opsz" ${v.opsz}`,
|
|
21
|
+
'letter-spacing': `${v.tracking.toFixed(3)}em`,
|
|
22
|
+
'text-shadow': v.glow > 0.1 ? `0 0 ${v.glow.toFixed(1)}px ${glowColor}` : 'none',
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export const DEFAULT_COLOR_CAPS = { maxSat: 0.9, minL: 0.25, maxL: 0.85 };
|
|
26
|
+
/**
|
|
27
|
+
* Field-driven color (§5.1): density deepens tone, heat warms the hue + lifts it, attention raises
|
|
28
|
+
* saturation, entropy desaturates and jitters the hue, coherence pulls back toward the base hue,
|
|
29
|
+
* memory adds a persistent tint. Bounded by the accessibility caps so it never blows out.
|
|
30
|
+
*/
|
|
31
|
+
export function fieldColor(base, m, caps = DEFAULT_COLOR_CAPS) {
|
|
32
|
+
const heat = clamp01(m.heat ?? 0);
|
|
33
|
+
const entropy = clamp01(m.entropy ?? 0);
|
|
34
|
+
const coherence = clamp01(m.coherence ?? 0);
|
|
35
|
+
const attention = clamp01(m.attention ?? 0);
|
|
36
|
+
const density = clamp01(m.density ?? 0);
|
|
37
|
+
const memory = clamp01(m.memory ?? 0);
|
|
38
|
+
// hue: heat shifts toward warm (~30°); entropy jitters; coherence pulls back to base.
|
|
39
|
+
const warmTarget = 30;
|
|
40
|
+
let h = lerp(base.h, warmTarget, heat * 0.5);
|
|
41
|
+
h += entropy * 24 * (((h % 7) - 3) / 3); // deterministic per-hue jitter, not random
|
|
42
|
+
h = lerp(h, base.h, coherence * 0.6);
|
|
43
|
+
h = ((h % 360) + 360) % 360;
|
|
44
|
+
// saturation: attention raises it, entropy lowers it; capped.
|
|
45
|
+
const s = clamp(base.s + attention * 0.4 - entropy * 0.5, 0, caps.maxSat);
|
|
46
|
+
// lightness: density deepens (darkens) the tone, heat lifts it; clamped for contrast.
|
|
47
|
+
const l = clamp(base.l - density * 0.2 + heat * 0.15, caps.minL, caps.maxL);
|
|
48
|
+
// alpha: a faint persistent memory tint nudges opacity up.
|
|
49
|
+
const a = clamp01(base.a + memory * 0.1);
|
|
50
|
+
return { h, s, l, a };
|
|
51
|
+
}
|
|
52
|
+
export function hslString(c) {
|
|
53
|
+
return `hsl(${c.h.toFixed(0)} ${(c.s * 100).toFixed(0)}% ${(c.l * 100).toFixed(0)}% / ${c.a.toFixed(2)})`;
|
|
54
|
+
}
|
|
55
|
+
/** Pressure swells scale; coherence sharpens corners; attention thickens the stroke. */
|
|
56
|
+
export function shape(m) {
|
|
57
|
+
return {
|
|
58
|
+
scale: mapRange(clamp01(m.pressure ?? 0), 0, 1, 1, 1.25, 'ease-out'),
|
|
59
|
+
radius: mapRange(clamp01(m.coherence ?? 0), 0, 1, 16, 2),
|
|
60
|
+
stroke: mapRange(clamp01(m.attention ?? 0), 0, 1, 1, 3),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/** Heat drives emission; capped by maxGlow and flattened under reduced motion. */
|
|
64
|
+
export function emission(m, opts = {}) {
|
|
65
|
+
const heat = clamp01(m.heat ?? 0);
|
|
66
|
+
const max = opts.maxGlow ?? 24;
|
|
67
|
+
const radius = mapRange(heat, 0, 1, 0, max, opts.reducedMotion ? 'linear' : 'ease-out');
|
|
68
|
+
return { radius, alpha: clamp01(heat * (opts.reducedMotion ? 0.5 : 0.8)) };
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=channels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channels.js","sourceRoot":"","sources":["../../src/visual/channels.ts"],"names":[],"mappings":"AAOA,OAAO,EA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I,EAAE,UAAU,CAAC;QACpE,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QACxD,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;KACxD,CAAC;AACJ,CAAC;AAcD,kFAAkF;AAClF,MAAM,UAAU,QAAQ,CAAC,CAAiB,EAAE,OAAqB,EAAE;IACjE,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC;IAClC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;IAC/B,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IACxF,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;AAC7E,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The visual language layer (Phase 6 — visual-language-and-geometry). Pure, dependency-free
|
|
3
|
+
* mappings from field metrics to appearance (typography, color, shape, emission), the lint rules
|
|
4
|
+
* that keep them accessible, the semantic-text fallback, and the Visual Layer declaration every
|
|
5
|
+
* visual layer must publish (§18). The math returns plain values + CSS strings; the DOM write
|
|
6
|
+
* stays in the feedback/agent layer.
|
|
7
|
+
*/
|
|
8
|
+
import type { ContractMeta } from '../contracts/types.ts';
|
|
9
|
+
export * from './mapping.ts';
|
|
10
|
+
export * from './channels.ts';
|
|
11
|
+
export * from './lint.ts';
|
|
12
|
+
export * from './semantic-text.ts';
|
|
13
|
+
export * from './visualization.ts';
|
|
14
|
+
export * from './tokens.ts';
|
|
15
|
+
/** A visual layer's self-declaration (visual-language §18). Inspectable + lintable. */
|
|
16
|
+
export interface VisualLayerDeclaration {
|
|
17
|
+
name: string;
|
|
18
|
+
/** the field metrics it reads (e.g. ['density', 'attention']). */
|
|
19
|
+
sourceMetrics: readonly string[];
|
|
20
|
+
/** the visual properties it writes (e.g. ['font-variation-settings', 'text-shadow']). */
|
|
21
|
+
targetProperties: readonly string[];
|
|
22
|
+
/** must be false unless the layer is also declared feedback/force. */
|
|
23
|
+
mutatesPhysics: boolean;
|
|
24
|
+
/** does it set data-state on the DOM? */
|
|
25
|
+
writesDomState: boolean;
|
|
26
|
+
/** what happens under prefers-reduced-motion. */
|
|
27
|
+
reducedMotion: string;
|
|
28
|
+
/** the accessible fallback that preserves meaning. */
|
|
29
|
+
accessibilityFallback: string;
|
|
30
|
+
/** rough cost, e.g. 'CSS only' | 'canvas' | 'svg'. */
|
|
31
|
+
performanceCost: string;
|
|
32
|
+
/** is it visible in debug/inspector? */
|
|
33
|
+
debugVisibility: boolean;
|
|
34
|
+
}
|
|
35
|
+
/** The authoring attributes the visual language recognizes (visual-language §19). */
|
|
36
|
+
export declare const VISUAL_AUTHORING_ATTRIBUTES: readonly ["data-visual", "data-field-material", "data-color-mode", "data-shape-mode", "data-pattern-mode", "data-emission", "data-container-role", "data-semantic-layer", "data-reduced-visual"];
|
|
37
|
+
/** The Visual Language Contract (system-contracts §19, visual-language §18). */
|
|
38
|
+
export declare const VISUAL_CONTRACTS: readonly ContractMeta[];
|
|
39
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/visual/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAE5B,uFAAuF;AACvF,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,yFAAyF;IACzF,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,sEAAsE;IACtE,cAAc,EAAE,OAAO,CAAC;IACxB,yCAAyC;IACzC,cAAc,EAAE,OAAO,CAAC;IACxB,iDAAiD;IACjD,aAAa,EAAE,MAAM,CAAC;IACtB,sDAAsD;IACtD,qBAAqB,EAAE,MAAM,CAAC;IAC9B,sDAAsD;IACtD,eAAe,EAAE,MAAM,CAAC;IACxB,wCAAwC;IACxC,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,qFAAqF;AACrF,eAAO,MAAM,2BAA2B,kMAU9B,CAAC;AAEX,gFAAgF;AAChF,eAAO,MAAM,gBAAgB,EAAE,SAAS,YAAY,EASnD,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export * from "./mapping.js";
|
|
2
|
+
export * from "./channels.js";
|
|
3
|
+
export * from "./lint.js";
|
|
4
|
+
export * from "./semantic-text.js";
|
|
5
|
+
export * from "./visualization.js";
|
|
6
|
+
export * from "./tokens.js";
|
|
7
|
+
/** The authoring attributes the visual language recognizes (visual-language §19). */
|
|
8
|
+
export const VISUAL_AUTHORING_ATTRIBUTES = [
|
|
9
|
+
'data-visual',
|
|
10
|
+
'data-field-material',
|
|
11
|
+
'data-color-mode',
|
|
12
|
+
'data-shape-mode',
|
|
13
|
+
'data-pattern-mode',
|
|
14
|
+
'data-emission',
|
|
15
|
+
'data-container-role',
|
|
16
|
+
'data-semantic-layer',
|
|
17
|
+
'data-reduced-visual',
|
|
18
|
+
];
|
|
19
|
+
/** The Visual Language Contract (system-contracts §19, visual-language §18). */
|
|
20
|
+
export const VISUAL_CONTRACTS = [
|
|
21
|
+
{
|
|
22
|
+
name: 'Visual Language Contract',
|
|
23
|
+
mustExist: 'a declared mapping from field metrics to bounded visual properties; a VisualLayerDeclaration per layer',
|
|
24
|
+
mayMutate: 'appearance (visually) and, if it opts in, data-state — never physics',
|
|
25
|
+
sideEffectFree: 'the metric→appearance math (pure value + CSS strings); the DOM write is separate',
|
|
26
|
+
testable: 'mappings are bounded (saturation/glow/contrast caps); reduced-motion keeps meaning; semantic text stays live',
|
|
27
|
+
inspectable: 'each layer’s declaration (source metrics, targets, mutatesPhysics, reduced-motion, a11y, cost)',
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/visual/index.ts"],"names":[],"mappings":"AASA,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAuB5B,qFAAqF;AACrF,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,aAAa;IACb,qBAAqB;IACrB,iBAAiB;IACjB,iBAAiB;IACjB,mBAAmB;IACnB,eAAe;IACf,qBAAqB;IACrB,qBAAqB;IACrB,qBAAqB;CACb,CAAC;AAEX,gFAAgF;AAChF,MAAM,CAAC,MAAM,gBAAgB,GAA4B;IACvD;QACE,IAAI,EAAE,0BAA0B;QAChC,SAAS,EAAE,wGAAwG;QACnH,SAAS,EAAE,sEAAsE;QACjF,cAAc,EAAE,kFAAkF;QAClG,QAAQ,EAAE,8GAA8G;QACxH,WAAW,EAAE,gGAAgG;KAC9G;CACF,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type LintSeverity = 'info' | 'warning' | 'error' | 'fatal';
|
|
2
|
+
export interface LintFinding {
|
|
3
|
+
rule: string;
|
|
4
|
+
severity: LintSeverity;
|
|
5
|
+
message: string;
|
|
6
|
+
}
|
|
7
|
+
/** What a scene declares, for the linter to reason about. All fields optional. */
|
|
8
|
+
export interface SceneDescriptor {
|
|
9
|
+
/** force tokens present on the page's bodies. */
|
|
10
|
+
forces?: readonly string[];
|
|
11
|
+
/** are any particles charged (so charge/magnetism can act)? */
|
|
12
|
+
hasChargedParticles?: boolean;
|
|
13
|
+
/** does any force own a field() for transport/field-lines to read? */
|
|
14
|
+
hasFieldSource?: boolean;
|
|
15
|
+
/** are field lines being rendered? */
|
|
16
|
+
fieldLinesEnabled?: boolean;
|
|
17
|
+
/** declared sources and whether each is budgeted. */
|
|
18
|
+
sources?: readonly {
|
|
19
|
+
token: string;
|
|
20
|
+
budgeted: boolean;
|
|
21
|
+
}[];
|
|
22
|
+
/** particle count in the busiest local cell. */
|
|
23
|
+
localCellParticles?: number;
|
|
24
|
+
/** is there a reduced-motion fallback for motion-dependent meaning? */
|
|
25
|
+
reducedMotionFallback?: boolean;
|
|
26
|
+
/** the max saturation a color layer uses, and its cap. */
|
|
27
|
+
saturation?: number;
|
|
28
|
+
saturationCap?: number;
|
|
29
|
+
/** the max glow a layer uses, and its cap. */
|
|
30
|
+
glow?: number;
|
|
31
|
+
glowCap?: number;
|
|
32
|
+
/** does any state rely on color alone to convey meaning? */
|
|
33
|
+
colorOnlyMeaning?: boolean;
|
|
34
|
+
/** is any expressive glyph missing accessible text? */
|
|
35
|
+
glyphOnlySemanticText?: boolean;
|
|
36
|
+
/** per-body token lists, for the duplicate-pull check. */
|
|
37
|
+
bodyTokens?: readonly (readonly string[])[];
|
|
38
|
+
}
|
|
39
|
+
/** Run all lint rules over a scene; returns every finding (empty = clean). */
|
|
40
|
+
export declare function runVisualLint(scene: SceneDescriptor): LintF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AAC9E,wBAAgB,aAAa,CAAC,KAAK,EAAE,eAAe,GAAG,WAAW,EAAE,CA+CnE"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visual + scene lint rules (testing-and-conformance §14, visual-language §5.2). Static checks over
|
|
3
|
+
* a scene descriptor that catch the common misconfigurations the docs warn about — magnetism with
|
|
4
|
+
* no charge, fieldflow with no field to follow, an unbudgeted source, a missing reduced-motion
|
|
5
|
+
* fallback, color carrying meaning alone, saturation/glow over the accessibility caps. Pure: it
|
|
6
|
+
* reports findings, it does not touch the DOM.
|
|
7
|
+
*/
|
|
8
|
+
import { passportFor } from "../contracts/passport.js";
|
|
9
|
+
/** Forces that pull matter inward — stacking two on one body usually double-counts the pull. */
|
|
10
|
+
const PULL_FORCES = new Set(['attract', 'gravity', 'tether', 'cohesion']);
|
|
11
|
+
const LOCAL_CELL_MAX = 400;
|
|
12
|
+
/** Run all lint rules over a scene; returns every finding (empty = clean). */
|
|
13
|
+
export function runVisualLint(scene) {
|
|
14
|
+
const out = [];
|
|
15
|
+
const forces = scene.forces ?? [];
|
|
16
|
+
const add = (rule, severity, message) => {
|
|
17
|
+
out.push({ rule, severity, message });
|
|
18
|
+
};
|
|
19
|
+
// physics activity
|
|
20
|
+
for (const token of forces) {
|
|
21
|
+
const p = passportFor(token);
|
|
22
|
+
if (!p)
|
|
23
|
+
continue;
|
|
24
|
+
if (p.requiresCharge && scene.hasChargedParticles === false)
|
|
25
|
+
add('inactive-force', 'warning', `${token} requires charge but no charged particles are present — it will appear inactive`);
|
|
26
|
+
if (p.usesFieldAt && scene.hasFieldSource === false)
|
|
27
|
+
add('no-field-source', 'warning', `${token} follows a field but no force nearby owns a field() — nothing to follow`);
|
|
28
|
+
}
|
|
29
|
+
// field lines need a field() to trace
|
|
30
|
+
if (scene.fieldLinesEnabled && scene.hasFieldSource === false)
|
|
31
|
+
add('field-lines-no-source', 'warning', 'field lines are enabled but no force owns a field() to trace');
|
|
32
|
+
// duplicate pull on one body (e.g. data-body="gravity attract")
|
|
33
|
+
for (const tokens of scene.bodyTokens ?? []) {
|
|
34
|
+
const pulls = tokens.filter((t) => PULL_FORCES.has(t));
|
|
35
|
+
if (pulls.length > 1)
|
|
36
|
+
add('duplicate-pull', 'info', `body stacks multiple pull forces (${pulls.join(' + ')}) — may double-count the pull`);
|
|
37
|
+
}
|
|
38
|
+
// sources must be budgeted
|
|
39
|
+
for (const s of scene.sources ?? [])
|
|
40
|
+
if (!s.budgeted)
|
|
41
|
+
add('unbudgeted-source', 'error', `source "${s.token}" has no budget (cap + lifespan required)`);
|
|
42
|
+
// performance
|
|
43
|
+
if ((scene.localCellParticles ?? 0) > LOCAL_CELL_MAX)
|
|
44
|
+
add('local-cell-overload', 'warning', `local cell particle count ${scene.localCellParticles} exceeds ${LOCAL_CELL_MAX}`);
|
|
45
|
+
// accessibility
|
|
46
|
+
if (scene.reducedMotionFallback === false)
|
|
47
|
+
add('missing-reduced-motion', 'error', 'motion-dependent meaning has no reduced-motion fallback');
|
|
48
|
+
if (scene.colorOnlyMeaning)
|
|
49
|
+
add('color-only-meaning', 'error', 'color must not be the only carrier of meaning (add icon/text/outline)');
|
|
50
|
+
if (scene.glyphOnlySemanticText)
|
|
51
|
+
add('glyph-only-text', 'error', 'expressive glyphs must not be the only semantic text (add sr-only text)');
|
|
52
|
+
if (scene.saturation != null && scene.saturationCap != null && scene.saturation > scene.saturationCap)
|
|
53
|
+
add('saturation-over-cap', 'warning', `saturation ${scene.saturation} exceeds the accessibility cap ${scene.saturationCap}`);
|
|
54
|
+
if (scene.glow != null && scene.glowCap != null && scene.glow > scene.glowCap)
|
|
55
|
+
add('glow-over-cap', 'warning', `glow ${scene.glow} exceeds the cap ${scene.glowCap}`);
|
|
56
|
+
return out;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=lint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint.js","sourceRoot":"","sources":["../../src/visual/lint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AU,kCAAkC,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC;IAC/H,IAAI,KAAK,CAAC,IAAI,IAAI,IAAI,IAAI,KAAK,CAAC,OAAO,IAAI,IAAI,IAAI,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,OAAO;QAC3E,GAAG,CAAC,eAAe,EAAE,SAAS,EAAE,QAAQ,KAAK,CAAC,IAAI,oBAAoB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAEzF,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type Curve = 'linear' | 'ease-in' | 'ease-out' | 'ease' | 'exp';
|
|
2
|
+
/** Clamp to the unit interval [0,1]. */
|
|
3
|
+
export declare const clamp01: (v: number) => number;
|
|
4
|
+
/** Apply a response curve to a normalized input t ∈ [0,1]. */
|
|
5
|
+
export declare function curve(t: number, c?: Curve): number;
|
|
6
|
+
/** Map a value from an input range to an output range through a response curve. */
|
|
7
|
+
export declare function mapRange(v: number, inLo: number, inHi: number, outLo: number, outHi: number, c?: Curve): number;
|
|
8
|
+
/**
|
|
9
|
+
* Distance falloff (visual-language §7.2): a body's normalized influence at distance `d` within
|
|
10
|
+
* `range`, 1 at the core easing to 0 at the rim. `power` shapes the edge (2 = soft, 1 = linear).
|
|
11
|
+
*/
|
|
12
|
+
export declare function falloff(d: number, range: number, power?: number): number;
|
|
13
|
+
//# sourceMappingURL=mapping.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapping.d.ts","sourceRoot":"","sources":["../../src/visual/mapping.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,GAAG,KAAK,CAAC;AAEvE,wCAAwC;AACxC,eAAO,MAAM,OAAO,GAAI,GAAG,MAAM,KAAG,MAAwB,CAAC;AAE7D,8DAA8D;AAC9D,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,GAAE,KAAgB,GAAG,MAAM,CAc5D;AAED,mFAAmF;AACnF,wBAAgB,QAAQ,CACtB,CAAC,EAAE,MAAM,EACT,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,CAAC,GAAE,KAAgB,GAClB,MAAM,CAIR;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,SAAI,GAAG,MAAM,CAGnE"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visual mapping primitives (visual-language §1, §7). The visual language is, at root, a set of
|
|
3
|
+
* pure functions from a field metric (0..1) to a visual property — a weight, a hue, a scale, a glow
|
|
4
|
+
* radius. These are the building blocks: clamping, ranged interpolation with a response curve, and
|
|
5
|
+
* the distance falloff that turns a body's reach into a 0..1 influence. Zero dependencies —
|
|
6
|
+
* `clamp`/`lerp` are reused from the engine's math module so there is one source of truth.
|
|
7
|
+
*/
|
|
8
|
+
import { clamp, lerp } from "../core/math.js";
|
|
9
|
+
/** Clamp to the unit interval [0,1]. */
|
|
10
|
+
export const clamp01 = (v) => clamp(v, 0, 1);
|
|
11
|
+
/** Apply a response curve to a normalized input t ∈ [0,1]. */
|
|
12
|
+
export function curve(t, c = 'linear') {
|
|
13
|
+
const x = clamp01(t);
|
|
14
|
+
switch (c) {
|
|
15
|
+
case 'ease-in':
|
|
16
|
+
return x * x;
|
|
17
|
+
case 'ease-out':
|
|
18
|
+
return 1 - (1 - x) * (1 - x);
|
|
19
|
+
case 'ease':
|
|
20
|
+
return x * x * (3 - 2 * x); // smoothstep
|
|
21
|
+
case 'exp':
|
|
22
|
+
return x === 0 ? 0 : Math.pow(2, 10 * (x - 1));
|
|
23
|
+
default:
|
|
24
|
+
return x;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** Map a value from an input range to an output range through a response curve. */
|
|
28
|
+
export function mapRange(v, inLo, inHi, outLo, outHi, c = 'linear') {
|
|
29
|
+
if (inHi === inLo)
|
|
30
|
+
return outLo;
|
|
31
|
+
const t = curve((v - inLo) / (inHi - inLo), c);
|
|
32
|
+
return lerp(outLo, outHi, t);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Distance falloff (visual-language §7.2): a body's normalized influence at distance `d` within
|
|
36
|
+
* `range`, 1 at the core easing to 0 at the rim. `power` shapes the edge (2 = soft, 1 = linear).
|
|
37
|
+
*/
|
|
38
|
+
export function falloff(d, range, power = 2) {
|
|
39
|
+
if (range <= 0 || d >= range)
|
|
40
|
+
return 0;
|
|
41
|
+
return Math.pow(1 - d / range, power);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=mapping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapping.js","sourceRoot":"","sources":["../../src/visual/mapping.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAI9C,wCAAwC;AACxC,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAE7D,8DAA8D;AAC9D,MAAM,UAAU,KAAK,CAAC,CAAS,EAAE,IAAW,QAAQ;IAClD,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC;QACV,KAAK,SAAS;YACZ,OAAO,CAAC,GAAG,CAAC,CAAC;QACf,KAAK,UAAU;YACb,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC/B,KAAK,MAAM;YACT,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa;QAC3C,KAAK,KAAK;YACR,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACjD;YACE,OAAO,CAAC,CAAC;IACb,CAAC;AACH,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,QAAQ,CACtB,CAAS,EACT,IAAY,EACZ,IAAY,EACZ,KAAa,EACb,KAAa,EACb,IAAW,QAAQ;IAEnB,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAChC,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/C,OAAO,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;AAC/B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,CAAS,EAAE,KAAa,EAAE,KAAK,GAAG,CAAC;IACzD,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK;QAAE,OAAO,CAAC,CAAC;IACvC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Semantic-text fallback (visual-language §16, migration-plan §11). The visual layer may vectorize,
|
|
3
|
+
* distort, or shader-render glyphs, but the semantic layer must stay real HTML text — SVG/Canvas
|
|
4
|
+
* glyphs must never be the only source of meaning. These helpers check that an expressive element
|
|
5
|
+
* carries accessible text and build the recommended pattern. Operate on a minimal node shape, so
|
|
6
|
+
* they run without a DOM.
|
|
7
|
+
*/
|
|
8
|
+
/** The minimal node surface these checks need (a real Element satisfies it). */
|
|
9
|
+
export interface TextNodeLike {
|
|
10
|
+
textContent: string | null;
|
|
11
|
+
getAttribute(name: string): string | null;
|
|
12
|
+
querySelector(selector: string): unknown;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* True when the element exposes accessible text: visible text content, an `aria-label`, or an
|
|
16
|
+
* `.sr-only` child carrying the meaning. An expressive glyph that is `aria-hidden` with none of
|
|
17
|
+
* these fails — the visual is decorative-only and the meaning is lost.
|
|
18
|
+
*/
|
|
19
|
+
export declare function hasAccessibleText(node: TextNodeLike): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Build the recommended semantic-glyph pattern (migration-plan §11): a visually-hidden text span
|
|
22
|
+
* carrying the meaning, plus an `aria-hidden` SVG carrying the expressive form. Returns an HTML
|
|
23
|
+
* string the author can drop in.
|
|
24
|
+
*/
|
|
25
|
+
export declare function semanticGlyphMarkup(text: string, svgInner: string, tag?: string): string;
|
|
26
|
+
/** The CSS for an `.sr-only` utility, if the consuming app doesn't already ship one. */
|
|
27
|
+
export declare const SR_ONLY_CSS: string;
|
|
28
|
+
//# sourceMappingURL=semantic-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semantic-text.d.ts","sourceRoot":"","sources":["../../src/visual/semantic-text.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,gFAAgF;AAChF,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC1C,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1C;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAK7D;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,MAAM,CAQxF;AAED,wFAAwF;AACxF,eAAO,MAAM,WAAW,QAE2B,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Semantic-text fallback (visual-language §16, migration-plan §11). The visual layer may vectorize,
|
|
3
|
+
* distort, or shader-render glyphs, but the semantic layer must stay real HTML text — SVG/Canvas
|
|
4
|
+
* glyphs must never be the only source of meaning. These helpers check that an expressive element
|
|
5
|
+
* carries accessible text and build the recommended pattern. Operate on a minimal node shape, so
|
|
6
|
+
* they run without a DOM.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* True when the element exposes accessible text: visible text content, an `aria-label`, or an
|
|
10
|
+
* `.sr-only` child carrying the meaning. An expressive glyph that is `aria-hidden` with none of
|
|
11
|
+
* these fails — the visual is decorative-only and the meaning is lost.
|
|
12
|
+
*/
|
|
13
|
+
export function hasAccessibleText(node) {
|
|
14
|
+
const text = (node.textContent ?? '').trim();
|
|
15
|
+
if (text.length > 0)
|
|
16
|
+
return true;
|
|
17
|
+
if ((node.getAttribute('aria-label') ?? '').trim().length > 0)
|
|
18
|
+
return true;
|
|
19
|
+
return node.querySelector('.sr-only') != null;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Build the recommended semantic-glyph pattern (migration-plan §11): a visually-hidden text span
|
|
23
|
+
* carrying the meaning, plus an `aria-hidden` SVG carrying the expressive form. Returns an HTML
|
|
24
|
+
* string the author can drop in.
|
|
25
|
+
*/
|
|
26
|
+
export function semanticGlyphMarkup(text, svgInner, tag = 'span') {
|
|
27
|
+
const safe = text.replace(/[<>&]/g, (c) => ({ '<': '<', '>': '>', '&': '&' })[c]);
|
|
28
|
+
return (`<${tag} class="field-glyph">` +
|
|
29
|
+
`<span class="sr-only">${safe}</span>` +
|
|
30
|
+
`<svg aria-hidden="true" focusable="false">${svgInner}</svg>` +
|
|
31
|
+
`</${tag}>`);
|
|
32
|
+
}
|
|
33
|
+
/** The CSS for an `.sr-only` utility, if the consuming app doesn't already ship one. */
|
|
34
|
+
export const SR_ONLY_CSS = '.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;' +
|
|
35
|
+
'clip:rect(0,0,0,0);white-space:nowrap;border:0}';
|
|
36
|
+
//# sourceMappingURL=semantic-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semantic-text.js","sourceRoot":"","sources":["../../src/visual/semantic-text.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAkB;IAClD,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC7C,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IACjC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAC3E,OAAO,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC;AAChD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY,EAAE,QAAgB,EAAE,GAAG,GAAG,MAAM;IAC9E,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC;IAC7F,OAAO,CACL,IAAI,GAAG,uBAAuB;QAC9B,yBAAyB,IAAI,SAAS;QACtC,6CAA6C,QAAQ,QAAQ;QAC7D,KAAK,GAAG,GAAG,CACZ,CAAC;AACJ,CAAC;AAED,wFAAwF;AACxF,MAAM,CAAC,MAAM,WAAW,GACtB,wFAAwF;IACxF,iDAAiD,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Field design tokens, roles, and the output-variable catalog (worldclass §11/§12, interaction
|
|
3
|
+
* §5/§11/§13). Tuning knobs as `--field-*` custom properties, the `data-field-role` value set, and
|
|
4
|
+
* the full list of `--field-*` variables the field can write back (including the attention/memory
|
|
5
|
+
* sub-variables). Pure data + a CSS string builder. (Distinct from `config/tokens.ts`, which is the
|
|
6
|
+
* force-palette token set.)
|
|
7
|
+
*/
|
|
8
|
+
/** Field tuning tokens (worldclass §11), field-first names. */
|
|
9
|
+
export declare const FIELD_DESIGN_TOKENS: Readonly<Record<string, string>>;
|
|
10
|
+
/** The design tokens as a CSS rule (drop into a stylesheet). */
|
|
11
|
+
export declare function fieldTokensCss(selector?: string): string;
|
|
12
|
+
/** Field roles (worldclass §12) — `data-field-role` values. */
|
|
13
|
+
export declare const FIELD_ROLES: readonly ["source", "sink", "anchor", "boundary", "sensor", "display"];
|
|
14
|
+
export type FieldRole = (typeof FIELD_ROLES)[number];
|
|
15
|
+
/** Whether a string is a known field role. */
|
|
16
|
+
export declare function isFieldRole(s: string): s is FieldRole;
|
|
17
|
+
/**
|
|
18
|
+
* The full `--field-*` output-variable catalog the field can write back, including the attention
|
|
19
|
+
* and memory sub-variables (interaction §5/§11/§13) and layout shift. The core loop writes the
|
|
20
|
+
* primary metrics today; the sub-vars are the agreed names for the agent layer to emit.
|
|
21
|
+
*/
|
|
22
|
+
export declare const FIELD_OUTPUT_VARS: readonly ["--field-density", "--field-attention", "--field-heat", "--field-entropy", "--field-coherence", "--field-memory", "--field-pressure", "--field-pull-x", "--field-pull-y", "--field-attention-share", "--field-attention-rank", "--field-related-attention", "--field-path-use", "--field-user-wake", "--field-layout-shift"];
|
|
23
|
+
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/visual/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,+DAA+D;AAC/D,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAShE,CAAC;AAEF,gEAAgE;AAChE,wBAAgB,cAAc,CAAC,QAAQ,SAAU,GAAG,MAAM,CAKzD;AAED,+DAA+D;AAC/D,eAAO,MAAM,WAAW,wEAAyE,CAAC;AAClG,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD,8CAA8C;AAC9C,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,IAAI,SAAS,CAErD;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,wUAgBpB,CAAC"}
|