"carefully remembered all these things" or "joyfully thought about all these things." A treasure is something that is very valuable or precious. Mary considered the things her son did and said to be very precious. (See: [[rc://en/ta/man/translate/figs-metaphor]])