@ratiosolver/coco 0.0.92 → 0.1.1

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.
Files changed (69) hide show
  1. package/dist/coco.d.ts +122 -0
  2. package/dist/coco.js +180 -0
  3. package/dist/coco.js.map +1 -0
  4. package/dist/components/app.d.ts +3 -0
  5. package/dist/components/app.js +48 -0
  6. package/dist/components/app.js.map +1 -0
  7. package/dist/components/class.d.ts +5 -0
  8. package/dist/components/class.js +80 -0
  9. package/dist/components/class.js.map +1 -0
  10. package/dist/components/object.d.ts +5 -0
  11. package/dist/components/object.js +91 -0
  12. package/dist/components/object.js.map +1 -0
  13. package/dist/components/offcanvas.d.ts +3 -0
  14. package/dist/components/offcanvas.js +16 -0
  15. package/dist/components/offcanvas.js.map +1 -0
  16. package/dist/components/rule.d.ts +4 -0
  17. package/dist/components/rule.js +22 -0
  18. package/dist/components/rule.js.map +1 -0
  19. package/dist/favicon.ico +0 -0
  20. package/dist/index.css +1 -0
  21. package/dist/index.d.ts +7 -14
  22. package/dist/index.js +7 -27
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.umd.cjs +1 -0
  25. package/dist/tsconfig.tsbuildinfo +1 -1
  26. package/package.json +29 -20
  27. package/README.md +0 -3
  28. package/dist/coco/coco.d.ts +0 -303
  29. package/dist/coco/coco.js +0 -564
  30. package/dist/coco/coco.js.map +0 -1
  31. package/dist/coco/components/chart.d.ts +0 -31
  32. package/dist/coco/components/chart.js +0 -301
  33. package/dist/coco/components/chart.js.map +0 -1
  34. package/dist/coco/components/item.d.ts +0 -17
  35. package/dist/coco/components/item.js +0 -72
  36. package/dist/coco/components/item.js.map +0 -1
  37. package/dist/coco/components/item_chart.d.ts +0 -16
  38. package/dist/coco/components/item_chart.js +0 -92
  39. package/dist/coco/components/item_chart.js.map +0 -1
  40. package/dist/coco/components/item_properties.d.ts +0 -12
  41. package/dist/coco/components/item_properties.js +0 -65
  42. package/dist/coco/components/item_properties.js.map +0 -1
  43. package/dist/coco/components/item_publisher.d.ts +0 -16
  44. package/dist/coco/components/item_publisher.js +0 -159
  45. package/dist/coco/components/item_publisher.js.map +0 -1
  46. package/dist/coco/components/item_types.d.ts +0 -13
  47. package/dist/coco/components/item_types.js +0 -48
  48. package/dist/coco/components/item_types.js.map +0 -1
  49. package/dist/coco/components/items_table.d.ts +0 -17
  50. package/dist/coco/components/items_table.js +0 -98
  51. package/dist/coco/components/items_table.js.map +0 -1
  52. package/dist/coco/components/map.d.ts +0 -200
  53. package/dist/coco/components/map.js +0 -483
  54. package/dist/coco/components/map.js.map +0 -1
  55. package/dist/coco/components/offcanvas.d.ts +0 -6
  56. package/dist/coco/components/offcanvas.js +0 -42
  57. package/dist/coco/components/offcanvas.js.map +0 -1
  58. package/dist/coco/components/publisher.d.ts +0 -22
  59. package/dist/coco/components/publisher.js +0 -339
  60. package/dist/coco/components/publisher.js.map +0 -1
  61. package/dist/coco/components/taxonomy.d.ts +0 -25
  62. package/dist/coco/components/taxonomy.js +0 -184
  63. package/dist/coco/components/taxonomy.js.map +0 -1
  64. package/dist/coco/components/type.d.ts +0 -32
  65. package/dist/coco/components/type.js +0 -151
  66. package/dist/coco/components/type.js.map +0 -1
  67. package/dist/coco/rules.d.ts +0 -30
  68. package/dist/coco/rules.js +0 -36
  69. package/dist/coco/rules.js.map +0 -1
@@ -1,16 +0,0 @@
1
- import { PayloadComponent } from "@ratiosolver/flick";
2
- import { coco } from "../coco";
3
- export declare class ItemPublisher extends PayloadComponent<HTMLDivElement, coco.taxonomy.Item> implements coco.taxonomy.ItemListener {
4
- private readonly val;
5
- private readonly v_sel_all_check;
6
- private readonly v_checks;
7
- private readonly v_values;
8
- constructor(item: coco.taxonomy.Item);
9
- unmounting(): void;
10
- types_updated(_: coco.taxonomy.Item): void;
11
- properties_updated(_: coco.taxonomy.Item): void;
12
- values_updated(_: coco.taxonomy.Item): void;
13
- new_value(_i: coco.taxonomy.Item, _v: coco.taxonomy.Datum): void;
14
- slots_updated(_: coco.taxonomy.Item): void;
15
- private set_value;
16
- }
@@ -1,159 +0,0 @@
1
- import { blink, PayloadComponent } from "@ratiosolver/flick";
2
- import { coco } from "../coco";
3
- import { publisher } from "./publisher";
4
- export class ItemPublisher extends PayloadComponent {
5
- constructor(item) {
6
- super(document.createElement('div'), item);
7
- this.val = {};
8
- this.v_checks = new Map();
9
- this.v_values = new Map();
10
- const v_table = document.createElement('table');
11
- v_table.createCaption().textContent = 'Values';
12
- v_table.classList.add('table', 'caption-top');
13
- const v_thead = v_table.createTHead();
14
- const v_hrow = v_thead.insertRow();
15
- const v_name = document.createElement('th');
16
- v_name.scope = 'col';
17
- v_name.textContent = 'Name';
18
- v_name.classList.add('w-75');
19
- v_hrow.appendChild(v_name);
20
- const v_sel_all = document.createElement('th');
21
- v_sel_all.scope = 'col';
22
- v_sel_all.classList.add('w-auto', 'text-center'); // Auto width and centered content
23
- this.v_sel_all_check = document.createElement('input');
24
- this.v_sel_all_check.classList.add('form-check-input');
25
- this.v_sel_all_check.type = 'checkbox';
26
- this.v_sel_all_check.addEventListener('change', () => {
27
- const val = this.payload.get_datum();
28
- for (const [name, check] of this.v_checks) {
29
- check.checked = this.v_sel_all_check.checked;
30
- if (!this.v_sel_all_check.checked && val && val.data[name])
31
- this.v_values.get(name).set_value(val.data[name]);
32
- }
33
- });
34
- v_sel_all.appendChild(this.v_sel_all_check);
35
- v_hrow.appendChild(v_sel_all);
36
- const v_val = document.createElement('th');
37
- v_val.scope = 'col';
38
- v_val.textContent = 'Value';
39
- v_val.classList.add('w-25');
40
- v_hrow.appendChild(v_val);
41
- const v_body = v_table.createTBody();
42
- for (const [name, prop] of coco.taxonomy.get_dynamic_properties(item)) {
43
- const row = v_body.insertRow();
44
- const v_name = document.createElement('th');
45
- v_name.scope = 'col';
46
- v_name.textContent = name;
47
- row.appendChild(v_name);
48
- const v_sel = document.createElement('td');
49
- v_sel.classList.add('text-center');
50
- const v_sel_check = document.createElement('input');
51
- v_sel_check.classList.add('form-check-input');
52
- v_sel_check.type = 'checkbox';
53
- v_sel_check.addEventListener('change', () => {
54
- if (this.v_checks.values().every(check => check.checked)) {
55
- this.v_sel_all_check.indeterminate = false;
56
- this.v_sel_all_check.checked = true;
57
- }
58
- else if (this.v_checks.values().every(check => !check.checked)) {
59
- this.v_sel_all_check.indeterminate = false;
60
- this.v_sel_all_check.checked = false;
61
- const val = this.payload.get_datum();
62
- if (val && val.data[name])
63
- this.v_values.get(name).set_value(val.data[name]);
64
- }
65
- else
66
- this.v_sel_all_check.indeterminate = true;
67
- });
68
- v_sel_check.classList.add('property-checkbox');
69
- this.v_checks.set(name, v_sel_check);
70
- v_sel.appendChild(v_sel_check);
71
- row.appendChild(v_sel);
72
- const v_value = document.createElement('td');
73
- const pub = publisher.PublisherManager.get_instance().get_publisher_generator(prop.get_type().get_name()).make_publisher(name, prop, this.val);
74
- this.v_values.set(name, pub);
75
- v_value.append(pub.get_element());
76
- row.appendChild(v_value);
77
- }
78
- this.node.append(v_table);
79
- this.set_value();
80
- const b_div = document.createElement('div');
81
- b_div.classList.add('d-flex', 'justify-content-end', 'gap-2');
82
- const fake_button = document.createElement('button');
83
- fake_button.classList.add('btn', 'btn-secondary');
84
- fake_button.textContent = 'Fake';
85
- fake_button.addEventListener('click', () => {
86
- if (!this.v_sel_all_check.checked) {
87
- const pars = [];
88
- for (const [name, check] of this.v_checks)
89
- if (check.checked)
90
- pars.push(name);
91
- for (const tp of item.get_types())
92
- coco.CoCo.get_instance().fake_data(tp, pars).then(fake => {
93
- const els = [];
94
- for (const [name, v] of Object.entries(fake)) {
95
- const v_val = this.v_values.get(name);
96
- els.push(v_val.get_element().children[0]);
97
- v_val.set_value(v);
98
- }
99
- blink(els);
100
- });
101
- }
102
- else
103
- for (const tp of item.get_types())
104
- coco.CoCo.get_instance().fake_data(tp).then(fake => {
105
- const els = [];
106
- for (const [name, v] of Object.entries(fake)) {
107
- const v_val = this.v_values.get(name);
108
- els.push(v_val.get_element().children[0]);
109
- v_val.set_value(v);
110
- }
111
- blink(els);
112
- });
113
- });
114
- b_div.append(fake_button);
115
- const publish_button = document.createElement('button');
116
- publish_button.classList.add('btn', 'btn-primary');
117
- publish_button.textContent = 'Publish';
118
- publish_button.addEventListener('click', () => {
119
- const val = {};
120
- for (const [name, v] of Object.entries(this.val))
121
- if (this.v_checks.get(name).checked)
122
- val[name] = v;
123
- coco.CoCo.get_instance().publish(item, val);
124
- });
125
- b_div.append(publish_button);
126
- this.node.append(b_div);
127
- item.add_item_listener(this);
128
- }
129
- unmounting() { this.payload.remove_item_listener(this); }
130
- types_updated(_) { }
131
- properties_updated(_) { }
132
- values_updated(_) { }
133
- new_value(_i, _v) { this.set_value(); }
134
- slots_updated(_) { }
135
- set_value() {
136
- const props = coco.taxonomy.get_dynamic_properties(this.payload);
137
- if (props.size > 0) {
138
- this.node.hidden = false;
139
- const val = this.payload.get_datum();
140
- if (val) {
141
- const els = [];
142
- for (const [name, v] of Object.entries(val.data)) {
143
- if (!props.has(name)) {
144
- console.warn(`Value "${name}" is not a dynamic property of item's types.`);
145
- continue;
146
- }
147
- const v_val = this.v_values.get(name);
148
- els.push(v_val.get_element().children[0]);
149
- if (!this.v_checks.get(name).checked)
150
- v_val.set_value(v);
151
- }
152
- blink(els);
153
- }
154
- }
155
- else
156
- this.node.hidden = true;
157
- }
158
- }
159
- //# sourceMappingURL=item_publisher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item_publisher.js","sourceRoot":"","sources":["../../../src/coco/components/item_publisher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,OAAO,aAAc,SAAQ,gBAAoD;IAOrF,YAAY,IAAwB;QAClC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,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I,CAAC,MAAM,GAAG,IAAI,CAAC;IAC5B,CAAC;CACF"}
@@ -1,13 +0,0 @@
1
- import { PayloadComponent } from "@ratiosolver/flick";
2
- import { coco } from "../coco";
3
- export declare class ItemTypes extends PayloadComponent<HTMLDivElement, coco.taxonomy.Item> implements coco.taxonomy.ItemListener {
4
- private readonly types;
5
- private readonly types_row;
6
- constructor(item: coco.taxonomy.Item);
7
- types_updated(_: coco.taxonomy.Item): void;
8
- properties_updated(_: coco.taxonomy.Item): void;
9
- values_updated(_: coco.taxonomy.Item): void;
10
- new_value(_i: coco.taxonomy.Item, _v: coco.taxonomy.Datum): void;
11
- slots_updated(_: coco.taxonomy.Item): void;
12
- private add_type;
13
- }
@@ -1,48 +0,0 @@
1
- import { App, blink, PayloadComponent } from "@ratiosolver/flick";
2
- import { coco } from "../coco";
3
- import { Type } from "./type";
4
- export class ItemTypes extends PayloadComponent {
5
- constructor(item) {
6
- super(document.createElement('div'), item);
7
- this.types = new Map();
8
- this.node.classList.add('d-flex', 'flex-column');
9
- this.node.style.marginTop = '1em';
10
- const types_label = document.createElement('span');
11
- types_label.textContent = 'Types:';
12
- this.node.appendChild(types_label);
13
- this.types_row = document.createElement('div');
14
- this.types_row.classList.add('d-flex', 'align-items-center');
15
- this.node.appendChild(this.types_row);
16
- const item_types = item.get_types();
17
- for (const type of item_types)
18
- this.add_type(type);
19
- item.add_item_listener(this);
20
- }
21
- types_updated(_) {
22
- // Remove deleted types
23
- for (const [tp_name, span] of this.types)
24
- if (!this.payload.get_types().has(coco.CoCo.get_instance().get_type(tp_name))) {
25
- this.types_row.removeChild(span);
26
- this.types.delete(tp_name);
27
- }
28
- // Add new types
29
- for (const type of this.payload.get_types())
30
- if (!this.types.has(type.get_name()))
31
- this.add_type(type);
32
- }
33
- properties_updated(_) { }
34
- values_updated(_) { }
35
- new_value(_i, _v) { }
36
- slots_updated(_) { }
37
- add_type(type) {
38
- const span = document.createElement('span');
39
- span.classList.add('badge', 'bg-primary', 'me-1');
40
- span.textContent = type.get_name();
41
- span.style.cursor = "pointer";
42
- span.addEventListener('click', () => App.get_instance().selected_component(new Type(type)));
43
- this.types_row.appendChild(span);
44
- this.types.set(type.get_name(), span);
45
- blink(span);
46
- }
47
- }
48
- //# sourceMappingURL=item_types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item_types.js","sourceRoot":"","sources":["../../../src/coco/components/item_types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,MAAM,OAAO,SAAU,SAAQ,gBAAoD;IAKjF,YAAY,IAAwB;QAClC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;QAJ5B,UAAK,GAAiC,IAAI,GAAG,EAAE,CAAC;QAM/D,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QACjD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC;QAElC,MAAM,WAAW,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QACnD,WAAW,CAAC,WAAW,GAAG,QAAQ,CAAC;QACnC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QAEnC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC/C,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;QAC7D,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEtC,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,E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C,MAAM,GAAG,SAAS,CAAC;QAC9B,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,kBAAkB,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC5F,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,CAAC;QACtC,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;CACF"}
@@ -1,17 +0,0 @@
1
- import { PayloadComponent } from "@ratiosolver/flick";
2
- import { coco } from "../coco";
3
- export declare class ItemsTable extends PayloadComponent<HTMLDivElement, coco.taxonomy.Item[]> implements coco.CoCoListener, coco.taxonomy.ItemListener {
4
- private readonly type;
5
- private readonly tbody;
6
- private readonly items;
7
- private readonly static_props;
8
- constructor(type: coco.taxonomy.Type, items?: coco.taxonomy.Item[]);
9
- new_type(_: coco.taxonomy.Type): void;
10
- new_item(item: coco.taxonomy.Item): void;
11
- types_updated(item: coco.taxonomy.Item): void;
12
- properties_updated(item: coco.taxonomy.Item): void;
13
- values_updated(_item: coco.taxonomy.Item): void;
14
- new_value(_item: coco.taxonomy.Item, _v: coco.taxonomy.Datum): void;
15
- private add_item;
16
- unmounting(): void;
17
- }
@@ -1,98 +0,0 @@
1
- import { App, blink, PayloadComponent } from "@ratiosolver/flick";
2
- import { coco } from "../coco";
3
- import { Item } from "./item";
4
- export class ItemsTable extends PayloadComponent {
5
- constructor(type, items = Array.from(type.get_instances())) {
6
- super(document.createElement("div"), items);
7
- this.items = new Map();
8
- this.type = type;
9
- this.static_props = type.get_static_properties();
10
- const table = document.createElement("table");
11
- table.classList.add("table", "table-hover", 'caption-top');
12
- table.createCaption().textContent = 'Items';
13
- const thead = document.createElement("thead");
14
- const header_row = document.createElement("tr");
15
- const id_th = document.createElement("th");
16
- id_th.textContent = "ID";
17
- header_row.appendChild(id_th);
18
- const static_props = type.get_static_properties();
19
- if (static_props)
20
- for (const [prop_name, _] of static_props) {
21
- const th = document.createElement("th");
22
- th.textContent = prop_name;
23
- header_row.appendChild(th);
24
- }
25
- thead.appendChild(header_row);
26
- table.appendChild(thead);
27
- this.tbody = document.createElement("tbody");
28
- for (const item of items)
29
- this.add_item(item);
30
- table.appendChild(this.tbody);
31
- this.node.appendChild(table);
32
- coco.CoCo.get_instance().add_coco_listener(this);
33
- }
34
- new_type(_) { }
35
- new_item(item) {
36
- if (item.get_types().has(this.type)) {
37
- this.add_item(item);
38
- item.add_item_listener(this);
39
- }
40
- }
41
- types_updated(item) {
42
- if (item.get_types().has(this.type)) {
43
- if (!this.items.has(item.get_id()))
44
- this.new_item(item);
45
- }
46
- else {
47
- const row = this.items.get(item.get_id());
48
- if (row) {
49
- this.tbody.removeChild(row);
50
- this.items.delete(item.get_id());
51
- item.remove_item_listener(this);
52
- }
53
- }
54
- }
55
- properties_updated(item) {
56
- const row = this.items.get(item.get_id());
57
- if (row && this.static_props) {
58
- const item_props = item.get_properties();
59
- let col_idx = 1;
60
- for (const [prop_name, prop] of this.static_props) {
61
- const td = row.children.item(col_idx);
62
- if (item_props && item_props[prop_name] !== undefined)
63
- td.textContent = prop.get_type().to_string(item_props[prop_name]);
64
- else
65
- td.textContent = "";
66
- col_idx += 1;
67
- }
68
- blink(row);
69
- }
70
- }
71
- values_updated(_item) { }
72
- new_value(_item, _v) { }
73
- add_item(item) {
74
- const row = document.createElement("tr");
75
- row.style.cursor = "pointer";
76
- const id_td = document.createElement("td");
77
- id_td.textContent = item.get_id();
78
- row.appendChild(id_td);
79
- if (this.static_props)
80
- for (const [prop_name, prop] of this.static_props) {
81
- const td = document.createElement("td");
82
- const item_props = item.get_properties();
83
- if (item_props && item_props[prop_name] !== undefined)
84
- td.textContent = prop.get_type().to_string(item_props[prop_name]);
85
- else
86
- td.textContent = "";
87
- row.appendChild(td);
88
- }
89
- row.addEventListener("click", () => App.get_instance().selected_component(new Item(item)));
90
- this.items.set(item.get_id(), row);
91
- this.tbody.appendChild(row);
92
- }
93
- unmounting() {
94
- super.unmounting();
95
- coco.CoCo.get_instance().remove_coco_listener(this);
96
- }
97
- }
98
- //# sourceMappingURL=items_table.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"items_table.js","sourceRoot":"","sources":["../../../src/coco/components/items_table.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,MAAM,OAAO,UAAW,SAAQ,gBAAsD;IAOpF,YAAY,IAAwB,EAAE,QAA8B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;QAClG,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;QAJ7B,UAAK,GAAqC,IAAI,GAAG,EAAE,CAAC;QAKnE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAEjD,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAC9C,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC;QAC3D,KAAK,CAAC,aAAa,EAAE,CAAC,WAAW,GAAG,OAAO,CAAC;QAE5C,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAC9C,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAChD,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,IAAI,CAA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M,EAAE,EAAE,GAAG,CAAC,CAAC;QACnC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;IAEQ,UAAU;QACjB,KAAK,CAAC,UAAU,EAAE,CAAC;QACnB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;CACF"}
@@ -1,200 +0,0 @@
1
- import 'leaflet/dist/leaflet.css';
2
- import * as L from 'leaflet';
3
- import { Component, Selector, SelectorGroup, ListItemComponent } from '@ratiosolver/flick';
4
- import { coco } from '../coco';
5
- export declare class MapElement extends ListItemComponent<void> implements Selector {
6
- /**
7
- * Constructs a new instance of the class.
8
- *
9
- * @param group - The `SelectorGroup` instance to which this component belongs.
10
- * @param text - The label text for the map component. Defaults to `'Map'`.
11
- */
12
- constructor(group: SelectorGroup, text?: string);
13
- select(): void;
14
- }
15
- export interface Layer {
16
- add_to(map: L.Map): void;
17
- remove_from(map: L.Map): void;
18
- unmount(): void;
19
- }
20
- export declare class MapLayer<P = any> implements Layer {
21
- protected layer: L.LayerGroup<P>;
22
- add_to(map: L.Map): void;
23
- remove_from(map: L.Map): void;
24
- unmount(): void;
25
- }
26
- export declare class MapComponent extends Component<HTMLDivElement> {
27
- protected map: L.Map | undefined;
28
- constructor();
29
- mounted(): void;
30
- /**
31
- * Adds a tile layer to the map using the specified URL and options.
32
- *
33
- * @param url - The URL template for the tile layer. Defaults to OpenStreetMap's standard tile server.
34
- * @param options - Optional configuration options for the tile layer.
35
- */
36
- add_tile_layer(url?: string, options?: L.TileLayerOptions): void;
37
- /**
38
- * Sets the view of the map to the specified center and zoom level.
39
- *
40
- * @param center - The geographical center of the map view, specified as a latitude and longitude pair.
41
- * @param zoom - The zoom level for the map view. Optional; if not provided, defaults to the current zoom level.
42
- * @param options - Optional parameters for zooming and panning.
43
- */
44
- set_view(center: L.LatLngExpression, zoom?: number, options?: L.ZoomPanOptions): this;
45
- /**
46
- * Adds the specified layer to the map instance.
47
- *
48
- * @param layer - The layer to be added to the map.
49
- */
50
- add_layer(layer: Layer): void;
51
- /**
52
- * Removes the specified layer from the map instance.
53
- *
54
- * @param layer - The layer to be removed from the map.
55
- */
56
- remove_layer(layer: Layer): void;
57
- }
58
- export interface HeatTile {
59
- bounds: L.LatLngBoundsExpression;
60
- value: number;
61
- }
62
- export declare class HeatMapLayer extends MapLayer<HeatTile> {
63
- constructor(tiles?: HeatTile[]);
64
- add_tiles(tiles: HeatTile[]): void;
65
- }
66
- export declare class GeoJSONLayer extends MapLayer {
67
- constructor(geojson: GeoJSON.FeatureCollection | GeoJSON.Feature);
68
- add_geojson(geojson: GeoJSON.FeatureCollection | GeoJSON.Feature): void;
69
- }
70
- export declare class CircleLayer<P> extends MapLayer<P> {
71
- private elements;
72
- private latlng_factory;
73
- private radius_factory?;
74
- private color_factory?;
75
- private popup_factory?;
76
- constructor(latlng_factory: (element: P) => L.LatLngExpression, elements?: P[]);
77
- /**
78
- * Adds elements to the layer, creating circle markers for each element.
79
- *
80
- * @param els - A single element of type `P` or an array of elements of type `P` to be added to the layer.
81
- */
82
- add_elements(els: P | P[]): void;
83
- /**
84
- * Checks if an element is already present in the layer.
85
- *
86
- * @param el - The element of type `P` to check for existence in the layer.
87
- * @returns A boolean indicating whether the element exists in the layer.
88
- */
89
- has_element(el: P): boolean;
90
- /**
91
- * Updates the position, radius, color, and popup content of existing elements in the layer.
92
- *
93
- * @param els - A single element of type `P` or an array of elements of type `P` to be updated in the layer.
94
- */
95
- update_elements(els: P | P[]): void;
96
- /**
97
- * Removes elements from the layer.
98
- *
99
- * @param els - A single element of type `P` or an array of elements of type `P` to be removed from the layer.
100
- */
101
- remove_elements(els: P | P[]): void;
102
- /**
103
- * Sets the factory function for creating the radius of the circle markers in the layer.
104
- *
105
- * @param factory - A function that takes an element of type `P` and returns a number for the radius.
106
- */
107
- protected set_radius_factory(factory: (element: P) => number): void;
108
- /**
109
- * Sets the factory function for creating the color of the circle markers in the layer.
110
- *
111
- * @param factory - A function that takes an element of type `P` and returns a string for the color.
112
- */
113
- protected set_color_factory(factory: (element: P) => string): void;
114
- /**
115
- * Sets the factory function for creating popup content for the circle markers in the layer.
116
- *
117
- * @param factory - A function that takes an element of type `P` and returns a string for the popup content.
118
- */
119
- protected set_popup_factory(factory: (element: P) => string): void;
120
- }
121
- export declare class IconLayer<P> extends MapLayer<P> {
122
- private elements;
123
- private latlng_factory;
124
- private icon_factory?;
125
- private popup_factory?;
126
- constructor(latlng_factory: (element: P) => L.LatLngExpression, elements?: P[]);
127
- /**
128
- * Adds elements to the layer, creating markers for each element with a specified icon.
129
- *
130
- * @param els - A single element of type `P` or an array of elements of type `P` to be added to the layer.
131
- */
132
- add_elements(els: P | P[]): void;
133
- /**
134
- * Checks if an element is already present in the layer.
135
- *
136
- * @param el - The element of type `P` to check for existence in the layer.
137
- * @returns A boolean indicating whether the element exists in the layer.
138
- */
139
- has_element(el: P): boolean;
140
- /**
141
- * Updates the position, icon, and popup content of existing elements in the layer.
142
- *
143
- * @param els - A single element of type `P` or an array of elements of type `P` to be updated in the layer.
144
- */
145
- update_elements(els: P | P[]): void;
146
- /**
147
- * Removes elements from the layer.
148
- *
149
- * @param els - A single element of type `P` or an array of elements of type `P` to be removed from the layer.
150
- */
151
- remove_elements(els: P | P[]): void;
152
- /**
153
- * Sets the factory function for creating icons for the markers in the layer.
154
- *
155
- * @param factory - A function that takes an element of type `P` and returns a Leaflet `Icon` instance.
156
- */
157
- protected set_icon_factory(factory: (element: P) => L.Icon): void;
158
- /**
159
- * Sets the factory function for creating popup content for the markers in the layer.
160
- *
161
- * @param factory - A function that takes an element of type `P` and returns a string for the popup content.
162
- */
163
- protected set_popup_factory(factory: (element: P) => string): void;
164
- }
165
- export declare class ItemCircleLayer extends CircleLayer<coco.taxonomy.Item> implements coco.CoCoListener, coco.taxonomy.ItemListener {
166
- private type;
167
- constructor(type: coco.taxonomy.Type);
168
- new_type(_type: coco.taxonomy.Type): void;
169
- new_item(item: coco.taxonomy.Item): void;
170
- types_updated(_: coco.taxonomy.Item): void;
171
- properties_updated(item: coco.taxonomy.Item): void;
172
- values_updated(_item: coco.taxonomy.Item): void;
173
- new_value(item: coco.taxonomy.Item, _v: coco.taxonomy.Datum): void;
174
- slots_updated(_item: coco.taxonomy.Item): void;
175
- unmount(): void;
176
- }
177
- export declare class ItemIconLayer extends IconLayer<coco.taxonomy.Item> implements coco.CoCoListener, coco.taxonomy.ItemListener {
178
- private type;
179
- constructor(type: coco.taxonomy.Type);
180
- new_type(_type: coco.taxonomy.Type): void;
181
- new_item(item: coco.taxonomy.Item): void;
182
- types_updated(_: coco.taxonomy.Item): void;
183
- properties_updated(item: coco.taxonomy.Item): void;
184
- values_updated(_item: coco.taxonomy.Item): void;
185
- new_value(item: coco.taxonomy.Item, _v: coco.taxonomy.Datum): void;
186
- slots_updated(_item: coco.taxonomy.Item): void;
187
- unmount(): void;
188
- static is_icon_layer(type: coco.taxonomy.Type): boolean;
189
- }
190
- /**
191
- * Determines whether a given type is considered "located", i.e., if it has location-related properties.
192
- *
193
- * A type is considered located if:
194
- * - It has a static property named 'location', or
195
- * - It has dynamic properties named both 'lat' and 'lng'.
196
- *
197
- * @param type - The taxonomy type to check for location properties.
198
- * @returns `true` if the type is located, otherwise `false`.
199
- */
200
- export declare function is_located(type: coco.taxonomy.Type): boolean;