@litfamily/litopencode 1.0.31 → 1.0.32
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 +24 -0
- package/README-Ko-KR.md +6 -6
- package/README.md +6 -6
- package/dist/activation-probe.js +1 -0
- package/dist/activation-prompt-utils.d.ts +1 -1
- package/dist/activation-reentry.d.ts +20 -0
- package/dist/activation-reentry.js +110 -1
- package/dist/activation-routing.d.ts +2 -1
- package/dist/activation-routing.js +100 -11
- package/dist/activation-workflow-prompts.d.ts +4 -0
- package/dist/activation-workflow-prompts.js +30 -0
- package/dist/activation.d.ts +1 -1
- package/dist/activation.js +44 -5
- package/dist/adhd-next.d.ts +51 -0
- package/dist/adhd-next.js +150 -0
- package/dist/cli/managed-skill-assets.d.ts +1 -1
- package/dist/cli/managed-skill-assets.js +7 -1
- package/dist/cli/native-skill-integrity.js +1 -1
- package/dist/cli.js +7 -1
- package/dist/commands.d.ts +28 -1
- package/dist/commands.js +48 -1
- package/dist/features.d.ts +80 -1
- package/dist/features.js +105 -1
- package/dist/ledger.js +12 -1
- package/dist/secret-shapes.js +5 -5
- package/dist/skills.d.ts +22 -1
- package/dist/skills.js +36 -0
- package/dist/start-work-typed.d.ts +34 -0
- package/dist/start-work-typed.js +156 -0
- package/dist/state.d.ts +2 -0
- package/dist/state.js +2 -0
- package/dist/tools.js +22 -2
- package/dist/tui/mission-band.d.ts +20 -1
- package/dist/tui/mission-band.js +73 -16
- package/dist/tui/mission-looks.d.ts +38 -0
- package/dist/tui/mission-looks.js +73 -0
- package/dist/tui/mission-model.d.ts +2 -0
- package/dist/tui/mission-model.js +3 -1
- package/dist/tui/mission-rainbow.d.ts +33 -0
- package/dist/tui/mission-rainbow.js +90 -0
- package/dist/tui/mission-source.d.ts +48 -0
- package/dist/tui/mission-source.js +184 -2
- package/dist/tui/mission-text.d.ts +2 -0
- package/dist/tui/mission-text.js +9 -1
- package/dist/tui/mission-threads.d.ts +50 -0
- package/dist/tui/mission-threads.js +119 -0
- package/dist/tui.js +84 -6
- package/dist/uiux-visual-catalog.js +8 -1
- package/dist/v2/session-hooks.js +38 -5
- package/dist/workflow-stack.d.ts +53 -0
- package/dist/workflow-stack.js +196 -0
- package/docs/assets/readme/badge-version.svg +1 -1
- package/docs/assets/skills/lit-schematic.webp +0 -0
- package/docs/reference-Ko-KR.md +30 -2
- package/docs/reference.md +34 -2
- package/package.json +1 -1
- package/skills/frontend-ui-ux/SKILL.md +3 -2
- package/skills/frontend-ui-ux/kit/components.css +414 -0
- package/skills/frontend-ui-ux/kit/fonts.json +22 -0
- package/skills/frontend-ui-ux/kit/layouts/landing.html +164 -0
- package/skills/frontend-ui-ux/kit/layouts/settings.html +114 -0
- package/skills/frontend-ui-ux/kit/layouts/workspace.html +115 -0
- package/skills/frontend-ui-ux/kit/styles/computational-brutalism.json +227 -0
- package/skills/frontend-ui-ux/kit/styles/field-notes.json +205 -0
- package/skills/frontend-ui-ux/kit/styles/graphite.json +200 -0
- package/skills/frontend-ui-ux/kit/styles/meadow.json +199 -0
- package/skills/frontend-ui-ux/kit/styles/neo-brutalism.json +222 -0
- package/skills/frontend-ui-ux/kit/ui.js +226 -0
- package/skills/frontend-ui-ux/references/brand-and-imagery.md +2 -2
- package/skills/frontend-ui-ux/references/complete-contract.md +2 -1
- package/skills/frontend-ui-ux/references/craft-floor.md +6 -2
- package/skills/frontend-ui-ux/references/default-editorial-pixel.json +3 -0
- package/skills/frontend-ui-ux/references/house-styles.md +236 -0
- package/skills/frontend-ui-ux/references/motion-guide.md +2 -2
- package/skills/frontend-ui-ux/references/production.md +3 -1
- package/skills/frontend-ui-ux/references/slop-register.md +4 -4
- package/skills/frontend-ui-ux/scripts/design-lock.mjs +400 -0
- package/skills/frontend-ui-ux/scripts/pixel-art.mjs +60 -0
- package/skills/frontend-ui-ux/scripts/probe-lock.mjs +235 -0
- package/skills/frontend-ui-ux/scripts/probe-page.mjs +34 -12
- package/skills/frontend-ui-ux/scripts/probe-static.mjs +16 -3
- package/skills/frontend-ui-ux/scripts/probe-thresholds.json +8 -2
- package/skills/frontend-ui-ux/scripts/probe.mjs +35 -7
- package/skills/lit-adhd/SKILL.md +208 -0
- package/skills/lit-adhd/references/brief-format.md +43 -0
- package/skills/lit-adhd/references/card-examples.md +82 -0
- package/skills/lit-adhd/references/status-taxonomy.md +29 -0
- package/skills/lit-adhd/scripts/rewind.mjs +835 -0
- package/skills/lit-diagram-drawer/SKILL.md +4 -3
- package/skills/lit-diagram-drawer/references/style-guide.md +20 -11
- package/skills/lit-diagram-drawer/references/type-architecture.md +3 -3
- package/skills/lit-diagram-drawer/references/type-dependency.md +1 -1
- package/skills/lit-diagram-drawer/references/type-tree.md +3 -3
- package/skills/lit-diagram-drawer/references/type-wardley.md +1 -1
- package/skills/lit-diagram-drawer/references/verifier-guide.md +1 -0
- package/skills/lit-diagram-drawer/scripts/craft-thresholds.json +1 -2
- package/skills/lit-diagram-drawer/scripts/visual-quality.mjs +1 -2
- package/skills/lit-docx/SKILL.md +2 -1
- package/skills/lit-handoff/SKILL.md +2 -0
- package/skills/lit-hijack/SKILL.md +422 -0
- package/skills/lit-hijack/references/capture-and-provenance.md +87 -0
- package/skills/lit-hijack/references/clean-room-build.md +111 -0
- package/skills/lit-hijack/references/distil-and-licence.md +100 -0
- package/skills/lit-hijack/references/gap-and-port-design.md +126 -0
- package/skills/lit-hijack/references/parity-and-report.md +110 -0
- package/skills/lit-hijack/scripts/hijack.mjs +993 -0
- package/skills/lit-plan/SKILL.md +2 -0
- package/skills/lit-pptx/SKILL.md +27 -11
- package/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Bold.ttf +0 -0
- package/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Regular.ttf +0 -0
- package/skills/lit-pptx/fonts/jetbrains-mono/OFL.txt +93 -0
- package/skills/lit-pptx/fonts/jetbrains-mono/SOURCE.md +17 -0
- package/skills/lit-pptx/references/density-and-fill.md +9 -3
- package/skills/lit-pptx/references/direction-step.md +21 -6
- package/skills/lit-pptx/references/examples/04-lecture-chalk-ko.md +3 -6
- package/skills/lit-pptx/references/examples/05-research-talk-paper-en.md +1 -5
- package/skills/lit-pptx/references/examples/08-reliability-keynote-night-en.md +0 -4
- package/skills/lit-pptx/references/examples/09-status-update-ledger-en.md +2 -2
- package/skills/lit-pptx/references/examples/11-forecast-review-night-ko.md +4 -7
- package/skills/lit-pptx/references/examples/13-engineering-review-computational-brutalism-ko.md +173 -0
- package/skills/lit-pptx/references/examples/14-launch-pitch-neo-brutalism-ko.md +154 -0
- package/skills/lit-pptx/references/examples/15-design-lecture-bauhaus-ko.md +139 -0
- package/skills/lit-pptx/references/examples/16-community-programme-riso-ko.md +158 -0
- package/skills/lit-pptx/references/examples/17-public-data-briefing-newsroom-ko.md +179 -0
- package/skills/lit-pptx/references/layout-families.md +65 -47
- package/skills/lit-pptx/references/title-treatments.md +83 -134
- package/skills/lit-pptx/references/tonalities/atlas.md +3 -3
- package/skills/lit-pptx/references/tonalities/bauhaus.md +140 -0
- package/skills/lit-pptx/references/tonalities/chalk.md +7 -6
- package/skills/lit-pptx/references/tonalities/computational-brutalism.md +150 -0
- package/skills/lit-pptx/references/tonalities/gazette.md +1 -1
- package/skills/lit-pptx/references/tonalities/ledger.md +1 -1
- package/skills/lit-pptx/references/tonalities/neo-brutalism.md +161 -0
- package/skills/lit-pptx/references/tonalities/newsroom.md +144 -0
- package/skills/lit-pptx/references/tonalities/night.md +1 -1
- package/skills/lit-pptx/references/tonalities/paper.md +2 -2
- package/skills/lit-pptx/references/tonalities/riso.md +137 -0
- package/skills/lit-pptx/references/tonalities/signal.md +3 -3
- package/skills/lit-pptx/references/tonalities/studio.md +7 -6
- package/skills/lit-pptx/run.mjs +2 -1
- package/skills/lit-pptx/scripts/compile-deck.js +1 -1
- package/skills/lit-pptx/scripts/craft-thresholds.json +4 -8
- package/skills/lit-pptx/scripts/craft_extras.py +56 -3
- package/skills/lit-pptx/scripts/deck_output.py +75 -90
- package/skills/lit-pptx/scripts/embed_fonts.py +13 -1
- package/skills/lit-pptx/scripts/layout_inventory.py +12 -5
- package/skills/lit-pptx/scripts/lib/grid-resolver.js +101 -110
- package/skills/lit-pptx/scripts/lib/layout-resolver.js +9 -15
- package/skills/lit-pptx/scripts/lib/render-pack.js +373 -566
- package/skills/lit-pptx/scripts/lib/slide-grid.js +104 -0
- package/skills/lit-pptx/scripts/lib/template-registry.js +57 -6
- package/skills/lit-pptx/scripts/qa_deck.py +10 -11
- package/skills/lit-pptx/scripts/render_pages.py +118 -0
- package/skills/lit-pptx/templates/tonalities/atlas/pack.yaml +1 -1
- package/skills/lit-pptx/templates/tonalities/bauhaus/pack.yaml +98 -0
- package/skills/lit-pptx/templates/tonalities/chalk/pack.yaml +1 -1
- package/skills/lit-pptx/templates/tonalities/computational-brutalism/pack.yaml +99 -0
- package/skills/lit-pptx/templates/tonalities/gazette/pack.yaml +1 -1
- package/skills/lit-pptx/templates/tonalities/ledger/pack.yaml +1 -1
- package/skills/lit-pptx/templates/tonalities/neo-brutalism/pack.yaml +107 -0
- package/skills/lit-pptx/templates/tonalities/newsroom/pack.yaml +99 -0
- package/skills/lit-pptx/templates/tonalities/night/pack.yaml +1 -1
- package/skills/lit-pptx/templates/tonalities/paper/pack.yaml +1 -1
- package/skills/lit-pptx/templates/tonalities/riso/pack.yaml +99 -0
- package/skills/lit-pptx/templates/tonalities/signal/pack.yaml +2 -2
- package/skills/lit-pptx/templates/tonalities/studio/pack.yaml +1 -1
- package/skills/lit-recap/SKILL.md +4 -0
- package/skills/lit-schematic/SKILL.md +118 -0
- package/skills/lit-schematic/examples/iso-heat-exchanger/build.mjs +38 -0
- package/skills/lit-schematic/examples/iso-heat-exchanger/scene.mjs +133 -0
- package/skills/lit-schematic/examples/journal-adsorption-rig/build.mjs +87 -0
- package/skills/lit-schematic/examples/pid-dosing-skid/build.mjs +85 -0
- package/skills/lit-schematic/references/cutaway-outputs.md +70 -0
- package/skills/lit-schematic/references/isometric-craft.md +101 -0
- package/skills/lit-schematic/references/journal-figures.md +72 -0
- package/skills/lit-schematic/references/kit-api.md +134 -0
- package/skills/lit-schematic/references/pfd-and-layout.md +53 -0
- package/skills/lit-schematic/references/pid-drafting.md +103 -0
- package/skills/lit-schematic/references/pid-symbols.md +163 -0
- package/skills/lit-schematic/references/verification.md +100 -0
- package/skills/lit-schematic/scripts/doctor.mjs +57 -0
- package/skills/lit-schematic/scripts/lib/figure.mjs +81 -0
- package/skills/lit-schematic/scripts/lib/fonts.mjs +25 -0
- package/skills/lit-schematic/scripts/lib/geom.mjs +113 -0
- package/skills/lit-schematic/scripts/lib/interactive.mjs +292 -0
- package/skills/lit-schematic/scripts/lib/isa.mjs +115 -0
- package/skills/lit-schematic/scripts/lib/iso.mjs +719 -0
- package/skills/lit-schematic/scripts/lib/legend-sheet.mjs +162 -0
- package/skills/lit-schematic/scripts/lib/pid.mjs +937 -0
- package/skills/lit-schematic/scripts/lib/png.mjs +132 -0
- package/skills/lit-schematic/scripts/lib/qa-core.mjs +658 -0
- package/skills/lit-schematic/scripts/lib/route.mjs +218 -0
- package/skills/lit-schematic/scripts/lib/sheet.mjs +890 -0
- package/skills/lit-schematic/scripts/lib/svg.mjs +82 -0
- package/skills/lit-schematic/scripts/lib/theme.mjs +115 -0
- package/skills/lit-schematic/scripts/motion.mjs +129 -0
- package/skills/lit-schematic/scripts/qa.mjs +92 -0
- package/skills/lit-schematic/scripts/render.mjs +233 -0
- package/skills/lit-schematic/scripts/scaffold.mjs +60 -0
- package/skills/lit-scientific-visualization/SKILL.md +27 -4
- package/skills/lit-typographic-motion/SKILL.md +19 -17
- package/skills/lit-typographic-motion/THIRD_PARTY_NOTICES +9 -0
- package/skills/lit-typographic-motion/engine/accents.mjs +6 -0
- package/skills/lit-typographic-motion/engine/assets.mjs +282 -0
- package/skills/lit-typographic-motion/engine/blender/runner.py +228 -0
- package/skills/lit-typographic-motion/engine/blender.mjs +126 -0
- package/skills/lit-typographic-motion/engine/board.mjs +138 -0
- package/skills/lit-typographic-motion/engine/cover/assets.mjs +11 -8
- package/skills/lit-typographic-motion/engine/cover/capture.mjs +6 -6
- package/skills/lit-typographic-motion/engine/cover/render.mjs +20 -7
- package/skills/lit-typographic-motion/engine/cover/treatment.mjs +30 -3
- package/skills/lit-typographic-motion/engine/fill.mjs +54 -0
- package/skills/lit-typographic-motion/engine/gallery.mjs +118 -0
- package/skills/lit-typographic-motion/engine/house.mjs +42 -0
- package/skills/lit-typographic-motion/engine/look.mjs +65 -8
- package/skills/lit-typographic-motion/engine/loudness.mjs +101 -0
- package/skills/lit-typographic-motion/engine/scaffold.mjs +219 -0
- package/skills/lit-typographic-motion/engine/score.mjs +594 -0
- package/skills/lit-typographic-motion/engine/sound.mjs +9 -57
- package/skills/lit-typographic-motion/engine/stage/capture.mjs +23 -9
- package/skills/lit-typographic-motion/engine/stage/clock.js +8 -2
- package/skills/lit-typographic-motion/engine/stage/cover-init.js +12 -1
- package/skills/lit-typographic-motion/engine/stage/frame-worker.mjs +15 -7
- package/skills/lit-typographic-motion/engine/stage/gate.mjs +48 -4
- package/skills/lit-typographic-motion/engine/stage/qa-page.js +16 -5
- package/skills/lit-typographic-motion/engine/stage/qa.mjs +148 -7
- package/skills/lit-typographic-motion/engine/stage/render.mjs +69 -7
- package/skills/lit-typographic-motion/engine/stage/scan.mjs +20 -1
- package/skills/lit-typographic-motion/engine/stage/stage-kit.js +85 -4
- package/skills/lit-typographic-motion/engine/stills.mjs +1 -1
- package/skills/lit-typographic-motion/engine/styles.mjs +221 -0
- package/skills/lit-typographic-motion/engine/text.mjs +1 -1
- package/skills/lit-typographic-motion/engine/treatment.mjs +190 -6
- package/skills/lit-typographic-motion/engine/vendor/three/LICENSE +21 -0
- package/skills/lit-typographic-motion/engine/vendor/three/addons/environments/RoomEnvironment.js +144 -0
- package/skills/lit-typographic-motion/engine/vendor/three/addons/geometries/RoundedBoxGeometry.js +155 -0
- package/skills/lit-typographic-motion/engine/vendor/three/three.module.js +54571 -0
- package/skills/lit-typographic-motion/gate.mjs +18 -2
- package/skills/lit-typographic-motion/probe.mjs +13 -1
- package/skills/lit-typographic-motion/recipes/hero-3d/expected.json +64 -0
- package/skills/lit-typographic-motion/recipes/hero-3d/index.html +132 -0
- package/skills/lit-typographic-motion/recipes/orbit-loop/expected.json +2 -0
- package/skills/lit-typographic-motion/recipes/painted-light/expected.json +2 -0
- package/skills/lit-typographic-motion/recipes/weight-tide/expected.json +2 -0
- package/skills/lit-typographic-motion/references/cover.md +56 -13
- package/skills/lit-typographic-motion/references/craft-loop.md +20 -7
- package/skills/lit-typographic-motion/references/depth.md +112 -0
- package/skills/lit-typographic-motion/references/runtime.md +21 -6
- package/skills/lit-typographic-motion/references/sound.md +76 -0
- package/skills/lit-typographic-motion/references/stage.md +50 -7
- package/skills/lit-typographic-motion/references/studio.md +162 -0
- package/skills/lit-typographic-motion/references/style-bibles.md +18 -0
- package/skills/lit-typographic-motion/references/treatment.md +108 -9
- package/skills/lit-typographic-motion/render.mjs +60 -3
- package/skills/lit-typographic-motion/styles/paper.json +185 -0
- package/skills/lit-typographic-motion/styles/swiss-signal.json +188 -0
- package/skills/lit-typographic-motion/styles/terminalcore.json +182 -0
- package/skills/lit-typographic-motion/styles/tidal.json +187 -0
- package/skills/litresearch/SKILL.md +2 -0
- package/skills/managed-skill-manifest.json +517 -88
- package/skills/readme-studio/SKILL.md +1 -1
- package/skills/review-work/SKILL.md +2 -0
- package/skills/start-work/SKILL.md +8 -0
- package/skills/workflow-loop/SKILL.md +4 -0
- package/tools/check-pack-payload.mjs +4 -2
- package/tools/payload-substance-parity.json +4 -3
- package/tools/qa-cover-recipes.mjs +4 -3
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// Instrument and equipment tag grammar after ANSI/ISA-5.1 identification letters.
|
|
2
|
+
// The parser is deliberately strict about letter positions and lenient about loop numbers,
|
|
3
|
+
// because projects number loops in many ways (101, 1-101, 101A) but letters carry meaning.
|
|
4
|
+
|
|
5
|
+
export const MEASURED = Object.freeze({
|
|
6
|
+
A: "analysis", B: "burner, combustion", C: "conductivity", D: "density", E: "voltage",
|
|
7
|
+
F: "flow", G: "gauging", H: "hand", I: "current", J: "power", K: "time", L: "level",
|
|
8
|
+
M: "moisture", N: "user's choice", O: "user's choice", P: "pressure", Q: "quantity",
|
|
9
|
+
R: "radiation", S: "speed, frequency", T: "temperature", U: "multivariable", V: "vibration",
|
|
10
|
+
W: "weight, force", X: "unclassified", Y: "event, state", Z: "position",
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const VARIABLE_MODIFIER = Object.freeze({
|
|
14
|
+
D: "differential", F: "ratio", J: "scan", K: "time rate of change", M: "momentary",
|
|
15
|
+
Q: "integrate, totalize", S: "safety", X: "x-axis", Y: "y-axis", Z: "z-axis",
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const READOUT = Object.freeze({
|
|
19
|
+
A: "alarm", B: "user's choice", E: "primary element", G: "glass, gauge", I: "indicating",
|
|
20
|
+
L: "light", N: "user's choice", O: "orifice, restriction", P: "test point", R: "recording",
|
|
21
|
+
W: "well, probe", X: "unclassified",
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const OUTPUT = Object.freeze({
|
|
25
|
+
C: "controlling", K: "control station", S: "switch", T: "transmitting", U: "multifunction",
|
|
26
|
+
V: "valve, damper", Y: "compute, convert, relay", Z: "actuator, final element",
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const FUNCTION_MODIFIER = Object.freeze({ H: "high", L: "low", M: "middle" });
|
|
30
|
+
|
|
31
|
+
// Pairs whose meaning is the readable name, not the letter-by-letter reading.
|
|
32
|
+
const NAMED = Object.freeze({
|
|
33
|
+
PSV: "pressure safety valve", PSE: "rupture disk", TW: "thermowell", PG: "pressure gauge",
|
|
34
|
+
TG: "thermometer", LG: "level gauge", FG: "sight flow glass", PCV: "self-actuated pressure regulator",
|
|
35
|
+
FO: "restriction orifice", HV: "hand valve", HS: "hand switch", XV: "on-off valve",
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const TAG = /^([A-Z]{1,6})[-\s]?([0-9]{1,5}(?:[-.][0-9]{1,5})?[A-Z]?)$/u;
|
|
39
|
+
|
|
40
|
+
export function parseInstrumentTag(tag) {
|
|
41
|
+
const match = TAG.exec(String(tag ?? "").trim());
|
|
42
|
+
if (!match) return { ok: false, tag, error: "a tag is identification letters followed by a loop number, for example PIC-101" };
|
|
43
|
+
const [, letters, loop] = match;
|
|
44
|
+
const [first, ...rest] = letters;
|
|
45
|
+
if (!MEASURED[first]) return { ok: false, tag, error: `${first} is not a measured-variable letter` };
|
|
46
|
+
let index = 0;
|
|
47
|
+
let modifier = null;
|
|
48
|
+
// A second letter that is a variable modifier only counts as one when a function follows it.
|
|
49
|
+
if (rest.length > 1 && VARIABLE_MODIFIER[rest[0]]) {
|
|
50
|
+
const candidate = rest[0];
|
|
51
|
+
const followers = rest.slice(1);
|
|
52
|
+
const followersValid = followers.every((letter) => READOUT[letter] || OUTPUT[letter] || FUNCTION_MODIFIER[letter]);
|
|
53
|
+
if (followersValid && !(candidate === "S" && followers.every((letter) => FUNCTION_MODIFIER[letter]))) {
|
|
54
|
+
modifier = candidate;
|
|
55
|
+
index = 1;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const functions = rest.slice(index);
|
|
59
|
+
if (functions.length === 0) return { ok: false, tag, error: "a tag needs at least one function letter after the measured variable" };
|
|
60
|
+
const words = [];
|
|
61
|
+
let seenOutput = false;
|
|
62
|
+
for (let i = 0; i < functions.length; i++) {
|
|
63
|
+
const letter = functions[i];
|
|
64
|
+
if (FUNCTION_MODIFIER[letter]) {
|
|
65
|
+
const previous = functions[i - 1];
|
|
66
|
+
if (!previous || !(previous === "A" || previous === "S" || FUNCTION_MODIFIER[previous])) {
|
|
67
|
+
return { ok: false, tag, error: `${letter} (high/low) may only follow an alarm or switch letter` };
|
|
68
|
+
}
|
|
69
|
+
words.push(FUNCTION_MODIFIER[letter]);
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (READOUT[letter]) {
|
|
73
|
+
if (seenOutput && (letter === "I" || letter === "R")) return { ok: false, tag, error: `readout letter ${letter} must come before output letters` };
|
|
74
|
+
words.push(READOUT[letter]);
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (OUTPUT[letter]) {
|
|
78
|
+
seenOutput = true;
|
|
79
|
+
words.push(OUTPUT[letter]);
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
return { ok: false, tag, error: `${letter} is not a function letter` };
|
|
83
|
+
}
|
|
84
|
+
const repeated = functions.filter((letter, i) => !FUNCTION_MODIFIER[letter] && functions.indexOf(letter) !== i);
|
|
85
|
+
if (repeated.length) return { ok: false, tag, error: `function letter ${repeated[0]} repeats` };
|
|
86
|
+
const meaning = NAMED[letters] ?? [MEASURED[first], modifier ? VARIABLE_MODIFIER[modifier] : null, ...words].filter(Boolean).join(" ");
|
|
87
|
+
return { ok: true, tag, letters, loop, first, modifier, functions, meaning };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Equipment tags: a class prefix of one to three letters, a number, an optional train suffix.
|
|
91
|
+
const EQUIPMENT = /^([A-Z]{1,3})-?([0-9]{2,5})([A-Z]?)$/u;
|
|
92
|
+
export const EQUIPMENT_CLASS = Object.freeze({
|
|
93
|
+
B: "blower", C: "column", CV: "conveyor", D: "drum", E: "heat exchanger", F: "filter",
|
|
94
|
+
H: "heater", K: "compressor", M: "mixer, agitator", P: "pump", PK: "package unit",
|
|
95
|
+
R: "reactor", S: "separator", T: "tower", TK: "tank", V: "vessel", X: "miscellaneous",
|
|
96
|
+
GC: "gas cylinder", CH: "chiller", BR: "booster", MFC: "mass flow controller", A: "analyzer",
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
export function parseEquipmentTag(tag) {
|
|
100
|
+
const match = EQUIPMENT.exec(String(tag ?? "").trim());
|
|
101
|
+
if (!match) return { ok: false, tag, error: "an equipment tag is a class prefix and a number, for example R-101 or P-101A" };
|
|
102
|
+
return { ok: true, tag, prefix: match[1], number: match[2], train: match[3] || null, meaning: EQUIPMENT_CLASS[match[1]] ?? null };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Line numbers: nominal size, fluid code, sequence number, piping class, and an optional
|
|
106
|
+
// insulation or tracing code, joined by hyphens: 2"-P-1001-A1A, 1/4"-CH4-101-HP1, DN50-CW-205-B1-IH.
|
|
107
|
+
// Projects order the parts differently; this is the common size-first form most P&IDs use.
|
|
108
|
+
const LINE_NUMBER = /^((?:\d+(?:\s\d+\/\d+)?|\d+\/\d+)"|DN\d{1,4}|\d{1,4}mm)-([A-Z][A-Z0-9]{0,5})-(\d{2,6}[A-Z]?)-([A-Z0-9]{1,8})(?:-([A-Z]{1,4}))?$/u;
|
|
109
|
+
|
|
110
|
+
export function parseLineNumber(text) {
|
|
111
|
+
const match = LINE_NUMBER.exec(String(text ?? "").trim());
|
|
112
|
+
if (!match) return { ok: false, text, error: "a line number is size-fluid-sequence-class[-insulation], for example 2\"-P-1001-A1A" };
|
|
113
|
+
const [, size, fluid, sequence, spec, insulation = null] = match;
|
|
114
|
+
return { ok: true, text, size, fluid, sequence, spec, insulation };
|
|
115
|
+
}
|