@litfamily/litgravity 0.1.1 → 0.1.3
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/CHANGELOG.md +46 -0
- package/README.md +19 -3
- package/README_ko-KR.md +19 -3
- package/TRADEMARK.md +12 -0
- package/package.json +3 -2
- package/plugin/hooks/lib/lanes.mjs +65 -0
- package/plugin/hooks/lib/liveness.mjs +81 -0
- package/plugin/hooks/lib/motion.mjs +34 -5
- package/plugin/hooks/lib/reentry.mjs +7 -0
- package/plugin/hooks/lib/rewind/brief.mjs +364 -0
- package/plugin/hooks/lib/rewind/collect.mjs +359 -0
- package/plugin/hooks/lib/rewind/gauge.mjs +55 -0
- package/plugin/hooks/lib/rewind/next-step.mjs +77 -0
- package/plugin/hooks/lib/rewind/redact.mjs +60 -0
- package/plugin/hooks/lib/rewind/transcripts.mjs +214 -0
- package/plugin/hooks/lib/routes.mjs +79 -5
- package/plugin/hooks/lib/workflow-stack.mjs +213 -0
- package/plugin/hooks/post-tool-use.mjs +39 -1
- package/plugin/hooks/pre-invocation.mjs +93 -2
- package/plugin/hooks/session-start.mjs +26 -3
- package/plugin/hooks/stop.mjs +55 -6
- package/plugin/hud/looks.mjs +29 -0
- package/plugin/hud/render.mjs +277 -12
- package/plugin/plugin.json +1 -1
- package/plugin/skills/frontend-ui-ux/SKILL.md +12 -1
- package/plugin/skills/frontend-ui-ux/kit/components.css +417 -0
- package/plugin/skills/frontend-ui-ux/kit/fonts.json +22 -0
- package/plugin/skills/frontend-ui-ux/kit/layouts/landing.html +164 -0
- package/plugin/skills/frontend-ui-ux/kit/layouts/settings.html +114 -0
- package/plugin/skills/frontend-ui-ux/kit/layouts/workspace.html +115 -0
- package/plugin/skills/frontend-ui-ux/kit/styles/computational-brutalism.json +227 -0
- package/plugin/skills/frontend-ui-ux/kit/styles/field-notes.json +205 -0
- package/plugin/skills/frontend-ui-ux/kit/styles/graphite.json +200 -0
- package/plugin/skills/frontend-ui-ux/kit/styles/meadow.json +199 -0
- package/plugin/skills/frontend-ui-ux/kit/styles/neo-brutalism.json +222 -0
- package/plugin/skills/frontend-ui-ux/kit/ui.js +226 -0
- package/plugin/skills/frontend-ui-ux/references/house-styles.md +234 -0
- package/plugin/skills/frontend-ui-ux/scripts/design-lock.mjs +400 -0
- package/plugin/skills/frontend-ui-ux/scripts/interface-probe-lock.mjs +196 -0
- package/plugin/skills/frontend-ui-ux/scripts/interface-probe-page.mjs +30 -9
- package/plugin/skills/frontend-ui-ux/scripts/interface-probe-rules.mjs +20 -8
- package/plugin/skills/frontend-ui-ux/scripts/interface-probe.mjs +42 -9
- package/plugin/skills/frontend-ui-ux/scripts/pixel-art.mjs +60 -0
- package/plugin/skills/lit-adhd/SKILL.md +160 -0
- package/plugin/skills/lit-adhd/references/card-examples.md +107 -0
- package/plugin/skills/lit-adhd/references/status-taxonomy.md +34 -0
- package/plugin/skills/lit-adhd/scripts/rewind.mjs +5 -0
- package/plugin/skills/lit-diagram-drawer/SKILL.md +5 -3
- package/plugin/skills/lit-diagram-drawer/references/drawing-rules.md +1 -1
- package/plugin/skills/lit-diagram-drawer/references/style-guide.md +21 -12
- package/plugin/skills/lit-diagram-drawer/references/type-architecture.md +3 -3
- package/plugin/skills/lit-diagram-drawer/references/type-dependency.md +1 -1
- package/plugin/skills/lit-diagram-drawer/references/type-tree.md +3 -3
- package/plugin/skills/lit-diagram-drawer/references/type-wardley.md +1 -1
- package/plugin/skills/lit-diagram-drawer/scripts/diagram-craft-rules.mjs +1 -2
- package/plugin/skills/lit-diagram-drawer/scripts/visual-quality.mjs +1 -2
- package/plugin/skills/lit-docx/SKILL.md +3 -3
- package/plugin/skills/lit-handoff/SKILL.md +1 -0
- package/plugin/skills/lit-hijack/SKILL.md +263 -0
- package/plugin/skills/lit-hijack/references/capture-and-provenance.md +100 -0
- package/plugin/skills/lit-hijack/references/clean-room-build.md +75 -0
- package/plugin/skills/lit-hijack/references/distil-and-licence.md +67 -0
- package/plugin/skills/lit-hijack/references/gap-and-port-design.md +100 -0
- package/plugin/skills/lit-hijack/references/parity-and-report.md +85 -0
- package/plugin/skills/lit-hijack/scripts/hijack.mjs +953 -0
- package/plugin/skills/lit-plan/SKILL.md +3 -2
- package/plugin/skills/lit-plan/references/plan-contract.md +12 -1
- package/plugin/skills/lit-plan/scripts/check-plan.mjs +39 -3
- package/plugin/skills/lit-plan/templates/plan.md +3 -0
- package/plugin/skills/lit-pptx/SKILL.md +8 -8
- package/plugin/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Bold.ttf +0 -0
- package/plugin/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Regular.ttf +0 -0
- package/plugin/skills/lit-pptx/fonts/jetbrains-mono/OFL.txt +93 -0
- package/plugin/skills/lit-pptx/fonts/provenance.json +32 -1
- package/plugin/skills/lit-pptx/references/agents/analyst.md +34 -56
- package/plugin/skills/lit-pptx/references/agents/antithesis.md +49 -67
- package/plugin/skills/lit-pptx/references/agents/architect.md +38 -51
- package/plugin/skills/lit-pptx/references/agents/critic.md +25 -41
- package/plugin/skills/lit-pptx/references/agents/synthesizer.md +37 -46
- package/plugin/skills/lit-pptx/references/agents/thesis.md +29 -49
- package/plugin/skills/lit-pptx/references/anti-slop-checklist.md +119 -145
- package/plugin/skills/lit-pptx/references/authoring-guide.md +187 -278
- package/plugin/skills/lit-pptx/references/consensus-protocol.md +99 -97
- package/plugin/skills/lit-pptx/references/data-display-cookbook.md +36 -137
- package/plugin/skills/lit-pptx/references/density-and-fill.md +147 -216
- package/plugin/skills/lit-pptx/references/design-system-azure.md +56 -85
- package/plugin/skills/lit-pptx/references/direction-step.md +134 -176
- package/plugin/skills/lit-pptx/references/examples/01-pitch-signal-ko.md +114 -115
- package/plugin/skills/lit-pptx/references/examples/02-pitch-studio-ko.md +66 -66
- package/plugin/skills/lit-pptx/references/examples/03-business-review-ledger-ko.md +63 -63
- package/plugin/skills/lit-pptx/references/examples/04-business-review-night-en.md +96 -96
- package/plugin/skills/lit-pptx/references/examples/05-research-talk-paper-en.md +81 -81
- package/plugin/skills/lit-pptx/references/examples/06-lecture-chalk-ko.md +103 -103
- package/plugin/skills/lit-pptx/references/examples/07-data-review-night-en.md +100 -98
- package/plugin/skills/lit-pptx/references/examples/08-image-led-atlas-ko.md +76 -76
- package/plugin/skills/lit-pptx/references/examples/09-briefing-gazette-ko.md +96 -96
- package/plugin/skills/lit-pptx/references/examples/10-status-update-ledger-ko.md +80 -80
- package/plugin/skills/lit-pptx/references/examples/11-portfolio-studio-en.md +72 -72
- package/plugin/skills/lit-pptx/references/examples/12-research-tutorial-chalk-en.md +95 -95
- package/plugin/skills/lit-pptx/references/examples/13-engineering-review-computational-brutalism-ko.md +173 -0
- package/plugin/skills/lit-pptx/references/examples/14-launch-pitch-neo-brutalism-ko.md +154 -0
- package/plugin/skills/lit-pptx/references/examples/15-design-lecture-bauhaus-ko.md +139 -0
- package/plugin/skills/lit-pptx/references/examples/16-community-programme-riso-ko.md +158 -0
- package/plugin/skills/lit-pptx/references/examples/17-public-data-briefing-newsroom-ko.md +179 -0
- package/plugin/skills/lit-pptx/references/interview-protocol.md +83 -102
- package/plugin/skills/lit-pptx/references/layout-families.md +161 -265
- package/plugin/skills/lit-pptx/references/stages/autopilot.md +30 -70
- package/plugin/skills/lit-pptx/references/stages/interview.md +36 -68
- package/plugin/skills/lit-pptx/references/stages/plan.md +26 -67
- package/plugin/skills/lit-pptx/references/title-treatments.md +93 -145
- package/plugin/skills/lit-pptx/references/tonalities/atlas.md +95 -108
- package/plugin/skills/lit-pptx/references/tonalities/bauhaus.md +140 -0
- package/plugin/skills/lit-pptx/references/tonalities/chalk.md +107 -122
- package/plugin/skills/lit-pptx/references/tonalities/computational-brutalism.md +150 -0
- package/plugin/skills/lit-pptx/references/tonalities/gazette.md +87 -111
- package/plugin/skills/lit-pptx/references/tonalities/ledger.md +96 -125
- package/plugin/skills/lit-pptx/references/tonalities/neo-brutalism.md +161 -0
- package/plugin/skills/lit-pptx/references/tonalities/newsroom.md +144 -0
- package/plugin/skills/lit-pptx/references/tonalities/night.md +104 -131
- package/plugin/skills/lit-pptx/references/tonalities/paper.md +114 -130
- package/plugin/skills/lit-pptx/references/tonalities/riso.md +137 -0
- package/plugin/skills/lit-pptx/references/tonalities/signal.md +96 -103
- package/plugin/skills/lit-pptx/references/tonalities/studio.md +81 -112
- package/plugin/skills/lit-pptx/scripts/compile-deck.js +4 -6
- package/plugin/skills/lit-pptx/scripts/craft_extras.py +135 -91
- package/plugin/skills/lit-pptx/scripts/deck_craft.py +1 -1
- package/plugin/skills/lit-pptx/scripts/embed_fonts.py +13 -1
- package/plugin/skills/lit-pptx/scripts/layout_inventory.py +1 -1
- package/plugin/skills/lit-pptx/scripts/learn_template.py +1 -1
- package/plugin/skills/lit-pptx/scripts/lib/grid-resolver.js +101 -110
- package/plugin/skills/lit-pptx/scripts/lib/layout-resolver.js +9 -15
- package/plugin/skills/lit-pptx/scripts/lib/render-pack.js +370 -563
- package/plugin/skills/lit-pptx/scripts/lib/slide-grid.js +104 -0
- package/plugin/skills/lit-pptx/scripts/lib/template-registry.js +57 -6
- package/plugin/skills/lit-pptx/scripts/qa_deck.py +6 -6
- package/plugin/skills/lit-pptx/scripts/render_pages.py +31 -0
- package/plugin/skills/lit-pptx/scripts/validate_pptx.py +1 -1
- package/plugin/skills/lit-pptx/specs/markdown-slide-spec-v1.md +167 -191
- package/plugin/skills/lit-pptx/specs/markdown-slide-spec-v2.md +117 -166
- package/plugin/skills/lit-pptx/specs/template-enrollment-contract.md +307 -330
- package/plugin/skills/lit-pptx/templates/tonalities/atlas/pack.yaml +1 -1
- package/plugin/skills/lit-pptx/templates/tonalities/bauhaus/pack.yaml +98 -0
- package/plugin/skills/lit-pptx/templates/tonalities/chalk/pack.yaml +1 -1
- package/plugin/skills/lit-pptx/templates/tonalities/computational-brutalism/pack.yaml +99 -0
- package/plugin/skills/lit-pptx/templates/tonalities/gazette/pack.yaml +1 -1
- package/plugin/skills/lit-pptx/templates/tonalities/ledger/pack.yaml +1 -1
- package/plugin/skills/lit-pptx/templates/tonalities/neo-brutalism/pack.yaml +107 -0
- package/plugin/skills/lit-pptx/templates/tonalities/newsroom/pack.yaml +99 -0
- package/plugin/skills/lit-pptx/templates/tonalities/night/pack.yaml +1 -1
- package/plugin/skills/lit-pptx/templates/tonalities/paper/pack.yaml +1 -1
- package/plugin/skills/lit-pptx/templates/tonalities/riso/pack.yaml +99 -0
- package/plugin/skills/lit-pptx/templates/tonalities/signal/pack.yaml +2 -2
- package/plugin/skills/lit-pptx/templates/tonalities/studio/pack.yaml +1 -1
- package/plugin/skills/lit-schematic/SKILL.md +114 -0
- package/plugin/skills/lit-schematic/examples/iso-heat-exchanger/build.mjs +38 -0
- package/plugin/skills/lit-schematic/examples/iso-heat-exchanger/scene.mjs +133 -0
- package/plugin/skills/lit-schematic/examples/journal-adsorption-rig/build.mjs +87 -0
- package/plugin/skills/lit-schematic/examples/pid-dosing-skid/build.mjs +85 -0
- package/plugin/skills/lit-schematic/references/cutaway-outputs.md +70 -0
- package/plugin/skills/lit-schematic/references/isometric-craft.md +101 -0
- package/plugin/skills/lit-schematic/references/journal-figures.md +72 -0
- package/plugin/skills/lit-schematic/references/kit-api.md +134 -0
- package/plugin/skills/lit-schematic/references/pfd-and-layout.md +53 -0
- package/plugin/skills/lit-schematic/references/pid-drafting.md +103 -0
- package/plugin/skills/lit-schematic/references/pid-symbols.md +163 -0
- package/plugin/skills/lit-schematic/references/verification.md +100 -0
- package/plugin/skills/lit-schematic/scripts/doctor.mjs +57 -0
- package/plugin/skills/lit-schematic/scripts/lib/figure.mjs +81 -0
- package/plugin/skills/lit-schematic/scripts/lib/fonts.mjs +27 -0
- package/plugin/skills/lit-schematic/scripts/lib/geom.mjs +113 -0
- package/plugin/skills/lit-schematic/scripts/lib/interactive.mjs +292 -0
- package/plugin/skills/lit-schematic/scripts/lib/isa.mjs +115 -0
- package/plugin/skills/lit-schematic/scripts/lib/iso.mjs +719 -0
- package/plugin/skills/lit-schematic/scripts/lib/legend-sheet.mjs +162 -0
- package/plugin/skills/lit-schematic/scripts/lib/pid.mjs +937 -0
- package/plugin/skills/lit-schematic/scripts/lib/png.mjs +132 -0
- package/plugin/skills/lit-schematic/scripts/lib/qa-core.mjs +658 -0
- package/plugin/skills/lit-schematic/scripts/lib/route.mjs +218 -0
- package/plugin/skills/lit-schematic/scripts/lib/sheet.mjs +890 -0
- package/plugin/skills/lit-schematic/scripts/lib/svg.mjs +82 -0
- package/plugin/skills/lit-schematic/scripts/lib/theme.mjs +115 -0
- package/plugin/skills/lit-schematic/scripts/motion.mjs +129 -0
- package/plugin/skills/lit-schematic/scripts/qa.mjs +92 -0
- package/plugin/skills/lit-schematic/scripts/render.mjs +233 -0
- package/plugin/skills/lit-schematic/scripts/scaffold.mjs +60 -0
- package/plugin/skills/lit-scientific-visualization/SKILL.md +17 -6
- package/plugin/skills/lit-typographic-motion/SKILL.md +58 -48
- package/plugin/skills/lit-typographic-motion/engine/THIRD_PARTY_NOTICES +13 -2
- package/plugin/skills/lit-typographic-motion/engine/blender/runner.py +218 -0
- package/plugin/skills/lit-typographic-motion/engine/core/presets.mjs +1 -1
- package/plugin/skills/lit-typographic-motion/engine/node/analysis.mjs +65 -1
- package/plugin/skills/lit-typographic-motion/engine/node/assets.mjs +298 -0
- package/plugin/skills/lit-typographic-motion/engine/node/blender.mjs +143 -0
- package/plugin/skills/lit-typographic-motion/engine/node/board.mjs +136 -0
- package/plugin/skills/lit-typographic-motion/engine/node/brief.mjs +7 -1
- package/plugin/skills/lit-typographic-motion/engine/node/chrome.mjs +9 -12
- package/plugin/skills/lit-typographic-motion/engine/node/cover-assets.mjs +5 -3
- package/plugin/skills/lit-typographic-motion/engine/node/cover-capture.mjs +7 -6
- package/plugin/skills/lit-typographic-motion/engine/node/cover-treatment.mjs +37 -4
- package/plugin/skills/lit-typographic-motion/engine/node/cover.mjs +19 -8
- package/plugin/skills/lit-typographic-motion/engine/node/done.mjs +45 -6
- package/plugin/skills/lit-typographic-motion/engine/node/frame-worker.mjs +7 -5
- package/plugin/skills/lit-typographic-motion/engine/node/gallery.mjs +121 -0
- package/plugin/skills/lit-typographic-motion/engine/node/host.mjs +34 -0
- package/plugin/skills/lit-typographic-motion/engine/node/house.mjs +44 -0
- package/plugin/skills/lit-typographic-motion/engine/node/look.mjs +34 -20
- package/plugin/skills/lit-typographic-motion/engine/node/pipeline.mjs +19 -9
- package/plugin/skills/lit-typographic-motion/engine/node/scaffold.mjs +210 -0
- package/plugin/skills/lit-typographic-motion/engine/node/score.mjs +639 -0
- package/plugin/skills/lit-typographic-motion/engine/node/sound-cli.mjs +21 -4
- package/plugin/skills/lit-typographic-motion/engine/node/sound.mjs +127 -29
- package/plugin/skills/lit-typographic-motion/engine/node/stage-capture.mjs +7 -6
- package/plugin/skills/lit-typographic-motion/engine/node/stage-gate.mjs +59 -5
- package/plugin/skills/lit-typographic-motion/engine/node/stage-qa.mjs +141 -9
- package/plugin/skills/lit-typographic-motion/engine/node/stage-serve.mjs +28 -5
- package/plugin/skills/lit-typographic-motion/engine/node/stage.mjs +82 -14
- package/plugin/skills/lit-typographic-motion/engine/node/styles.mjs +213 -0
- package/plugin/skills/lit-typographic-motion/engine/node/treatment.mjs +311 -10
- package/plugin/skills/lit-typographic-motion/engine/stage/cover-init.js +14 -2
- package/plugin/skills/lit-typographic-motion/engine/stage/init.js +11 -1
- package/plugin/skills/lit-typographic-motion/engine/stage/qa.js +6 -1
- package/plugin/skills/lit-typographic-motion/engine/stage/stage-kit.js +83 -0
- package/plugin/skills/lit-typographic-motion/engine/vendor/three/LICENSE +21 -0
- package/plugin/skills/lit-typographic-motion/engine/vendor/three/addons/environments/RoomEnvironment.js +144 -0
- package/plugin/skills/lit-typographic-motion/engine/vendor/three/addons/geometries/RoundedBoxGeometry.js +155 -0
- package/plugin/skills/lit-typographic-motion/engine/vendor/three/three.module.js +54571 -0
- package/plugin/skills/lit-typographic-motion/recipes/hero-3d/expected.json +69 -0
- package/plugin/skills/lit-typographic-motion/recipes/hero-3d/index.html +139 -0
- package/plugin/skills/lit-typographic-motion/recipes/orbit-loop/expected.json +6 -4
- package/plugin/skills/lit-typographic-motion/recipes/painted-light/expected.json +4 -2
- package/plugin/skills/lit-typographic-motion/recipes/weight-tide/expected.json +7 -5
- package/plugin/skills/lit-typographic-motion/references/cover.md +394 -443
- package/plugin/skills/lit-typographic-motion/references/craft-loop.md +57 -87
- package/plugin/skills/lit-typographic-motion/references/depth.md +122 -0
- package/plugin/skills/lit-typographic-motion/references/look.md +94 -129
- package/plugin/skills/lit-typographic-motion/references/runtime.md +58 -91
- package/plugin/skills/lit-typographic-motion/references/sound.md +130 -99
- package/plugin/skills/lit-typographic-motion/references/stage.md +190 -215
- package/plugin/skills/lit-typographic-motion/references/studio.md +245 -0
- package/plugin/skills/lit-typographic-motion/references/style-bibles.md +108 -97
- package/plugin/skills/lit-typographic-motion/references/treatment.md +191 -143
- package/plugin/skills/lit-typographic-motion/scripts/motion-doctor.mjs +17 -5
- package/plugin/skills/lit-typographic-motion/scripts/motion.mjs +47 -7
- package/plugin/skills/lit-typographic-motion/styles/paper.json +41 -0
- package/plugin/skills/lit-typographic-motion/styles/swiss-signal.json +41 -0
- package/plugin/skills/lit-typographic-motion/styles/terminalcore.json +42 -0
- package/plugin/skills/lit-typographic-motion/styles/tidal.json +41 -0
- package/plugin/skills/litresearch/SKILL.md +1 -0
- package/plugin/skills/readme-studio/SKILL.md +2 -0
- package/plugin/skills/review-work/SKILL.md +1 -1
- package/plugin/skills/start-work/SKILL.md +2 -2
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
// The "P&ID symbols and abbreviations" sheet a drawing set opens with, built from the library
|
|
2
|
+
// itself so it can never drift from what the kit draws: every line class, equipment, valve,
|
|
3
|
+
// actuator, relief device, piping item and flow element, the ISA-5.1 instrument shape and
|
|
4
|
+
// location matrix, the identification letters, fail positions, line-number format and
|
|
5
|
+
// equipment prefixes, on one sheet with the usual frame and title block.
|
|
6
|
+
|
|
7
|
+
import { EQUIPMENT_CLASS, FUNCTION_MODIFIER, MEASURED, OUTPUT, READOUT, VARIABLE_MODIFIER } from "./isa.mjs";
|
|
8
|
+
import { FAIL_POSITIONS, FUNCTIONS, LOCATIONS, describeKind } from "./pid.mjs";
|
|
9
|
+
import { LINE_KINDS, createSheet, legendGlyph, legendLine } from "./sheet.mjs";
|
|
10
|
+
import { el, esc, textWidthEm } from "./svg.mjs";
|
|
11
|
+
import { FONT_LATIN, PID } from "./theme.mjs";
|
|
12
|
+
|
|
13
|
+
const SYMBOL_GROUPS = Object.freeze([
|
|
14
|
+
["EQUIPMENT", [
|
|
15
|
+
"vessel.vertical", "vessel.horizontal", "vessel.jacketed", "vessel.reactor", "vessel.column", "vessel.tank", "gas.cylinder",
|
|
16
|
+
"pump.centrifugal", "pump.positive", "pump.metering", "compressor.centrifugal", "compressor.reciprocating",
|
|
17
|
+
"exchanger.general", "exchanger.shelltube", "exchanger.floating", "exchanger.utube", "exchanger.plate", "exchanger.aircooler",
|
|
18
|
+
"package.unit", "drive.motor",
|
|
19
|
+
]],
|
|
20
|
+
["VALVES", [
|
|
21
|
+
"valve.gate", "valve.globe", "valve.ball", "valve.butterfly", "valve.plug", "valve.needle", "valve.diaphragm",
|
|
22
|
+
"valve.check", "valve.threeway", "valve.angle",
|
|
23
|
+
]],
|
|
24
|
+
["ACTUATORS (SHOWN ON A GLOBE BODY)", [
|
|
25
|
+
"valve.globe.diaphragm", "valve.globe.piston", "valve.globe.motor", "valve.globe.solenoid", "valve.globe.hand",
|
|
26
|
+
]],
|
|
27
|
+
["SELF-ACTING AND RELIEF DEVICES", ["valve.regulator", "valve.backpressure", "valve.safety", "relief.rupture"]],
|
|
28
|
+
["PIPING ITEMS", ["line.reducer", "line.reducer-eccentric", "line.flange", "line.blind", "line.blind-open", "line.filter", "line.sightglass"]],
|
|
29
|
+
["FLOW ELEMENTS", ["flow.orifice", "flow.venturi", "flow.magnetic", "flow.coriolis", "flow.vortex", "flow.turbine", "flow.ultrasonic", "flow.thermal", "flow.rotameter", "flow.mfc"]],
|
|
30
|
+
["CONNECTIONS AND LOGIC", ["terminal.offpage", "terminal.utility", "terminal.vent", "terminal.drain", "terminal.sample", "logic.interlock"]],
|
|
31
|
+
]);
|
|
32
|
+
|
|
33
|
+
const LOCATION_HEADS = Object.freeze({ field: ["Field"], main: ["Main", "room"], "main-rear": ["Main,", "behind"], aux: ["Local", "panel"], "aux-rear": ["Local,", "behind"] });
|
|
34
|
+
const FUNCTION_HEADS = Object.freeze({ discrete: "Discrete", shared: "Shared (DCS)", computer: "Computer", plc: "PLC / SIS" });
|
|
35
|
+
|
|
36
|
+
export function createLegendSheet({
|
|
37
|
+
size = "A2", title = "P&ID symbols and abbreviations", number = "LEG-001", rev = "0", date = "", scale = "NTS",
|
|
38
|
+
project = "", owner = "", drawn = "", checked = "", approved = "", sheet = "1 OF 1",
|
|
39
|
+
} = {}) {
|
|
40
|
+
const notes = [
|
|
41
|
+
"Instrument shapes, location lines, signal lines, actuators and identification letters after ANSI/ISA-5.1-2009 (Tables 4.1, 5.1.1, 5.2.2, 5.3.1, 5.3.2, 5.4.1 to 5.4.4).",
|
|
42
|
+
"Equipment, valve and piping symbols after ISO 10628-2:2012 (Table 2 subject groups) and common US practice (PIP PIC001).",
|
|
43
|
+
"A symbol drawn on a P&ID of this set without a row on this sheet is defined in the legend column of that P&ID.",
|
|
44
|
+
];
|
|
45
|
+
const s = createSheet({ mode: "pid", size, title, number, rev, date, scale, project, owner, drawn, checked, approved, sheet, notes, legendColumn: false, headerBand: false });
|
|
46
|
+
const [x0, y0, x1, y1] = s.drawing;
|
|
47
|
+
const small = PID.text.small;
|
|
48
|
+
const head = PID.text.label;
|
|
49
|
+
const gutter = 8;
|
|
50
|
+
const columns = 5;
|
|
51
|
+
const colW = (x1 - x0 - gutter * (columns - 1)) / columns;
|
|
52
|
+
const text = (x, ty, content, sz = small, extra = {}) => el("text", { x, y: ty, "font-family": FONT_LATIN, "font-size": sz, fill: PID.ink, "data-label": "legend", ...extra }, esc(content));
|
|
53
|
+
const wrap = (content, width) => {
|
|
54
|
+
const words = content.split(/\s+/u);
|
|
55
|
+
const lines = [];
|
|
56
|
+
let line = "";
|
|
57
|
+
for (const word of words) {
|
|
58
|
+
const next = line ? `${line} ${word}` : word;
|
|
59
|
+
if (line && textWidthEm(next) * small > width) { lines.push(line); line = word; } else line = next;
|
|
60
|
+
}
|
|
61
|
+
if (line) lines.push(line);
|
|
62
|
+
return lines;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// First collect sections of rows (each row knows its height and draws at a given x and top),
|
|
66
|
+
// then lay them out in columns: a section that fits in one column is never split; a longer
|
|
67
|
+
// one continues in the next column under a "(cont.)" heading.
|
|
68
|
+
const sections = [];
|
|
69
|
+
const section = (title) => { const sec = { title, rows: [] }; sections.push(sec); return sec; };
|
|
70
|
+
const sampleRow = (sec, key, draw, label, sampleHeight = 4) => {
|
|
71
|
+
const lines = wrap(label, colW - 22);
|
|
72
|
+
const h = Math.max(7.4, sampleHeight + 2.6, lines.length * 2.6 + 2.2);
|
|
73
|
+
sec.rows.push({ h, draw: (x, top) => {
|
|
74
|
+
const cy = top + h / 2;
|
|
75
|
+
return el("g", { "data-legend-item": key }, draw(x, cy), lines.map((t, i) => text(x + 20, cy + 0.8 + (i - (lines.length - 1) / 2) * 2.6, t)));
|
|
76
|
+
} });
|
|
77
|
+
};
|
|
78
|
+
const pairRow = (sec, key, code, meaning, indent = 7) => {
|
|
79
|
+
sec.rows.push({ h: 3.3, draw: (x, top) => el("g", { "data-legend-item": key }, text(x, top + 2.6, code, small, { "font-weight": "bold" }), text(x + indent, top + 2.6, meaning)) });
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const lineSection = section("LINES");
|
|
83
|
+
for (const kind of Object.keys(LINE_KINDS).filter((k) => k !== "stream")) {
|
|
84
|
+
sampleRow(lineSection, `line:${kind}`, (x, cy) => legendLine(kind, x + 1, x + 16, cy), LINE_KINDS[kind].label, 3);
|
|
85
|
+
}
|
|
86
|
+
for (const [name, kinds] of SYMBOL_GROUPS) {
|
|
87
|
+
const sec = section(name);
|
|
88
|
+
for (const kind of kinds) {
|
|
89
|
+
const probe = legendGlyph(kind, 0, 0, { maxW: 16, maxH: 11 });
|
|
90
|
+
sampleRow(sec, kind, (x, cy) => legendGlyph(kind, x + 8.5, cy, { maxW: 16, maxH: 11 }).svg, describeKind(kind), probe.h);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// ISA-5.1 Table 5.1.1 as a matrix: function down the side, location across the top.
|
|
95
|
+
const matrix = section("INSTRUMENT SHAPE AND LOCATION");
|
|
96
|
+
const cell = Math.min(16, (colW - 24) / 5);
|
|
97
|
+
const labelW = colW - cell * 5;
|
|
98
|
+
matrix.rows.push({ h: small * 2 + 3 + Object.keys(FUNCTIONS).length * 10, draw: (gx, top) => {
|
|
99
|
+
const out = [];
|
|
100
|
+
Object.values(LOCATION_HEADS).forEach((heads, j) => {
|
|
101
|
+
heads.forEach((t, i) => out.push(text(gx + labelW + cell * j + cell / 2, top + small + i * (small + 0.6), t, small, { "text-anchor": "middle" })));
|
|
102
|
+
});
|
|
103
|
+
Object.keys(FUNCTIONS).forEach((fn, i) => {
|
|
104
|
+
const cy = top + small * 2 + 3 + i * 10 + 5;
|
|
105
|
+
out.push(text(gx, cy + 0.8, FUNCTION_HEADS[fn]));
|
|
106
|
+
Object.keys(LOCATIONS).forEach((loc, j) => {
|
|
107
|
+
const kind = `instrument.${fn}-${loc}`;
|
|
108
|
+
out.push(el("g", { "data-legend-item": kind }, legendGlyph(kind, gx + labelW + cell * j + cell / 2, cy).svg));
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
return out.join("");
|
|
112
|
+
} });
|
|
113
|
+
|
|
114
|
+
// ISA-5.1 Table 4.1, one list per letter position.
|
|
115
|
+
for (const [key, title, entries] of [
|
|
116
|
+
["letters", "FIRST LETTER: MEASURED OR INITIATING VARIABLE", MEASURED],
|
|
117
|
+
["modifier", "VARIABLE MODIFIERS (SECOND LETTER)", VARIABLE_MODIFIER],
|
|
118
|
+
["readout", "READOUT OR PASSIVE FUNCTION", READOUT],
|
|
119
|
+
["output", "OUTPUT FUNCTION", OUTPUT],
|
|
120
|
+
["function-modifier", "FUNCTION MODIFIERS", FUNCTION_MODIFIER],
|
|
121
|
+
]) {
|
|
122
|
+
const sec = section(title);
|
|
123
|
+
for (const [letter, meaning] of Object.entries(entries)) pairRow(sec, `${key}:${letter}`, letter, meaning);
|
|
124
|
+
}
|
|
125
|
+
const fail = section("FAIL POSITION OF ACTUATED VALVES");
|
|
126
|
+
for (const [code, meaning] of Object.entries(FAIL_POSITIONS)) pairRow(fail, `fail:${code}`, code, meaning, 9);
|
|
127
|
+
const lineNumber = section("LINE NUMBER");
|
|
128
|
+
pairRow(lineNumber, "line-number:example", '2"-P-1001-A1A-IH', "");
|
|
129
|
+
pairRow(lineNumber, "line-number:parts", "", "size - fluid code - sequence - piping class", 0);
|
|
130
|
+
pairRow(lineNumber, "line-number:optional", "", "- insulation or tracing code (optional)", 0);
|
|
131
|
+
const prefixes = section("EQUIPMENT TAG PREFIXES");
|
|
132
|
+
for (const [code, meaning] of Object.entries(EQUIPMENT_CLASS)) pairRow(prefixes, `equipment:${code}`, code, meaning, 9);
|
|
133
|
+
|
|
134
|
+
const out = [];
|
|
135
|
+
const headH = head + 3.4;
|
|
136
|
+
const colHeight = y1 - y0 - 4;
|
|
137
|
+
let col = 0;
|
|
138
|
+
let y = y0 + 4;
|
|
139
|
+
const left = () => x0 + col * (colW + gutter);
|
|
140
|
+
const nextColumn = () => {
|
|
141
|
+
col++;
|
|
142
|
+
y = y0 + 4;
|
|
143
|
+
if (col >= columns) throw new Error(`createLegendSheet: the symbols do not fit on ${size}; use a larger sheet`);
|
|
144
|
+
};
|
|
145
|
+
const heading = (title) => { out.push(text(left(), y + head, title, head, { "font-weight": "bold", "data-label": "legend-title" })); y += headH; };
|
|
146
|
+
for (const sec of sections) {
|
|
147
|
+
const total = headH + sec.rows.reduce((sum, r) => sum + r.h, 0);
|
|
148
|
+
const gap = y > y0 + 4 ? 4 : 0;
|
|
149
|
+
if (y + gap + total > y1 - 1 && total <= colHeight) nextColumn();
|
|
150
|
+
else if (y + gap + headH + sec.rows[0].h > y1 - 1) nextColumn();
|
|
151
|
+
else y += gap;
|
|
152
|
+
heading(sec.title);
|
|
153
|
+
for (const r of sec.rows) {
|
|
154
|
+
if (y + r.h > y1 - 1) { nextColumn(); heading(`${sec.title} (cont.)`); }
|
|
155
|
+
out.push(r.draw(left(), y));
|
|
156
|
+
y += r.h;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
s.raw(el("g", { "data-legend-sheet": "1" }, out));
|
|
161
|
+
return s.render({ desc: "Legend sheet: every symbol, line class, instrument shape and abbreviation the drawings of this set use." });
|
|
162
|
+
}
|