@cchistory/lite 0.4.5 → 0.6.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/INSTALL.md +1 -1
- package/apps/lite-cli/dist/agent-contract.d.ts +7 -5
- package/apps/lite-cli/dist/agent-contract.d.ts.map +1 -1
- package/apps/lite-cli/dist/agent-contract.js +36 -25
- package/apps/lite-cli/dist/agent-contract.js.map +1 -1
- package/apps/lite-cli/dist/bin.js +2 -2
- package/apps/lite-cli/dist/bin.js.map +1 -1
- package/apps/lite-cli/dist/index.d.ts.map +1 -1
- package/apps/lite-cli/dist/index.js +151 -66
- package/apps/lite-cli/dist/index.js.map +1 -1
- package/apps/lite-cli/dist/index.test.js +59 -89
- package/apps/lite-cli/dist/index.test.js.map +1 -1
- package/apps/lite-cli/dist/query.d.ts +4 -1
- package/apps/lite-cli/dist/query.d.ts.map +1 -1
- package/apps/lite-cli/dist/query.js +45 -29
- package/apps/lite-cli/dist/query.js.map +1 -1
- package/apps/lite-cli/dist/resource-errors.d.ts +3 -0
- package/apps/lite-cli/dist/resource-errors.d.ts.map +1 -0
- package/apps/lite-cli/dist/resource-errors.js +17 -0
- package/apps/lite-cli/dist/resource-errors.js.map +1 -0
- package/apps/lite-cli/dist/shell.d.ts +12 -2
- package/apps/lite-cli/dist/shell.d.ts.map +1 -1
- package/apps/lite-cli/dist/shell.js +129 -57
- package/apps/lite-cli/dist/shell.js.map +1 -1
- package/apps/lite-cli/dist/sql-query.test.d.ts +2 -0
- package/apps/lite-cli/dist/sql-query.test.d.ts.map +1 -0
- package/apps/lite-cli/dist/sql-query.test.js +290 -0
- package/apps/lite-cli/dist/sql-query.test.js.map +1 -0
- package/apps/lite-cli/dist/version.d.ts +1 -1
- package/apps/lite-cli/dist/version.js +1 -1
- package/apps/lite-tui/dist/bin.js +2 -2
- package/apps/lite-tui/dist/bin.js.map +1 -1
- package/apps/lite-tui/dist/index.d.ts.map +1 -1
- package/apps/lite-tui/dist/index.js +6 -2
- package/apps/lite-tui/dist/index.js.map +1 -1
- package/apps/lite-tui/dist/index.test.js +10 -8
- package/apps/lite-tui/dist/index.test.js.map +1 -1
- package/apps/lite-tui/dist/render.d.ts +1 -1
- package/apps/lite-tui/dist/version.d.ts +1 -1
- package/apps/lite-tui/dist/version.js +1 -1
- package/bin/cchistory-lite-tui.mjs +2 -2
- package/bin/cchistory-lite.mjs +2 -2
- package/docs/guide/for-agents.md +66 -46
- package/docs/guide/lite.md +53 -11
- package/docs/guide/queries/latest-sessions.sql +4 -0
- package/docs/guide/queries/latest-turns.sql +1 -0
- package/docs/guide/queries/list-sessions.sql +2 -0
- package/docs/guide/query.md +153 -0
- package/node_modules/@cchistory/canonical/dist/directory-scope.d.ts +7 -0
- package/node_modules/@cchistory/canonical/dist/directory-scope.d.ts.map +1 -1
- package/node_modules/@cchistory/canonical/dist/directory-scope.js +11 -0
- package/node_modules/@cchistory/canonical/dist/directory-scope.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/index.d.ts +5 -1
- package/node_modules/@cchistory/canonical/dist/index.d.ts.map +1 -1
- package/node_modules/@cchistory/canonical/dist/index.js +5 -1
- package/node_modules/@cchistory/canonical/dist/index.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/query.d.ts +15 -0
- package/node_modules/@cchistory/canonical/dist/query.d.ts.map +1 -0
- package/node_modules/@cchistory/canonical/dist/query.js +208 -0
- package/node_modules/@cchistory/canonical/dist/query.js.map +1 -0
- package/node_modules/@cchistory/canonical/dist/session-family.d.ts +1 -0
- package/node_modules/@cchistory/canonical/dist/session-family.d.ts.map +1 -1
- package/node_modules/@cchistory/canonical/dist/session-family.js +3 -0
- package/node_modules/@cchistory/canonical/dist/session-family.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/session-family.test.js +61 -0
- package/node_modules/@cchistory/canonical/dist/session-family.test.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/session-interpreter.d.ts +30 -0
- package/node_modules/@cchistory/canonical/dist/session-interpreter.d.ts.map +1 -0
- package/node_modules/@cchistory/canonical/dist/session-interpreter.js +713 -0
- package/node_modules/@cchistory/canonical/dist/session-interpreter.js.map +1 -0
- package/node_modules/@cchistory/canonical/dist/session-interpreter.test.d.ts +2 -0
- package/node_modules/@cchistory/canonical/dist/session-interpreter.test.d.ts.map +1 -0
- package/node_modules/@cchistory/canonical/dist/session-interpreter.test.js +56 -0
- package/node_modules/@cchistory/canonical/dist/session-interpreter.test.js.map +1 -0
- package/node_modules/@cchistory/canonical/package.json +1 -1
- package/node_modules/@cchistory/domain/dist/evidence-atoms.d.ts +7 -0
- package/node_modules/@cchistory/domain/dist/evidence-atoms.d.ts.map +1 -0
- package/node_modules/@cchistory/domain/dist/evidence-atoms.js +36 -0
- package/node_modules/@cchistory/domain/dist/evidence-atoms.js.map +1 -0
- package/node_modules/@cchistory/domain/dist/evidence-values.d.ts +26 -0
- package/node_modules/@cchistory/domain/dist/evidence-values.d.ts.map +1 -0
- package/node_modules/@cchistory/domain/dist/evidence-values.js +80 -0
- package/node_modules/@cchistory/domain/dist/evidence-values.js.map +1 -0
- package/node_modules/@cchistory/domain/dist/index.d.ts +6 -0
- package/node_modules/@cchistory/domain/dist/index.d.ts.map +1 -1
- package/node_modules/@cchistory/domain/dist/index.js +5 -0
- package/node_modules/@cchistory/domain/dist/index.js.map +1 -1
- package/node_modules/@cchistory/domain/dist/masks.d.ts +31 -0
- package/node_modules/@cchistory/domain/dist/masks.d.ts.map +1 -0
- package/node_modules/@cchistory/domain/dist/masks.js +342 -0
- package/node_modules/@cchistory/domain/dist/masks.js.map +1 -0
- package/node_modules/@cchistory/domain/dist/parsed-session.d.ts +58 -0
- package/node_modules/@cchistory/domain/dist/parsed-session.d.ts.map +1 -0
- package/node_modules/@cchistory/domain/dist/parsed-session.js +2 -0
- package/node_modules/@cchistory/domain/dist/parsed-session.js.map +1 -0
- package/node_modules/@cchistory/domain/dist/query.d.ts +67 -0
- package/node_modules/@cchistory/domain/dist/query.d.ts.map +1 -0
- package/node_modules/@cchistory/domain/dist/query.js +2 -0
- package/node_modules/@cchistory/domain/dist/query.js.map +1 -0
- package/node_modules/@cchistory/domain/dist/token-evidence.d.ts +14 -0
- package/node_modules/@cchistory/domain/dist/token-evidence.d.ts.map +1 -0
- package/node_modules/@cchistory/domain/dist/token-evidence.js +247 -0
- package/node_modules/@cchistory/domain/dist/token-evidence.js.map +1 -0
- package/node_modules/@cchistory/domain/package.json +1 -1
- package/node_modules/@cchistory/live-runtime/dist/bootstrap.d.ts +1 -1
- package/node_modules/@cchistory/live-runtime/dist/bootstrap.d.ts.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/bootstrap.js +1 -1
- package/node_modules/@cchistory/live-runtime/dist/bootstrap.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/index.d.ts +30 -9
- package/node_modules/@cchistory/live-runtime/dist/index.d.ts.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/index.js +314 -143
- package/node_modules/@cchistory/live-runtime/dist/index.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/index.test.js +177 -20
- package/node_modules/@cchistory/live-runtime/dist/index.test.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/launcher-memory.d.ts +12 -0
- package/node_modules/@cchistory/live-runtime/dist/launcher-memory.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/launcher-memory.js +44 -0
- package/node_modules/@cchistory/live-runtime/dist/launcher-memory.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/launcher-memory.test.d.ts +2 -0
- package/node_modules/@cchistory/live-runtime/dist/launcher-memory.test.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/launcher-memory.test.js +20 -0
- package/node_modules/@cchistory/live-runtime/dist/launcher-memory.test.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/live-read-recovery.test.d.ts +2 -0
- package/node_modules/@cchistory/live-runtime/dist/live-read-recovery.test.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/live-read-recovery.test.js +92 -0
- package/node_modules/@cchistory/live-runtime/dist/live-read-recovery.test.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/preparation-metadata.d.ts +16 -0
- package/node_modules/@cchistory/live-runtime/dist/preparation-metadata.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/preparation-metadata.js +55 -0
- package/node_modules/@cchistory/live-runtime/dist/preparation-metadata.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/preparation-metadata.test.d.ts +2 -0
- package/node_modules/@cchistory/live-runtime/dist/preparation-metadata.test.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/preparation-metadata.test.js +192 -0
- package/node_modules/@cchistory/live-runtime/dist/preparation-metadata.test.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/scan-guard.d.ts +22 -22
- package/node_modules/@cchistory/live-runtime/dist/scan-guard.d.ts.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/scan-guard.js +53 -47
- package/node_modules/@cchistory/live-runtime/dist/scan-guard.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/scan-guard.test.js +287 -83
- package/node_modules/@cchistory/live-runtime/dist/scan-guard.test.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/selective-query.d.ts +47 -0
- package/node_modules/@cchistory/live-runtime/dist/selective-query.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/selective-query.js +15 -0
- package/node_modules/@cchistory/live-runtime/dist/selective-query.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/selective-query.test.d.ts +2 -0
- package/node_modules/@cchistory/live-runtime/dist/selective-query.test.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/selective-query.test.js +171 -0
- package/node_modules/@cchistory/live-runtime/dist/selective-query.test.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-query.d.ts +37 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-query.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-query.js +301 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-query.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-query.test.d.ts +2 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-query.test.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-query.test.js +67 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-query.test.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-worker.d.ts +2 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-worker.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-worker.js +14 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-worker.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/system-memory.d.ts +13 -10
- package/node_modules/@cchistory/live-runtime/dist/system-memory.d.ts.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/system-memory.js +61 -34
- package/node_modules/@cchistory/live-runtime/dist/system-memory.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/system-memory.test.d.ts +2 -0
- package/node_modules/@cchistory/live-runtime/dist/system-memory.test.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/system-memory.test.js +76 -0
- package/node_modules/@cchistory/live-runtime/dist/system-memory.test.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/package.json +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/discovery.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/core/discovery.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/factories.d.ts +2 -4
- package/node_modules/@cchistory/source-adapters/dist/core/factories.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/factories.js +1 -23
- package/node_modules/@cchistory/source-adapters/dist/core/factories.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.d.ts +25 -0
- package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.js +81 -0
- package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.test.d.ts +2 -0
- package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.test.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.test.js +122 -0
- package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.test.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/git-project.d.ts +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/git-project.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/git-project.js +2 -11
- package/node_modules/@cchistory/source-adapters/dist/core/git-project.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.test.js +31 -1
- package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/parser.d.ts +4 -3
- package/node_modules/@cchistory/source-adapters/dist/core/parser.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/parser.js +32 -13
- package/node_modules/@cchistory/source-adapters/dist/core/parser.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/probe.d.ts +8 -6
- package/node_modules/@cchistory/source-adapters/dist/core/probe.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/probe.js +46 -45
- package/node_modules/@cchistory/source-adapters/dist/core/probe.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/projections.d.ts +2 -28
- package/node_modules/@cchistory/source-adapters/dist/core/projections.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/projections.js +2 -695
- package/node_modules/@cchistory/source-adapters/dist/core/projections.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/projections.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/core/projections.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.d.ts +18 -0
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.js +27 -0
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.test.d.ts +2 -0
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.test.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.test.js +76 -0
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.test.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/session-grouping.d.ts +6 -0
- package/node_modules/@cchistory/source-adapters/dist/core/session-grouping.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/session-grouping.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/session-grouping.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/session-grouping.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/session-grouping.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/source-identity.d.ts +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/source-identity.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/source-identity.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/source-identity.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/token-usage.d.ts +1 -13
- package/node_modules/@cchistory/source-adapters/dist/core/token-usage.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/token-usage.js +1 -246
- package/node_modules/@cchistory/source-adapters/dist/core/token-usage.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/tokens.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/tokens.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/type-guards.d.ts +1 -25
- package/node_modules/@cchistory/source-adapters/dist/core/type-guards.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/type-guards.js +1 -79
- package/node_modules/@cchistory/source-adapters/dist/core/type-guards.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/types.d.ts +6 -35
- package/node_modules/@cchistory/source-adapters/dist/core/types.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/vscode-state.d.ts +2 -1
- package/node_modules/@cchistory/source-adapters/dist/core/vscode-state.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/vscode-state.js +14 -10
- package/node_modules/@cchistory/source-adapters/dist/core/vscode-state.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/index.d.ts +6 -0
- package/node_modules/@cchistory/source-adapters/dist/index.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/index.js +4 -0
- package/node_modules/@cchistory/source-adapters/dist/index.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/index.test.d.ts +2 -0
- package/node_modules/@cchistory/source-adapters/dist/index.test.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/index.test.js +2 -0
- package/node_modules/@cchistory/source-adapters/dist/index.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/masks.d.ts +1 -30
- package/node_modules/@cchistory/source-adapters/dist/masks.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/masks.js +1 -341
- package/node_modules/@cchistory/source-adapters/dist/masks.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/accio.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/accio.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/amp.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/amp.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/claude.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/claude.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/codebuddy.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/codebuddy.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/codex/activity-evidence.d.ts +14 -0
- package/node_modules/@cchistory/source-adapters/dist/platforms/codex/activity-evidence.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/platforms/codex/activity-evidence.js +103 -0
- package/node_modules/@cchistory/source-adapters/dist/platforms/codex/activity-evidence.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/platforms/codex.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/codex.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/cursor/runtime.d.ts +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/cursor/runtime.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/cursor/runtime.js +5 -3
- package/node_modules/@cchistory/source-adapters/dist/platforms/cursor/runtime.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/cursor-agent.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/cursor-agent.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/cursor.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/cursor.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/factory-droid.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/factory-droid.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/gemini.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/gemini.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/grok.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/grok.js +24 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/grok.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/grok.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/grok.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/kimi.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/kimi.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/lobechat.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/lobechat.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/openclaw.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/openclaw.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/opencode.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/opencode.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.d.ts +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.js +11 -9
- package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/zcode.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/zcode.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/probe-reference.test.d.ts +8 -0
- package/node_modules/@cchistory/source-adapters/dist/probe-reference.test.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/probe-reference.test.js +7 -0
- package/node_modules/@cchistory/source-adapters/dist/probe-reference.test.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/test-helpers.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/package.json +1 -1
- package/node_modules/commander/LICENSE +22 -0
- package/node_modules/commander/Readme.md +428 -0
- package/node_modules/commander/index.js +1224 -0
- package/node_modules/commander/package.json +38 -0
- package/node_modules/commander/typings/index.d.ts +310 -0
- package/node_modules/discontinuous-range/.npmignore +28 -0
- package/node_modules/discontinuous-range/.travis.yml +4 -0
- package/node_modules/discontinuous-range/LICENSE +21 -0
- package/node_modules/discontinuous-range/README.md +23 -0
- package/node_modules/discontinuous-range/index.js +144 -0
- package/node_modules/discontinuous-range/package.json +27 -0
- package/node_modules/discontinuous-range/test/main-test.js +96 -0
- package/node_modules/moo/LICENSE +29 -0
- package/node_modules/moo/README.md +385 -0
- package/node_modules/moo/moo.js +645 -0
- package/node_modules/moo/package.json +29 -0
- package/node_modules/nearley/LICENSE.txt +21 -0
- package/node_modules/nearley/README.md +80 -0
- package/node_modules/nearley/bin/nearley-railroad.js +121 -0
- package/node_modules/nearley/bin/nearley-test.js +64 -0
- package/node_modules/nearley/bin/nearley-unparse.js +29 -0
- package/node_modules/nearley/bin/nearleyc.js +38 -0
- package/node_modules/nearley/builtin/cow.ne +2 -0
- package/node_modules/nearley/builtin/number.ne +51 -0
- package/node_modules/nearley/builtin/postprocessors.ne +36 -0
- package/node_modules/nearley/builtin/string.ne +26 -0
- package/node_modules/nearley/builtin/whitespace.ne +5 -0
- package/node_modules/nearley/lib/compile.js +307 -0
- package/node_modules/nearley/lib/generate.js +244 -0
- package/node_modules/nearley/lib/lint.js +28 -0
- package/node_modules/nearley/lib/nearley-language-bootstrapped.js +132 -0
- package/node_modules/nearley/lib/nearley-language-bootstrapped.ne +126 -0
- package/node_modules/nearley/lib/nearley.js +564 -0
- package/node_modules/nearley/lib/stream.js +18 -0
- package/node_modules/nearley/lib/unparse.js +139 -0
- package/node_modules/nearley/package.json +63 -0
- package/node_modules/pgsql-ast-parser/ast-mapper.d.ts +237 -0
- package/node_modules/pgsql-ast-parser/ast-mapper.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/ast-mapper.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/ast-mapper.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/ast-visitor.d.ts +33 -0
- package/node_modules/pgsql-ast-parser/ast-visitor.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/ast-visitor.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/ast-visitor.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/index.d.ts +11 -0
- package/node_modules/pgsql-ast-parser/index.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/index.js +6484 -0
- package/node_modules/pgsql-ast-parser/index.js.map +1 -0
- package/node_modules/pgsql-ast-parser/interfaces.d.ts +1 -0
- package/node_modules/pgsql-ast-parser/interfaces.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/keywords.d.ts +2 -0
- package/node_modules/pgsql-ast-parser/keywords.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/lexer.d.ts +15 -0
- package/node_modules/pgsql-ast-parser/lexer.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/lexer.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/lexer.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/array-lexer.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/array-lexer.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/array.ne.d.ts +29 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/array.ne.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/array.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/array.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/geometric-lexer.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/geometric-lexer.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/geometric.ne.d.ts +29 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/geometric.ne.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/geometric.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/geometric.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval-builder.d.ts +10 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval-builder.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval-iso-lexer.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval-iso-lexer.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval-iso.ne.d.ts +29 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval-iso.ne.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval-lexer.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval-lexer.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval.ne.d.ts +29 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval.ne.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/package.json +69 -0
- package/node_modules/pgsql-ast-parser/parser.d.ts +33 -0
- package/node_modules/pgsql-ast-parser/parser.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/pg-escape.d.ts +2 -0
- package/node_modules/pgsql-ast-parser/pg-escape.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/readme.md +255 -0
- package/node_modules/pgsql-ast-parser/src/ast-mapper.spec.ts +296 -0
- package/node_modules/pgsql-ast-parser/src/ast-mapper.ts +1378 -0
- package/node_modules/pgsql-ast-parser/src/ast-visitor.spec.ts +57 -0
- package/node_modules/pgsql-ast-parser/src/ast-visitor.ts +101 -0
- package/node_modules/pgsql-ast-parser/src/index.ts +10 -0
- package/node_modules/pgsql-ast-parser/src/interfaces.ts +0 -0
- package/node_modules/pgsql-ast-parser/src/keywords.ts +8 -0
- package/node_modules/pgsql-ast-parser/src/lexer.spec.ts +245 -0
- package/node_modules/pgsql-ast-parser/src/lexer.ts +267 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/array-lexer.ts +27 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/array.ne +18 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/array.spec.ts +55 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/geometric-lexer.ts +26 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/geometric.ne +88 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/geometric.spec.ts +131 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/interval-builder.ts +148 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/interval-iso-lexer.ts +17 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/interval-iso.ne +53 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/interval-lexer.ts +26 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/interval.ne +54 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/interval.spec.ts +106 -0
- package/node_modules/pgsql-ast-parser/src/parser.ts +142 -0
- package/node_modules/pgsql-ast-parser/src/pg-escape.ts +14 -0
- package/node_modules/pgsql-ast-parser/src/syntax/alter-index.ne +29 -0
- package/node_modules/pgsql-ast-parser/src/syntax/alter-index.spec.ts +35 -0
- package/node_modules/pgsql-ast-parser/src/syntax/alter-table.ne +123 -0
- package/node_modules/pgsql-ast-parser/src/syntax/alter-table.spec.ts +476 -0
- package/node_modules/pgsql-ast-parser/src/syntax/alter-type.ne +33 -0
- package/node_modules/pgsql-ast-parser/src/syntax/alter-type.spec.ts +29 -0
- package/node_modules/pgsql-ast-parser/src/syntax/ast.ts +1150 -0
- package/node_modules/pgsql-ast-parser/src/syntax/base.ne +369 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-extension.ne +17 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-extension.spec.ts +37 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-index.ne +62 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-index.spec.ts +245 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-table.ne +174 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-table.spec.ts +761 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-type.ne +40 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-type.spec.ts +32 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-view.ne +68 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-view.spec.ts +187 -0
- package/node_modules/pgsql-ast-parser/src/syntax/deallocate.ne +13 -0
- package/node_modules/pgsql-ast-parser/src/syntax/deallocate.spec.ts +19 -0
- package/node_modules/pgsql-ast-parser/src/syntax/delete.ne +36 -0
- package/node_modules/pgsql-ast-parser/src/syntax/delete.spec.ts +71 -0
- package/node_modules/pgsql-ast-parser/src/syntax/drop.ne +28 -0
- package/node_modules/pgsql-ast-parser/src/syntax/drop.spec.ts +77 -0
- package/node_modules/pgsql-ast-parser/src/syntax/edge-cases.spec.ts +41 -0
- package/node_modules/pgsql-ast-parser/src/syntax/expr.ne +350 -0
- package/node_modules/pgsql-ast-parser/src/syntax/expr.spec.ts +1638 -0
- package/node_modules/pgsql-ast-parser/src/syntax/functions.ne +114 -0
- package/node_modules/pgsql-ast-parser/src/syntax/functions.spec.ts +235 -0
- package/node_modules/pgsql-ast-parser/src/syntax/insert.ne +63 -0
- package/node_modules/pgsql-ast-parser/src/syntax/insert.spec.ts +292 -0
- package/node_modules/pgsql-ast-parser/src/syntax/main.ne +77 -0
- package/node_modules/pgsql-ast-parser/src/syntax/nearley.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/src/syntax/prepare.ne +8 -0
- package/node_modules/pgsql-ast-parser/src/syntax/prepare.spec.ts +44 -0
- package/node_modules/pgsql-ast-parser/src/syntax/refresh-materialized-view.ne +19 -0
- package/node_modules/pgsql-ast-parser/src/syntax/refresh-materialized-view.spec.ts +42 -0
- package/node_modules/pgsql-ast-parser/src/syntax/select.ne +223 -0
- package/node_modules/pgsql-ast-parser/src/syntax/select.spec.ts +1063 -0
- package/node_modules/pgsql-ast-parser/src/syntax/sequence.ne +101 -0
- package/node_modules/pgsql-ast-parser/src/syntax/sequence.spec.ts +103 -0
- package/node_modules/pgsql-ast-parser/src/syntax/simple-statements.ne +168 -0
- package/node_modules/pgsql-ast-parser/src/syntax/simple-statements.spec.ts +327 -0
- package/node_modules/pgsql-ast-parser/src/syntax/spec-utils.ts +333 -0
- package/node_modules/pgsql-ast-parser/src/syntax/union.ne +18 -0
- package/node_modules/pgsql-ast-parser/src/syntax/union.spec.ts +125 -0
- package/node_modules/pgsql-ast-parser/src/syntax/update.ne +56 -0
- package/node_modules/pgsql-ast-parser/src/syntax/update.spec.ts +87 -0
- package/node_modules/pgsql-ast-parser/src/syntax/with.ne +41 -0
- package/node_modules/pgsql-ast-parser/src/syntax/with.spec.ts +155 -0
- package/node_modules/pgsql-ast-parser/src/to-sql.spec.ts +85 -0
- package/node_modules/pgsql-ast-parser/src/to-sql.ts +1555 -0
- package/node_modules/pgsql-ast-parser/src/utils.ts +47 -0
- package/node_modules/pgsql-ast-parser/syntax/alter-index.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/alter-index.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/alter-table.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/alter-table.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/alter-type.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/alter-type.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/ast.d.ts +826 -0
- package/node_modules/pgsql-ast-parser/syntax/ast.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/create-extension.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/create-extension.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/create-index.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/create-index.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/create-table.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/create-table.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/create-type.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/create-type.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/create-view.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/create-view.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/deallocate.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/deallocate.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/delete.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/delete.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/drop.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/drop.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/edge-cases.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/edge-cases.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/expr.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/expr.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/functions.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/functions.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/insert.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/insert.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/main.ne.d.ts +29 -0
- package/node_modules/pgsql-ast-parser/syntax/main.ne.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/prepare.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/prepare.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/refresh-materialized-view.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/refresh-materialized-view.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/select.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/select.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/sequence.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/sequence.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/simple-statements.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/simple-statements.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/spec-utils.d.ts +35 -0
- package/node_modules/pgsql-ast-parser/syntax/spec-utils.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/union.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/union.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/update.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/update.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/with.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/with.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/to-sql.d.ts +7 -0
- package/node_modules/pgsql-ast-parser/to-sql.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/to-sql.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/to-sql.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/utils.d.ts +16 -0
- package/node_modules/pgsql-ast-parser/utils.d.ts.map +1 -0
- package/node_modules/railroad-diagrams/.gitattributes +22 -0
- package/node_modules/railroad-diagrams/.npmignore +163 -0
- package/node_modules/railroad-diagrams/README.md +86 -0
- package/node_modules/railroad-diagrams/css-example.py-js +183 -0
- package/node_modules/railroad-diagrams/example.html +141 -0
- package/node_modules/railroad-diagrams/generator.html +59 -0
- package/node_modules/railroad-diagrams/package.json +23 -0
- package/node_modules/railroad-diagrams/railroad-diagrams.css +23 -0
- package/node_modules/railroad-diagrams/railroad-diagrams.js +524 -0
- package/node_modules/railroad-diagrams/railroad_diagrams.py +427 -0
- package/node_modules/randexp/LICENSE +19 -0
- package/node_modules/randexp/README.md +134 -0
- package/node_modules/randexp/lib/randexp.js +245 -0
- package/node_modules/randexp/package.json +48 -0
- package/node_modules/ret/LICENSE +19 -0
- package/node_modules/ret/README.md +183 -0
- package/node_modules/ret/lib/index.js +282 -0
- package/node_modules/ret/lib/positions.js +17 -0
- package/node_modules/ret/lib/sets.js +82 -0
- package/node_modules/ret/lib/types.js +10 -0
- package/node_modules/ret/lib/util.js +111 -0
- package/node_modules/ret/package.json +35 -0
- package/package.json +22 -6
- package/schemas/cchistory-lite-agent-v1.schema.json +6 -7
- package/schemas/cchistory-lite-error-v1.schema.json +58 -8
- package/schemas/cchistory-lite-query-result-v2.schema.json +66 -11
- package/schemas/cchistory-lite-query-result-v3.schema.json +219 -0
- package/schemas/cchistory-lite-query-v3.schema.json +57 -0
- package/schemas/cchistory-lite-source-inventory-v1.schema.json +72 -0
- package/skills/using-cchistory-lite/SKILL.md +126 -55
- package/node_modules/@cchistory/live-runtime/dist/node-memory.d.ts +0 -8
- package/node_modules/@cchistory/live-runtime/dist/node-memory.d.ts.map +0 -1
- package/node_modules/@cchistory/live-runtime/dist/node-memory.js +0 -110
- package/node_modules/@cchistory/live-runtime/dist/node-memory.js.map +0 -1
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Railroad Diagrams
|
|
3
|
+
by Tab Atkins Jr. (and others)
|
|
4
|
+
http://xanthir.com
|
|
5
|
+
http://twitter.com/tabatkins
|
|
6
|
+
http://github.com/tabatkins/railroad-diagrams
|
|
7
|
+
|
|
8
|
+
This document and all associated files in the github project are licensed under CC0: http://creativecommons.org/publicdomain/zero/1.0/
|
|
9
|
+
This means you can reuse, remix, or otherwise appropriate this project for your own use WITHOUT RESTRICTION.
|
|
10
|
+
(The actual legal meaning can be found at the above link.)
|
|
11
|
+
Don't ask me for permission to use any part of this project, JUST USE IT.
|
|
12
|
+
I would appreciate attribution, but that is not required by the license.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
This file uses a module pattern to avoid leaking names into the global scope.
|
|
17
|
+
The only accidental leakage is the name "temp".
|
|
18
|
+
The exported names can be found at the bottom of this file;
|
|
19
|
+
simply change the names in the array of strings to change what they are called in your application.
|
|
20
|
+
|
|
21
|
+
As well, several configuration constants are passed into the module function at the bottom of this file.
|
|
22
|
+
At runtime, these constants can be found on the Diagram class.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
(function(options) {
|
|
26
|
+
function subclassOf(baseClass, superClass) {
|
|
27
|
+
baseClass.prototype = Object.create(superClass.prototype);
|
|
28
|
+
baseClass.prototype.$super = superClass.prototype;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function unnull(/* children */) {
|
|
32
|
+
return [].slice.call(arguments).reduce(function(sofar, x) { return sofar !== undefined ? sofar : x; });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function determineGaps(outer, inner) {
|
|
36
|
+
var diff = outer - inner;
|
|
37
|
+
switch(Diagram.INTERNAL_ALIGNMENT) {
|
|
38
|
+
case 'left': return [0, diff]; break;
|
|
39
|
+
case 'right': return [diff, 0]; break;
|
|
40
|
+
case 'center':
|
|
41
|
+
default: return [diff/2, diff/2]; break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function wrapString(value) {
|
|
46
|
+
return ((typeof value) == 'string') ? new Terminal(value) : value;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
function SVG(name, attrs, text) {
|
|
51
|
+
attrs = attrs || {};
|
|
52
|
+
text = text || '';
|
|
53
|
+
var el = document.createElementNS("http://www.w3.org/2000/svg",name);
|
|
54
|
+
for(var attr in attrs) {
|
|
55
|
+
el.setAttribute(attr, attrs[attr]);
|
|
56
|
+
}
|
|
57
|
+
el.textContent = text;
|
|
58
|
+
return el;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function FakeSVG(tagName, attrs, text){
|
|
62
|
+
if(!(this instanceof FakeSVG)) return new FakeSVG(tagName, attrs, text);
|
|
63
|
+
if(text) this.children = text;
|
|
64
|
+
else this.children = [];
|
|
65
|
+
this.tagName = tagName;
|
|
66
|
+
this.attrs = unnull(attrs, {});
|
|
67
|
+
return this;
|
|
68
|
+
};
|
|
69
|
+
FakeSVG.prototype.format = function(x, y, width) {
|
|
70
|
+
// Virtual
|
|
71
|
+
};
|
|
72
|
+
FakeSVG.prototype.addTo = function(parent) {
|
|
73
|
+
if(parent instanceof FakeSVG) {
|
|
74
|
+
parent.children.push(this);
|
|
75
|
+
return this;
|
|
76
|
+
} else {
|
|
77
|
+
var svg = this.toSVG();
|
|
78
|
+
parent.appendChild(svg);
|
|
79
|
+
return svg;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
FakeSVG.prototype.escapeString = function(string) {
|
|
83
|
+
// Escape markdown and HTML special characters
|
|
84
|
+
return string.replace(/[*_\`\[\]<&]/g, function(charString) {
|
|
85
|
+
return '&#' + charString.charCodeAt(0) + ';';
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
FakeSVG.prototype.toSVG = function() {
|
|
89
|
+
var el = SVG(this.tagName, this.attrs);
|
|
90
|
+
if(typeof this.children == 'string') {
|
|
91
|
+
el.innerHTML = FakeSVG.prototype.escapeString(this.children);
|
|
92
|
+
} else {
|
|
93
|
+
this.children.forEach(function(e) {
|
|
94
|
+
el.appendChild(e.toSVG());
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
return el;
|
|
98
|
+
};
|
|
99
|
+
FakeSVG.prototype.toString = function() {
|
|
100
|
+
var str = '<' + this.tagName;
|
|
101
|
+
var group = this.tagName == "g" || this.tagName == "svg";
|
|
102
|
+
for(var attr in this.attrs) {
|
|
103
|
+
str += ' ' + attr + '="' + (this.attrs[attr]+'').replace(/&/g, '&').replace(/"/g, '"') + '"';
|
|
104
|
+
}
|
|
105
|
+
str += '>';
|
|
106
|
+
if(group) str += "\n";
|
|
107
|
+
if(typeof this.children == 'string') {
|
|
108
|
+
str += FakeSVG.prototype.escapeString(this.children);
|
|
109
|
+
} else {
|
|
110
|
+
this.children.forEach(function(e) {
|
|
111
|
+
str += e;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
str += '</' + this.tagName + '>\n';
|
|
115
|
+
return str;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function Path(x,y) {
|
|
119
|
+
if(!(this instanceof Path)) return new Path(x,y);
|
|
120
|
+
FakeSVG.call(this, 'path');
|
|
121
|
+
this.attrs.d = "M"+x+' '+y;
|
|
122
|
+
}
|
|
123
|
+
subclassOf(Path, FakeSVG);
|
|
124
|
+
Path.prototype.m = function(x,y) {
|
|
125
|
+
this.attrs.d += 'm'+x+' '+y;
|
|
126
|
+
return this;
|
|
127
|
+
}
|
|
128
|
+
Path.prototype.h = function(val) {
|
|
129
|
+
this.attrs.d += 'h'+val;
|
|
130
|
+
return this;
|
|
131
|
+
}
|
|
132
|
+
Path.prototype.right = Path.prototype.h;
|
|
133
|
+
Path.prototype.left = function(val) { return this.h(-val); }
|
|
134
|
+
Path.prototype.v = function(val) {
|
|
135
|
+
this.attrs.d += 'v'+val;
|
|
136
|
+
return this;
|
|
137
|
+
}
|
|
138
|
+
Path.prototype.down = Path.prototype.v;
|
|
139
|
+
Path.prototype.up = function(val) { return this.v(-val); }
|
|
140
|
+
Path.prototype.arc = function(sweep){
|
|
141
|
+
var x = Diagram.ARC_RADIUS;
|
|
142
|
+
var y = Diagram.ARC_RADIUS;
|
|
143
|
+
if(sweep[0] == 'e' || sweep[1] == 'w') {
|
|
144
|
+
x *= -1;
|
|
145
|
+
}
|
|
146
|
+
if(sweep[0] == 's' || sweep[1] == 'n') {
|
|
147
|
+
y *= -1;
|
|
148
|
+
}
|
|
149
|
+
if(sweep == 'ne' || sweep == 'es' || sweep == 'sw' || sweep == 'wn') {
|
|
150
|
+
var cw = 1;
|
|
151
|
+
} else {
|
|
152
|
+
var cw = 0;
|
|
153
|
+
}
|
|
154
|
+
this.attrs.d += "a"+Diagram.ARC_RADIUS+" "+Diagram.ARC_RADIUS+" 0 0 "+cw+' '+x+' '+y;
|
|
155
|
+
return this;
|
|
156
|
+
}
|
|
157
|
+
Path.prototype.format = function() {
|
|
158
|
+
// All paths in this library start/end horizontally.
|
|
159
|
+
// The extra .5 ensures a minor overlap, so there's no seams in bad rasterizers.
|
|
160
|
+
this.attrs.d += 'h.5';
|
|
161
|
+
return this;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function Diagram(items) {
|
|
165
|
+
if(!(this instanceof Diagram)) return new Diagram([].slice.call(arguments));
|
|
166
|
+
FakeSVG.call(this, 'svg', {class: Diagram.DIAGRAM_CLASS});
|
|
167
|
+
this.items = items.map(wrapString);
|
|
168
|
+
this.items.unshift(new Start);
|
|
169
|
+
this.items.push(new End);
|
|
170
|
+
this.width = this.items.reduce(function(sofar, el) { return sofar + el.width + (el.needsSpace?20:0)}, 0)+1;
|
|
171
|
+
this.up = Math.max.apply(null, this.items.map(function (x) { return x.up; }));
|
|
172
|
+
this.down = Math.max.apply(null, this.items.map(function (x) { return x.down; }));
|
|
173
|
+
this.formatted = false;
|
|
174
|
+
}
|
|
175
|
+
subclassOf(Diagram, FakeSVG);
|
|
176
|
+
for(var option in options) {
|
|
177
|
+
Diagram[option] = options[option];
|
|
178
|
+
}
|
|
179
|
+
Diagram.prototype.format = function(paddingt, paddingr, paddingb, paddingl) {
|
|
180
|
+
paddingt = unnull(paddingt, 20);
|
|
181
|
+
paddingr = unnull(paddingr, paddingt, 20);
|
|
182
|
+
paddingb = unnull(paddingb, paddingt, 20);
|
|
183
|
+
paddingl = unnull(paddingl, paddingr, 20);
|
|
184
|
+
var x = paddingl;
|
|
185
|
+
var y = paddingt;
|
|
186
|
+
y += this.up;
|
|
187
|
+
var g = FakeSVG('g', Diagram.STROKE_ODD_PIXEL_LENGTH ? {transform:'translate(.5 .5)'} : {});
|
|
188
|
+
for(var i = 0; i < this.items.length; i++) {
|
|
189
|
+
var item = this.items[i];
|
|
190
|
+
if(item.needsSpace) {
|
|
191
|
+
Path(x,y).h(10).addTo(g);
|
|
192
|
+
x += 10;
|
|
193
|
+
}
|
|
194
|
+
item.format(x, y, item.width).addTo(g);
|
|
195
|
+
x += item.width;
|
|
196
|
+
if(item.needsSpace) {
|
|
197
|
+
Path(x,y).h(10).addTo(g);
|
|
198
|
+
x += 10;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
this.attrs.width = this.width + paddingl + paddingr;
|
|
202
|
+
this.attrs.height = this.up + this.down + paddingt + paddingb;
|
|
203
|
+
this.attrs.viewBox = "0 0 " + this.attrs.width + " " + this.attrs.height;
|
|
204
|
+
g.addTo(this);
|
|
205
|
+
this.formatted = true;
|
|
206
|
+
return this;
|
|
207
|
+
}
|
|
208
|
+
Diagram.prototype.addTo = function(parent) {
|
|
209
|
+
var scriptTag = document.getElementsByTagName('script');
|
|
210
|
+
scriptTag = scriptTag[scriptTag.length - 1];
|
|
211
|
+
var parentTag = scriptTag.parentNode;
|
|
212
|
+
parent = parent || parentTag;
|
|
213
|
+
return this.$super.addTo.call(this, parent);
|
|
214
|
+
}
|
|
215
|
+
Diagram.prototype.toSVG = function() {
|
|
216
|
+
if (!this.formatted) {
|
|
217
|
+
this.format();
|
|
218
|
+
}
|
|
219
|
+
return this.$super.toSVG.call(this);
|
|
220
|
+
}
|
|
221
|
+
Diagram.prototype.toString = function() {
|
|
222
|
+
if (!this.formatted) {
|
|
223
|
+
this.format();
|
|
224
|
+
}
|
|
225
|
+
return this.$super.toString.call(this);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function ComplexDiagram() {
|
|
229
|
+
var diagram = new Diagram([].slice.call(arguments));
|
|
230
|
+
var items = diagram.items;
|
|
231
|
+
items.shift();
|
|
232
|
+
items.pop();
|
|
233
|
+
items.unshift(new Start(false));
|
|
234
|
+
items.push(new End(false));
|
|
235
|
+
diagram.items = items;
|
|
236
|
+
return diagram;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function Sequence(items) {
|
|
240
|
+
if(!(this instanceof Sequence)) return new Sequence([].slice.call(arguments));
|
|
241
|
+
FakeSVG.call(this, 'g');
|
|
242
|
+
this.items = items.map(wrapString);
|
|
243
|
+
this.width = this.items.reduce(function(sofar, el) { return sofar + el.width + (el.needsSpace?20:0)}, 0);
|
|
244
|
+
this.up = this.items.reduce(function(sofar,el) { return Math.max(sofar, el.up)}, 0);
|
|
245
|
+
this.down = this.items.reduce(function(sofar,el) { return Math.max(sofar, el.down)}, 0);
|
|
246
|
+
}
|
|
247
|
+
subclassOf(Sequence, FakeSVG);
|
|
248
|
+
Sequence.prototype.format = function(x,y,width) {
|
|
249
|
+
// Hook up the two sides if this is narrower than its stated width.
|
|
250
|
+
var gaps = determineGaps(width, this.width);
|
|
251
|
+
Path(x,y).h(gaps[0]).addTo(this);
|
|
252
|
+
Path(x+gaps[0]+this.width,y).h(gaps[1]).addTo(this);
|
|
253
|
+
x += gaps[0];
|
|
254
|
+
|
|
255
|
+
for(var i = 0; i < this.items.length; i++) {
|
|
256
|
+
var item = this.items[i];
|
|
257
|
+
if(item.needsSpace) {
|
|
258
|
+
Path(x,y).h(10).addTo(this);
|
|
259
|
+
x += 10;
|
|
260
|
+
}
|
|
261
|
+
item.format(x, y, item.width).addTo(this);
|
|
262
|
+
x += item.width;
|
|
263
|
+
if(item.needsSpace) {
|
|
264
|
+
Path(x,y).h(10).addTo(this);
|
|
265
|
+
x += 10;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return this;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
function Choice(normal, items) {
|
|
272
|
+
if(!(this instanceof Choice)) return new Choice(normal, [].slice.call(arguments,1));
|
|
273
|
+
FakeSVG.call(this, 'g');
|
|
274
|
+
if( typeof normal !== "number" || normal !== Math.floor(normal) ) {
|
|
275
|
+
throw new TypeError("The first argument of Choice() must be an integer.");
|
|
276
|
+
} else if(normal < 0 || normal >= items.length) {
|
|
277
|
+
throw new RangeError("The first argument of Choice() must be an index for one of the items.");
|
|
278
|
+
} else {
|
|
279
|
+
this.normal = normal;
|
|
280
|
+
}
|
|
281
|
+
this.items = items.map(wrapString);
|
|
282
|
+
this.width = this.items.reduce(function(sofar, el){return Math.max(sofar, el.width)},0) + Diagram.ARC_RADIUS*4;
|
|
283
|
+
this.up = this.down = 0;
|
|
284
|
+
for(var i = 0; i < this.items.length; i++) {
|
|
285
|
+
var item = this.items[i];
|
|
286
|
+
if(i < normal) { this.up += Math.max(Diagram.ARC_RADIUS,item.up + item.down + Diagram.VERTICAL_SEPARATION); }
|
|
287
|
+
if(i == normal) { this.up += Math.max(Diagram.ARC_RADIUS, item.up); this.down += Math.max(Diagram.ARC_RADIUS, item.down); }
|
|
288
|
+
if(i > normal) { this.down += Math.max(Diagram.ARC_RADIUS,Diagram.VERTICAL_SEPARATION + item.up + item.down); }
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
subclassOf(Choice, FakeSVG);
|
|
292
|
+
Choice.prototype.format = function(x,y,width) {
|
|
293
|
+
// Hook up the two sides if this is narrower than its stated width.
|
|
294
|
+
var gaps = determineGaps(width, this.width);
|
|
295
|
+
Path(x,y).h(gaps[0]).addTo(this);
|
|
296
|
+
Path(x+gaps[0]+this.width,y).h(gaps[1]).addTo(this);
|
|
297
|
+
x += gaps[0];
|
|
298
|
+
|
|
299
|
+
var last = this.items.length -1;
|
|
300
|
+
var innerWidth = this.width - Diagram.ARC_RADIUS*4;
|
|
301
|
+
|
|
302
|
+
// Do the elements that curve above
|
|
303
|
+
for(var i = this.normal - 1; i >= 0; i--) {
|
|
304
|
+
var item = this.items[i];
|
|
305
|
+
if( i == this.normal - 1 ) {
|
|
306
|
+
var distanceFromY = Math.max(Diagram.ARC_RADIUS*2, this.items[i+1].up + Diagram.VERTICAL_SEPARATION + item.down);
|
|
307
|
+
}
|
|
308
|
+
Path(x,y).arc('se').up(distanceFromY - Diagram.ARC_RADIUS*2).arc('wn').addTo(this);
|
|
309
|
+
item.format(x+Diagram.ARC_RADIUS*2,y - distanceFromY,innerWidth).addTo(this);
|
|
310
|
+
Path(x+Diagram.ARC_RADIUS*2+innerWidth, y-distanceFromY).arc('ne').down(distanceFromY - Diagram.ARC_RADIUS*2).arc('ws').addTo(this);
|
|
311
|
+
distanceFromY += Math.max(Diagram.ARC_RADIUS, item.up + Diagram.VERTICAL_SEPARATION + (i == 0 ? 0 : this.items[i-1].down));
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// Do the straight-line path.
|
|
315
|
+
Path(x,y).right(Diagram.ARC_RADIUS*2).addTo(this);
|
|
316
|
+
this.items[this.normal].format(x+Diagram.ARC_RADIUS*2, y, innerWidth).addTo(this);
|
|
317
|
+
Path(x+Diagram.ARC_RADIUS*2+innerWidth, y).right(Diagram.ARC_RADIUS*2).addTo(this);
|
|
318
|
+
|
|
319
|
+
// Do the elements that curve below
|
|
320
|
+
for(var i = this.normal+1; i <= last; i++) {
|
|
321
|
+
var item = this.items[i];
|
|
322
|
+
if( i == this.normal + 1 ) {
|
|
323
|
+
var distanceFromY = Math.max(Diagram.ARC_RADIUS*2, this.items[i-1].down + Diagram.VERTICAL_SEPARATION + item.up);
|
|
324
|
+
}
|
|
325
|
+
Path(x,y).arc('ne').down(distanceFromY - Diagram.ARC_RADIUS*2).arc('ws').addTo(this);
|
|
326
|
+
item.format(x+Diagram.ARC_RADIUS*2, y+distanceFromY, innerWidth).addTo(this);
|
|
327
|
+
Path(x+Diagram.ARC_RADIUS*2+innerWidth, y+distanceFromY).arc('se').up(distanceFromY - Diagram.ARC_RADIUS*2).arc('wn').addTo(this);
|
|
328
|
+
distanceFromY += Math.max(Diagram.ARC_RADIUS, item.down + Diagram.VERTICAL_SEPARATION + (i == last ? 0 : this.items[i+1].up));
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
return this;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
function Optional(item, skip) {
|
|
335
|
+
if( skip === undefined )
|
|
336
|
+
return Choice(1, Skip(), item);
|
|
337
|
+
else if ( skip === "skip" )
|
|
338
|
+
return Choice(0, Skip(), item);
|
|
339
|
+
else
|
|
340
|
+
throw "Unknown value for Optional()'s 'skip' argument.";
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
function OneOrMore(item, rep) {
|
|
344
|
+
if(!(this instanceof OneOrMore)) return new OneOrMore(item, rep);
|
|
345
|
+
FakeSVG.call(this, 'g');
|
|
346
|
+
rep = rep || (new Skip);
|
|
347
|
+
this.item = wrapString(item);
|
|
348
|
+
this.rep = wrapString(rep);
|
|
349
|
+
this.width = Math.max(this.item.width, this.rep.width) + Diagram.ARC_RADIUS*2;
|
|
350
|
+
this.up = this.item.up;
|
|
351
|
+
this.down = Math.max(Diagram.ARC_RADIUS*2, this.item.down + Diagram.VERTICAL_SEPARATION + this.rep.up + this.rep.down);
|
|
352
|
+
}
|
|
353
|
+
subclassOf(OneOrMore, FakeSVG);
|
|
354
|
+
OneOrMore.prototype.needsSpace = true;
|
|
355
|
+
OneOrMore.prototype.format = function(x,y,width) {
|
|
356
|
+
// Hook up the two sides if this is narrower than its stated width.
|
|
357
|
+
var gaps = determineGaps(width, this.width);
|
|
358
|
+
Path(x,y).h(gaps[0]).addTo(this);
|
|
359
|
+
Path(x+gaps[0]+this.width,y).h(gaps[1]).addTo(this);
|
|
360
|
+
x += gaps[0];
|
|
361
|
+
|
|
362
|
+
// Draw item
|
|
363
|
+
Path(x,y).right(Diagram.ARC_RADIUS).addTo(this);
|
|
364
|
+
this.item.format(x+Diagram.ARC_RADIUS,y,this.width-Diagram.ARC_RADIUS*2).addTo(this);
|
|
365
|
+
Path(x+this.width-Diagram.ARC_RADIUS,y).right(Diagram.ARC_RADIUS).addTo(this);
|
|
366
|
+
|
|
367
|
+
// Draw repeat arc
|
|
368
|
+
var distanceFromY = Math.max(Diagram.ARC_RADIUS*2, this.item.down+Diagram.VERTICAL_SEPARATION+this.rep.up);
|
|
369
|
+
Path(x+Diagram.ARC_RADIUS,y).arc('nw').down(distanceFromY-Diagram.ARC_RADIUS*2).arc('ws').addTo(this);
|
|
370
|
+
this.rep.format(x+Diagram.ARC_RADIUS, y+distanceFromY, this.width - Diagram.ARC_RADIUS*2).addTo(this);
|
|
371
|
+
Path(x+this.width-Diagram.ARC_RADIUS, y+distanceFromY).arc('se').up(distanceFromY-Diagram.ARC_RADIUS*2).arc('en').addTo(this);
|
|
372
|
+
|
|
373
|
+
return this;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
function ZeroOrMore(item, rep, skip) {
|
|
377
|
+
return Optional(OneOrMore(item, rep), skip);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
function Start(simpleType) {
|
|
381
|
+
if(!(this instanceof Start)) return new Start();
|
|
382
|
+
FakeSVG.call(this, 'path');
|
|
383
|
+
this.width = 20;
|
|
384
|
+
this.up = 10;
|
|
385
|
+
this.down = 10;
|
|
386
|
+
this.simpleType = simpleType;
|
|
387
|
+
}
|
|
388
|
+
subclassOf(Start, FakeSVG);
|
|
389
|
+
Start.prototype.format = function(x,y) {
|
|
390
|
+
if (this.simpleType === false) {
|
|
391
|
+
this.attrs.d = 'M '+x+' '+(y-10)+' v 20 m 0 -10 h 20.5';
|
|
392
|
+
} else {
|
|
393
|
+
this.attrs.d = 'M '+x+' '+(y-10)+' v 20 m 10 -20 v 20 m -10 -10 h 20.5';
|
|
394
|
+
}
|
|
395
|
+
return this;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
function End(simpleType) {
|
|
399
|
+
if(!(this instanceof End)) return new End();
|
|
400
|
+
FakeSVG.call(this, 'path');
|
|
401
|
+
this.width = 20;
|
|
402
|
+
this.up = 10;
|
|
403
|
+
this.down = 10;
|
|
404
|
+
this.simpleType = simpleType;
|
|
405
|
+
}
|
|
406
|
+
subclassOf(End, FakeSVG);
|
|
407
|
+
End.prototype.format = function(x,y) {
|
|
408
|
+
if (this.simpleType === false) {
|
|
409
|
+
this.attrs.d = 'M '+x+' '+y+' h 20 m 0 -10 v 20';
|
|
410
|
+
} else {
|
|
411
|
+
this.attrs.d = 'M '+x+' '+y+' h 20 m -10 -10 v 20 m 10 -20 v 20';
|
|
412
|
+
}
|
|
413
|
+
return this;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
function Terminal(text) {
|
|
417
|
+
if(!(this instanceof Terminal)) return new Terminal(text);
|
|
418
|
+
FakeSVG.call(this, 'g');
|
|
419
|
+
this.text = text;
|
|
420
|
+
this.width = text.length * 8 + 20; /* Assume that each char is .5em, and that the em is 16px */
|
|
421
|
+
this.up = 11;
|
|
422
|
+
this.down = 11;
|
|
423
|
+
}
|
|
424
|
+
subclassOf(Terminal, FakeSVG);
|
|
425
|
+
Terminal.prototype.needsSpace = true;
|
|
426
|
+
Terminal.prototype.format = function(x, y, width) {
|
|
427
|
+
// Hook up the two sides if this is narrower than its stated width.
|
|
428
|
+
var gaps = determineGaps(width, this.width);
|
|
429
|
+
Path(x,y).h(gaps[0]).addTo(this);
|
|
430
|
+
Path(x+gaps[0]+this.width,y).h(gaps[1]).addTo(this);
|
|
431
|
+
x += gaps[0];
|
|
432
|
+
|
|
433
|
+
FakeSVG('rect', {x:x, y:y-11, width:this.width, height:this.up+this.down, rx:10, ry:10}).addTo(this);
|
|
434
|
+
FakeSVG('text', {x:x+this.width/2, y:y+4}, this.text).addTo(this);
|
|
435
|
+
return this;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
function NonTerminal(text) {
|
|
439
|
+
if(!(this instanceof NonTerminal)) return new NonTerminal(text);
|
|
440
|
+
FakeSVG.call(this, 'g');
|
|
441
|
+
this.text = text;
|
|
442
|
+
this.width = text.length * 8 + 20;
|
|
443
|
+
this.up = 11;
|
|
444
|
+
this.down = 11;
|
|
445
|
+
}
|
|
446
|
+
subclassOf(NonTerminal, FakeSVG);
|
|
447
|
+
NonTerminal.prototype.needsSpace = true;
|
|
448
|
+
NonTerminal.prototype.format = function(x, y, width) {
|
|
449
|
+
// Hook up the two sides if this is narrower than its stated width.
|
|
450
|
+
var gaps = determineGaps(width, this.width);
|
|
451
|
+
Path(x,y).h(gaps[0]).addTo(this);
|
|
452
|
+
Path(x+gaps[0]+this.width,y).h(gaps[1]).addTo(this);
|
|
453
|
+
x += gaps[0];
|
|
454
|
+
|
|
455
|
+
FakeSVG('rect', {x:x, y:y-11, width:this.width, height:this.up+this.down}).addTo(this);
|
|
456
|
+
FakeSVG('text', {x:x+this.width/2, y:y+4}, this.text).addTo(this);
|
|
457
|
+
return this;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
function Comment(text) {
|
|
461
|
+
if(!(this instanceof Comment)) return new Comment(text);
|
|
462
|
+
FakeSVG.call(this, 'g');
|
|
463
|
+
this.text = text;
|
|
464
|
+
this.width = text.length * 7 + 10;
|
|
465
|
+
this.up = 11;
|
|
466
|
+
this.down = 11;
|
|
467
|
+
}
|
|
468
|
+
subclassOf(Comment, FakeSVG);
|
|
469
|
+
Comment.prototype.needsSpace = true;
|
|
470
|
+
Comment.prototype.format = function(x, y, width) {
|
|
471
|
+
// Hook up the two sides if this is narrower than its stated width.
|
|
472
|
+
var gaps = determineGaps(width, this.width);
|
|
473
|
+
Path(x,y).h(gaps[0]).addTo(this);
|
|
474
|
+
Path(x+gaps[0]+this.width,y).h(gaps[1]).addTo(this);
|
|
475
|
+
x += gaps[0];
|
|
476
|
+
|
|
477
|
+
FakeSVG('text', {x:x+this.width/2, y:y+5, class:'comment'}, this.text).addTo(this);
|
|
478
|
+
return this;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
function Skip() {
|
|
482
|
+
if(!(this instanceof Skip)) return new Skip();
|
|
483
|
+
FakeSVG.call(this, 'g');
|
|
484
|
+
this.width = 0;
|
|
485
|
+
this.up = 0;
|
|
486
|
+
this.down = 0;
|
|
487
|
+
}
|
|
488
|
+
subclassOf(Skip, FakeSVG);
|
|
489
|
+
Skip.prototype.format = function(x, y, width) {
|
|
490
|
+
Path(x,y).right(width).addTo(this);
|
|
491
|
+
return this;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
var root;
|
|
495
|
+
if (typeof define === 'function' && define.amd) {
|
|
496
|
+
// AMD. Register as an anonymous module.
|
|
497
|
+
root = {};
|
|
498
|
+
define([], function() {
|
|
499
|
+
return root;
|
|
500
|
+
});
|
|
501
|
+
} else if (typeof exports === 'object') {
|
|
502
|
+
// CommonJS for node
|
|
503
|
+
root = exports;
|
|
504
|
+
} else {
|
|
505
|
+
// Browser globals (root is window)
|
|
506
|
+
root = this;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
var temp = [Diagram, ComplexDiagram, Sequence, Choice, Optional, OneOrMore, ZeroOrMore, Terminal, NonTerminal, Comment, Skip];
|
|
510
|
+
/*
|
|
511
|
+
These are the names that the internal classes are exported as.
|
|
512
|
+
If you would like different names, adjust them here.
|
|
513
|
+
*/
|
|
514
|
+
['Diagram', 'ComplexDiagram', 'Sequence', 'Choice', 'Optional', 'OneOrMore', 'ZeroOrMore', 'Terminal', 'NonTerminal', 'Comment', 'Skip']
|
|
515
|
+
.forEach(function(e,i) { root[e] = temp[i]; });
|
|
516
|
+
}).call(this,
|
|
517
|
+
{
|
|
518
|
+
VERTICAL_SEPARATION: 8,
|
|
519
|
+
ARC_RADIUS: 10,
|
|
520
|
+
DIAGRAM_CLASS: 'railroad-diagram',
|
|
521
|
+
STROKE_ODD_PIXEL_LENGTH: true,
|
|
522
|
+
INTERNAL_ALIGNMENT: 'center',
|
|
523
|
+
}
|
|
524
|
+
);
|