Skip to content

Commit 29dd482

Browse files
committed
ur-lite: first commit of _mur minimum ursys for building comment system
1 parent b3d5be3 commit 29dd482

20 files changed

+4226
-0
lines changed

@build-ursys-min.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/sh
2+
3+
# build script for ur-system when the node versions are different
4+
# in the UR directories compared to root directory.
5+
# called from package.json scripts
6+
7+
# directory of this script
8+
DIR=$(cd "$(dirname "$0")"; pwd)
9+
DIR="$DIR/_mur/scripts"
10+
11+
# TERMINAL COLORS
12+
YEL=$(tput setaf 3)
13+
BLU=$(tput setaf 4)
14+
BGBLU=$(tput setab 4)$(tput setaf 7)
15+
BRI=$(tput bold)
16+
DIM=$(tput dim)
17+
RST=$(tput sgr0)
18+
19+
# print URSYS build info from git data
20+
GIT_D=$(git log -1 --format=%cd --date=format:%Y/%m/%d)
21+
GIT_B=$(git branch --show-current)
22+
printf "${DIM}building URSYS-MIN Library from branch ${RST}${GIT_B}${DIM} commit date ${RST}${GIT_D}${RST}\n"
23+
24+
# build the minimum ursys all-in-one library
25+
npx tsx $DIR/@build.mts 2>&1 | cat

_mur/common/@common.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*///////////////////////////////// ABOUT \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*\
2+
3+
URSYS-MIN (MUR) / CROSS-PLATFORM COMMON EXPORTS
4+
5+
A currated set of user-facing exports. The commented-out modules are ones
6+
that are generally used for internal operations.
7+
8+
\*\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ * /////////////////////////////////////*/
9+
10+
/// UTILITY EXPORTS ///////////////////////////////////////////////////////////
11+
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12+
/** named: TERM, CSS, ANSI, ConsoleStyler, TerminalLog */
13+
export * as PROMPTS from './util-prompts.ts';

_mur/common/declare-colors.ts

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
/*///////////////////////////////// ABOUT \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*\
2+
3+
Console colors for both browser and terminal environments
4+
5+
\*\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ * /////////////////////////////////////*/
6+
7+
/// TYPE DECLARATIONS /////////////////////////////////////////////////////////
8+
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9+
type ColorDict = { [key: string]: string };
10+
11+
/// COLORS BY NAME ////////////////////////////////////////////////////////////
12+
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13+
const COLOR_NAMES = [
14+
'Black',
15+
'White',
16+
'Red',
17+
'Orange',
18+
'Yellow',
19+
'Green',
20+
'Cyan',
21+
'Blue',
22+
'Purple',
23+
'Pink',
24+
'Gray'
25+
];
26+
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
27+
const TERM_COLORS: ColorDict = {
28+
// TOUT = TerminalLog(str); TOUT('hi')
29+
Reset: '\x1b[0m',
30+
Bright: '\x1b[1m',
31+
Dim: '\x1b[2m',
32+
Underscore: '\x1b[4m',
33+
Blink: '\x1b[5m',
34+
Reverse: '\x1b[7m',
35+
Hidden: '\x1b[8m',
36+
//
37+
Black: '\x1b[30m',
38+
White: '\x1b[37m',
39+
Red: '\x1b[31m',
40+
Orange: '\x1b[38;5;202m',
41+
Yellow: '\x1b[33m',
42+
Green: '\x1b[32m',
43+
Cyan: '\x1b[36m',
44+
Blue: '\x1b[34m',
45+
Purple: '\x1b[35m',
46+
//
47+
BgBlack: '\x1b[40m',
48+
BgGray: '\x1b[100m',
49+
BgWhite: '\x1b[47m',
50+
BgRed: '\x1b[41m',
51+
BgOrange: '\x1b[48;5;202m',
52+
BgYellow: '\x1b[43m',
53+
BgCyan: '\x1b[46m',
54+
BgGreen: '\x1b[42m',
55+
BgBlue: '\x1b[44m',
56+
BgPurple: '\x1b[45m',
57+
BgPink: '\x1b[105m',
58+
59+
// FORMATS (NODE INVERSE COLORS)
60+
TagBlack: '\x1b[30;1m',
61+
TagWhite: '\x1b[37;1m',
62+
TagRed: '\x1b[41;37m',
63+
TagOrange: '\x1b[43;37m',
64+
TagYellow: '\x1b[43;30m',
65+
TagGreen: '\x1b[42;30m',
66+
TagCyan: '\x1b[46;37m',
67+
TagBlue: '\x1b[44;37m',
68+
TagPurple: '\x1b[45;37m',
69+
TagPink: '\x1b[105;1m',
70+
TagGray: '\x1b[100;37m',
71+
TagNull: '\x1b[2;37m'
72+
};
73+
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
74+
const CSS_COMMON = 'padding:3px 5px;border-radius:2px;';
75+
const CSS_COLORS: ColorDict = {
76+
Reset: 'color:auto;background-color:auto',
77+
// COLOR FOREGROUND
78+
Black: 'color:black',
79+
White: 'color:white',
80+
Red: 'color:red',
81+
Orange: 'color:orange',
82+
Yellow: 'color:orange',
83+
Green: 'color:green',
84+
Cyan: 'color:cyan',
85+
Blue: 'color:blue',
86+
Magenta: 'color:magenta',
87+
Pink: 'color:pink',
88+
// COLOR BACKGROUND
89+
TagRed: `color:#000;background-color:#f66;${CSS_COMMON}`,
90+
TagOrange: `color:#000;background-color:#fa4;${CSS_COMMON}`,
91+
TagYellow: `color:#000;background-color:#fd4;${CSS_COMMON}`,
92+
TagGreen: `color:#000;background-color:#5c8;${CSS_COMMON}`,
93+
TagCyan: `color:#000;background-color:#2dd;${CSS_COMMON}`,
94+
TagBlue: `color:#000;background-color:#2bf;${CSS_COMMON}`,
95+
TagPurple: `color:#000;background-color:#b6f;${CSS_COMMON}`,
96+
TagPink: `color:#000;background-color:#f9f;${CSS_COMMON}`,
97+
TagGray: `color:#fff;background-color:#999;${CSS_COMMON}`,
98+
TagNull: `color:#999;border:1px solid #ddd;${CSS_COMMON}`,
99+
// COLOR BACKGROUND DARK (BROWSER ONLY)
100+
TagDkRed: `color:white;background-color:maroon;${CSS_COMMON}`,
101+
TagDkOrange: `color:white;background-color:burntorange;${CSS_COMMON}`,
102+
TagDkYellow: `color:white;background-color:brown;${CSS_COMMON}`,
103+
TagDkGreen: `color:white;background-color:forestgreen;${CSS_COMMON}`,
104+
TagDkCyan: `color:white;background-color:cerulean;${CSS_COMMON}`,
105+
TagDkBlue: `color:white;background-color:darkblue;${CSS_COMMON}`,
106+
TagDkPurple: `color:white;background-color:indigo;${CSS_COMMON}`,
107+
TagDkPink: `color:white;background-color:fuchsia;${CSS_COMMON}`
108+
};
109+
110+
/// COLORS BY MEANING /////////////////////////////////////////////////////////
111+
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
112+
const SEMANTIC_FORMAT_REFERENCE = [
113+
'Build',
114+
'Error',
115+
'Alert',
116+
'Test',
117+
// system startup and components
118+
'System',
119+
'Server',
120+
'Database',
121+
'Network',
122+
// urnet framework
123+
'UR',
124+
'URNET',
125+
'URMOD',
126+
// application
127+
'AppMain',
128+
'AppModule',
129+
'AppState',
130+
'AppCore',
131+
'DataCore',
132+
// user interface
133+
'UI',
134+
// events
135+
'Phase',
136+
'Event',
137+
'Stream'
138+
];
139+
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
140+
TERM_COLORS.TagBuild = TERM_COLORS.TagGray;
141+
TERM_COLORS.TagError = TERM_COLORS.TagRed;
142+
TERM_COLORS.TagAlert = TERM_COLORS.TagOrange;
143+
TERM_COLORS.TagTest = TERM_COLORS.TagRed;
144+
//
145+
TERM_COLORS.TagSystem = TERM_COLORS.TagGray;
146+
TERM_COLORS.TagServer = TERM_COLORS.TagGray;
147+
TERM_COLORS.TagDatabase = TERM_COLORS.TagCyan;
148+
TERM_COLORS.TagNetwork = TERM_COLORS.TagCyan;
149+
//
150+
TERM_COLORS.TagUR = TERM_COLORS.TagBlue;
151+
TERM_COLORS.TagURNET = TERM_COLORS.TagBlue;
152+
TERM_COLORS.TagURMOD = TERM_COLORS.TagBlue;
153+
//
154+
TERM_COLORS.TagAppMain = TERM_COLORS.TagGreen;
155+
TERM_COLORS.TagAppModule = TERM_COLORS.TagGreen;
156+
TERM_COLORS.TagAppState = TERM_COLORS.TagGreen;
157+
TERM_COLORS.TagAppCore = TERM_COLORS.TagGreen;
158+
TERM_COLORS.TagDataCore = TERM_COLORS.TagGreen;
159+
//
160+
TERM_COLORS.TagUI = TERM_COLORS.TagPurple;
161+
//
162+
TERM_COLORS.TagPhase = TERM_COLORS.TagPink;
163+
TERM_COLORS.TagEvent = TERM_COLORS.TagPink;
164+
TERM_COLORS.TagStream = TERM_COLORS.TagPink;
165+
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
166+
CSS_COLORS.TagDebug = `color:#fff;background-color:IndianRed;${CSS_COMMON}`;
167+
CSS_COLORS.TagWarning = `color:#fff;background:linear-gradient(
168+
-45deg,
169+
rgb(29,161,242),
170+
rgb(184,107,107),
171+
rgb(76,158,135)
172+
);${CSS_COMMON}`;
173+
CSS_COLORS.TagTest = CSS_COLORS.TagRed;
174+
//
175+
CSS_COLORS.TagSystem = CSS_COLORS.TagGray;
176+
CSS_COLORS.TagServer = CSS_COLORS.TagGray;
177+
CSS_COLORS.TagDatabase = CSS_COLORS.TagCyan;
178+
CSS_COLORS.TagNetwork = CSS_COLORS.TagCyan;
179+
//
180+
CSS_COLORS.TagUR = `color:CornflowerBlue;border:1px solid CornflowerBlue;${CSS_COMMON}`;
181+
CSS_COLORS.TagURNET = `color:#fff;background-color:MediumSlateBlue;${CSS_COMMON}`;
182+
CSS_COLORS.TagURMOD = `color:#fff;background:linear-gradient(
183+
-45deg,
184+
CornflowerBlue 0%,
185+
LightSkyBlue 25%,
186+
RoyalBlue 100%
187+
);${CSS_COMMON}`;
188+
CSS_COLORS.TagAppMain = CSS_COLORS.TagGreen;
189+
CSS_COLORS.TagAppModule = CSS_COLORS.TagGreen;
190+
CSS_COLORS.TagAppState = `color:#fff;background-color:Navy;${CSS_COMMON}`;
191+
CSS_COLORS.TagUI = CSS_COLORS.TagDkOrange;
192+
CSS_COLORS.TagEvent = CSS_COLORS.TagDkOrange;
193+
CSS_COLORS.TagStream = CSS_COLORS.TagDkOrange;
194+
CSS_COLORS.TagPhase = `color:#fff;background-color:MediumVioletRed;${CSS_COMMON}`;
195+
196+
/// CONVENENICE CONSTANTS /////////////////////////////////////////////////////
197+
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
198+
/** these are used for direct color output with console.log in node */
199+
const ANSI_COLORS = {
200+
BLU: '\x1b[34;1m',
201+
YEL: '\x1b[33;1m',
202+
RED: '\x1b[31m',
203+
//
204+
DIM: '\x1b[2m',
205+
BLD: '\x1b[1m',
206+
NRM: '\x1b[0m',
207+
BRI: '\x1b[1m',
208+
//
209+
SRV: TERM_COLORS.TagGreen
210+
};
211+
212+
/// EXPORTS ///////////////////////////////////////////////////////////////////
213+
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
214+
/// export both named and default for mts and ts interoperability
215+
export { TERM_COLORS, CSS_COLORS, ANSI_COLORS };
216+
export default { TERM_COLORS, CSS_COLORS, ANSI_COLORS };

_mur/common/tsconfig.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "../../tsconfig-base.json",
3+
"compilerOptions": {
4+
"lib": ["ESNext", "DOM"],
5+
"outDir": "../dist/common"
6+
},
7+
"include": ["./**/*.ts"]
8+
}

0 commit comments

Comments
 (0)