@glissandoo/lib 1.16.3 → 1.16.5

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.
@@ -0,0 +1,78 @@
1
+ import { InstrumentId } from "../instruments";
2
+ export declare const SectionId: {
3
+ All: "all";
4
+ Accordion: InstrumentId.Accordion;
5
+ Bandurria: InstrumentId.Bandurria;
6
+ Bagpipes: InstrumentId.Bagpipes;
7
+ Banjo: InstrumentId.Banjo;
8
+ Baritone: InstrumentId.Baritone;
9
+ Bass: InstrumentId.Bass;
10
+ BassChoir: InstrumentId.BassChoir;
11
+ BassDrum: InstrumentId.BassDrum;
12
+ Bassoon: InstrumentId.Bassoon;
13
+ BassoonContra: InstrumentId.BassoonContra;
14
+ Cajon: InstrumentId.Cajon;
15
+ Castanets: InstrumentId.Castanets;
16
+ Cello: InstrumentId.Cello;
17
+ Choir: InstrumentId.Choir;
18
+ Clarinet: InstrumentId.Clarinet;
19
+ ClarinetAlto: InstrumentId.ClarinetAlto;
20
+ ClarinetBass: InstrumentId.ClarinetBass;
21
+ ClarinetContrabass: InstrumentId.ClarinetContrabass;
22
+ ClarinetLittle: InstrumentId.ClarinetLittle;
23
+ ContraAlto: InstrumentId.ContraAlto;
24
+ Cornet: InstrumentId.Cornet;
25
+ CounterTenor: InstrumentId.CounterTenor;
26
+ Cymbals: InstrumentId.Cymbals;
27
+ DJ: InstrumentId.DJ;
28
+ DoubleBass: InstrumentId.DoubleBass;
29
+ DrumSet: InstrumentId.DrumSet;
30
+ Dulzaina: InstrumentId.Dulzaina;
31
+ DulzainaFa: InstrumentId.DulzainaFa;
32
+ ElectricGuitar: InstrumentId.ElectricGuitar;
33
+ EnglishHorn: InstrumentId.EnglishHorn;
34
+ Euphonium: InstrumentId.Euphonium;
35
+ FlugeHorn: InstrumentId.FlugeHorn;
36
+ Flute: InstrumentId.Flute;
37
+ FluteLow: InstrumentId.FluteLow;
38
+ FrenchHorn: InstrumentId.FrenchHorn;
39
+ Guitar: InstrumentId.Guitar;
40
+ Harmonica: InstrumentId.Harmonica;
41
+ Harp: InstrumentId.Harp;
42
+ Keyboard: InstrumentId.Keyboard;
43
+ Lute: InstrumentId.Lute;
44
+ Mallets: InstrumentId.Mallets;
45
+ Mandoline: InstrumentId.Mandoline;
46
+ MezzoSoprano: InstrumentId.MezzoSoprano;
47
+ MusicConductor: InstrumentId.MusicConductor;
48
+ Oboe: InstrumentId.Oboe;
49
+ Percussion: InstrumentId.Percussion;
50
+ Piano: InstrumentId.Piano;
51
+ Piccolo: InstrumentId.Piccolo;
52
+ SaxAlto: InstrumentId.SaxAlto;
53
+ SaxBaritone: InstrumentId.SaxBaritone;
54
+ SaxLow: InstrumentId.SaxLow;
55
+ SaxSoprano: InstrumentId.SaxSoprano;
56
+ SaxTenor: InstrumentId.SaxTenor;
57
+ Silbote: InstrumentId.Silbote;
58
+ Singer: InstrumentId.Singer;
59
+ SnareDrum: InstrumentId.SnareDrum;
60
+ Soprano: InstrumentId.Soprano;
61
+ Tabal: InstrumentId.Tabal;
62
+ Tarota: InstrumentId.Tarota;
63
+ Tenor: InstrumentId.Tenor;
64
+ Timpani: InstrumentId.Timpani;
65
+ Trombone: InstrumentId.Trombone;
66
+ TromboneHigh: InstrumentId.TromboneHigh;
67
+ TromboneLow: InstrumentId.TromboneLow;
68
+ Trumpet: InstrumentId.Trumpet;
69
+ TrumpetLow: InstrumentId.TrumpetLow;
70
+ TrumpetPiccolo: InstrumentId.TrumpetPiccolo;
71
+ Tuba: InstrumentId.Tuba;
72
+ TubaWagnerian: InstrumentId.TubaWagnerian;
73
+ Txistu: InstrumentId.Txistu;
74
+ Ukelele: InstrumentId.Ukelele;
75
+ Viola: InstrumentId.Viola;
76
+ Violin: InstrumentId.Violin;
77
+ };
78
+ export declare type SectionIdType = typeof SectionId[keyof typeof SectionId];
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SectionId = void 0;
4
+ const instruments_1 = require("../instruments");
5
+ exports.SectionId = {
6
+ ...instruments_1.InstrumentId,
7
+ All: "all",
8
+ };
@@ -4,5 +4,5 @@ export default class Section {
4
4
  id: SectionIdType;
5
5
  private lang;
6
6
  constructor(id: SectionIdType, lang?: LanguagesTypes);
7
- get name(): any;
7
+ get name(): string;
8
8
  }
@@ -20,8 +20,8 @@ export default class GroupRepertory extends Theme<GroupRepertoryData> {
20
20
  get fileList(): (import("./types").GroupRepertoireFile & {
21
21
  id: string;
22
22
  })[];
23
- get filesPath(): Record<FileSectionId, import("./types").GroupRepertoireFilePathItem>;
24
- get filesPathList(): (import("./types").GroupRepertoireFilePathItem & {
23
+ get filesPath(): Record<FileSectionId, import("./types").GroupRepertoireFilePathItem[]>;
24
+ get filesPathList(): (import("./types").GroupRepertoireFilePathItem[] & {
25
25
  id: string;
26
26
  })[];
27
27
  get sections(): FileSectionId[];
@@ -68,7 +68,7 @@ export interface GroupRepertoryData extends ThemeBasicData {
68
68
  /** @deprecated */
69
69
  identifyAt: Timestamp | null;
70
70
  files: Record<string, GroupRepertoireFile>;
71
- filesPath: Record<FileSectionId, GroupRepertoireFilePathItem>;
71
+ filesPath: Record<FileSectionId, GroupRepertoireFilePathItem[]>;
72
72
  votes: Record<string, number>;
73
73
  thumbnailURL: string | null;
74
74
  editedAt: Timestamp | null;
@@ -0,0 +1,8 @@
1
+ import { SectionIdType } from '../../helpers/sections';
2
+ import { LanguagesTypes } from '../../lang';
3
+ export default class Section {
4
+ id: SectionIdType;
5
+ private lang;
6
+ constructor(id: SectionIdType, lang?: LanguagesTypes);
7
+ get name(): string;
8
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const lang_1 = require("../../lang");
4
+ class Section {
5
+ constructor(id, lang = lang_1.defaultLocale) {
6
+ this.id = id;
7
+ this.lang = lang;
8
+ }
9
+ get name() {
10
+ const translation = lang_1.getTranslation(this.id === 'all' ? `sections.all` : `instruments.${this.id}`, this.lang);
11
+ return translation || this.id;
12
+ }
13
+ }
14
+ exports.default = Section;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissandoo/lib",
3
- "version": "1.16.3",
3
+ "version": "1.16.5",
4
4
  "description": "Glissandoo library js",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -1,28 +0,0 @@
1
- import { GroupRepertoireFile, GroupRepertoireSectionId as SectionId } from './types';
2
- export default class ThemeFile {
3
- id: string;
4
- private data;
5
- constructor(id: string, data: GroupRepertoireFile);
6
- get path(): string;
7
- get filetype(): string;
8
- get isAudio(): boolean;
9
- get isPdf(): boolean;
10
- get uploadedAt(): number;
11
- get pageCount(): number | null;
12
- get isEncrypted(): boolean;
13
- get isFileByPages(): boolean;
14
- get sections(): Partial<Record<import("../../../helpers/fileSections").SectionIdType, import("./types").GroupRepertoireFileSections>>;
15
- get sectionIds(): import("../../../helpers/fileSections").SectionIdType[];
16
- get sectionsList(): {
17
- id: SectionId;
18
- tagsByFile: string[];
19
- tagsByPages: Record<string, number[]>;
20
- }[];
21
- get sectionListByTags(): {
22
- id: SectionId;
23
- tag: string;
24
- pages: number[] | null;
25
- }[];
26
- get identifyAt(): number | null;
27
- protected isAllTag(tags?: string[]): boolean;
28
- }
@@ -1,99 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const utils_1 = require("../../../helpers/utils");
4
- const types_1 = require("../types");
5
- class ThemeFile {
6
- constructor(id, data) {
7
- this.id = id;
8
- this.data = data;
9
- }
10
- get path() {
11
- return this.data.path;
12
- }
13
- get filetype() {
14
- return this.data.filetype;
15
- }
16
- get isAudio() {
17
- return this.filetype.includes('audio');
18
- }
19
- get isPdf() {
20
- return this.filetype === 'application/pdf';
21
- }
22
- get uploadedAt() {
23
- return this.data.uploadedAt;
24
- }
25
- get pageCount() {
26
- return this.data.pageCount || null;
27
- }
28
- get isEncrypted() {
29
- return this.data.isEncrypted;
30
- }
31
- get isFileByPages() {
32
- return this.isPdf && !this.isEncrypted;
33
- }
34
- get sections() {
35
- return this.data.sections || {};
36
- }
37
- get sectionIds() {
38
- return Object.keys(this.sections);
39
- }
40
- get sectionsList() {
41
- const list = utils_1.objToArray(this.sections);
42
- return list.map((section) => this.isFileByPages
43
- ? {
44
- id: section.id,
45
- tagsByFile: [],
46
- tagsByPages: Object.entries(section.pages || {}).reduce((acc, [page, { tags }]) => ({
47
- ...acc,
48
- ...(this.isAllTag(tags)
49
- ? {
50
- [types_1.GroupRepertoireTagReserved.All]: [
51
- ...(acc[types_1.GroupRepertoireTagReserved.All] || []),
52
- Number(page),
53
- ],
54
- }
55
- : tags.reduce((accTags, tag) => ({
56
- ...accTags,
57
- [tag]: [...(acc[tag] || []), Number(page)],
58
- }), {})),
59
- }), {}),
60
- }
61
- : {
62
- id: section.id,
63
- tagsByFile: this.isAllTag(section.tags)
64
- ? [types_1.GroupRepertoireTagReserved.All]
65
- : section.tags || [],
66
- tagsByPages: {},
67
- });
68
- }
69
- get sectionListByTags() {
70
- const list = this.sectionsList;
71
- return list.reduce((acc, section) => {
72
- const tagItems = this.isFileByPages
73
- ? Object.entries(section.tagsByPages).reduce((accTags, [tag, pages]) => {
74
- return [...accTags, { id: section.id, tag, pages }];
75
- }, [])
76
- : section.tagsByFile.map((tag) => ({ id: section.id, tag, pages: null }));
77
- return [...acc, ...tagItems];
78
- }, []);
79
- }
80
- // get sectionListByTags() {
81
- // const list = this.sectionsList;
82
- // return list;
83
- // return list.reduce((acc, section) => {
84
- // const tagItems = this.isFileByPages
85
- // ? Object.entries(section.tagsByPages).reduce((accTags, [tag, pages]) => {
86
- // return [...accTags, { id: section.id, tag, pages }];
87
- // }, [])
88
- // : section.tagsByFile.map((tag) => ({ id: section.id, tag, pages: null }));
89
- // return [...acc, ...tagItems];
90
- // }, []);
91
- // }
92
- get identifyAt() {
93
- return this.data.identifyAt || null;
94
- }
95
- isAllTag(tags = []) {
96
- return tags.length === 0 || tags.includes(types_1.GroupRepertoireTagReserved.All);
97
- }
98
- }
99
- exports.default = ThemeFile;