architwin 1.7.3 → 1.7.4

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.
@@ -77,7 +77,11 @@ i18n
77
77
  "Copy": "Copy",
78
78
  "Undo": "Undo",
79
79
  "Redo": "Redo",
80
- "Confirm": "Confirm"
80
+ "Confirm": "Confirm",
81
+ "UpperLeft": "Upper left",
82
+ "UpperRight": "Upper right",
83
+ "BottomLeft": "Bottom left",
84
+ "BottomRight": "Bottom right"
81
85
  }
82
86
  },
83
87
  ja: {
@@ -149,7 +153,11 @@ i18n
149
153
  "Copy": "複写",
150
154
  "Undo": "やり直し",
151
155
  "Redo": "もう一度",
152
- "Confirm": "確認する"
156
+ "Confirm": "確認する",
157
+ "UpperLeft": "左上",
158
+ "UpperRight": "右上",
159
+ "BottomLeft": "左下",
160
+ "BottomRight": "右下"
153
161
  }
154
162
  }
155
163
  },
package/lib/convert.d.ts CHANGED
@@ -1,11 +1,6 @@
1
- export declare let generatedIds: Array<number>;
2
1
  export declare function meterToMillimeter(meter: number, decimal?: number): number;
3
2
  export declare function generateRandomUniqueNumber(currentIds: Array<number>): number;
4
- export declare function generateUUID(config?: {
5
- length?: number;
6
- separator?: string;
7
- }): string;
8
- export declare function generateRandomUsername(): string;
3
+ export declare function generateUUID(): string;
9
4
  export declare function useHexToRgb(hexcode: string): {
10
5
  r: number;
11
6
  g: number;
@@ -16,11 +11,3 @@ export declare function useRgbToHex(color: {
16
11
  g: number;
17
12
  b: number;
18
13
  }): string;
19
- export declare function convertToCssRgb(values: {
20
- r: number;
21
- g: number;
22
- b: number;
23
- }): string;
24
- export declare function arrayBufferToBase64(buffer: any): string;
25
- export declare function isUrlValid(userInput: string): boolean;
26
- export declare function dateTimeFormat(d: any): string;
package/lib/convert.js CHANGED
@@ -1,6 +1,3 @@
1
- import { format, toDate } from 'date-fns';
2
- import { ja } from 'date-fns/locale';
3
- export let generatedIds = [];
4
1
  export function meterToMillimeter(meter, decimal = 2) {
5
2
  const mm = meter * 1000;
6
3
  return parseFloat(mm.toFixed(decimal));
@@ -16,7 +13,7 @@ export function generateRandomUniqueNumber(currentIds) {
16
13
  } while (currentIds.indexOf(randomNumber) !== -1);
17
14
  return randomNumber;
18
15
  }
19
- export function generateUUID(config) {
16
+ export function generateUUID() {
20
17
  const cryptoObj = window.crypto;
21
18
  if (!cryptoObj) {
22
19
  console.error('crypto.getRandomValues() is not supported in this browser.');
@@ -32,42 +29,16 @@ export function generateUUID(config) {
32
29
  }
33
30
  hex.push(val);
34
31
  }
35
- let randUUID = `${hex[0]}${hex[1]}-${hex[2]}-${hex[3]}-${hex[4]}-${hex[5]}${hex[6]}${hex[7]}`;
36
- if (config && config.length) {
37
- console.log('Length set');
38
- randUUID = randUUID.slice(0, config.length);
39
- }
40
- if (config && config.separator) {
41
- console.log('Separator set');
42
- if (config.separator === 'none') {
43
- randUUID = randUUID.replace(/-/g, config.separator);
44
- }
45
- }
46
- return randUUID;
47
- }
48
- export function generateRandomUsername() {
49
- // Helper function to generate a random word
50
- function getRandomWord(length) {
51
- let result = '';
52
- const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
53
- const charactersLength = characters.length;
54
- for (let i = 0; i < length; i++) {
55
- result += characters.charAt(Math.floor(Math.random() * charactersLength));
56
- }
57
- return result;
58
- }
59
- const randomWord = getRandomWord(Math.floor(Math.random() * 5) + 4);
60
- const randomNumber = Math.floor(Math.random() * 10000);
61
- const username = `${randomWord}${randomNumber}`;
62
- return username;
32
+ // The UUID string format is "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
33
+ return `${hex[0]}${hex[1]}-${hex[2]}-${hex[3]}-${hex[4]}-${hex[5]}${hex[6]}${hex[7]}`;
63
34
  }
64
35
  export function useHexToRgb(hexcode) {
65
36
  // Remove '#' symbol if it exists
66
37
  hexcode = hexcode.replace("#", "");
67
38
  // Parse hex values for red, green, and blue
68
- const r = parseInt(hexcode.substring(0, 2), 16) / 255;
69
- const g = parseInt(hexcode.substring(2, 4), 16) / 255;
70
- const b = parseInt(hexcode.substring(4, 6), 16) / 255;
39
+ const r = parseInt(hexcode.substring(0, 2), 16);
40
+ const g = parseInt(hexcode.substring(2, 4), 16);
41
+ const b = parseInt(hexcode.substring(4, 6), 16);
71
42
  return { r, g, b };
72
43
  }
73
44
  export function useRgbToHex(color) {
@@ -81,31 +52,3 @@ export function useRgbToHex(color) {
81
52
  const hexB = color.b.toString(16).padStart(2, "0");
82
53
  return `${hexR}${hexG}${hexB}`;
83
54
  }
84
- export function convertToCssRgb(values) {
85
- // console.log('convertToCssRgb()', values)
86
- if (!values) {
87
- console.log('values is undefined');
88
- return;
89
- }
90
- let r = Math.round(values.r * 255);
91
- let g = Math.round(values.g * 255);
92
- let b = Math.round(values.b * 255);
93
- return `rgb(${r},${g},${b})`;
94
- }
95
- export function arrayBufferToBase64(buffer) {
96
- let binary = '';
97
- const bytes = new Uint8Array(buffer);
98
- const len = bytes.byteLength;
99
- for (let i = 0; i < len; i++) {
100
- binary += String.fromCharCode(bytes[i]);
101
- }
102
- return btoa(binary);
103
- }
104
- export function isUrlValid(userInput) {
105
- const urlPattern = /^(https?|ftp):\/\/[^\s/$.?#].[^\s]*$/;
106
- return urlPattern.test(userInput);
107
- }
108
- export function dateTimeFormat(d) {
109
- const local = format(toDate(d), 'yyyy年M月d日 HH:mm:ss', { locale: ja });
110
- return local;
111
- }
package/lib/minimap.d.ts CHANGED
@@ -41,7 +41,7 @@ declare function getFloorsInSpace(): FloorData[];
41
41
  declare function setStandaloneMap(modelId: string, appKey: string, mapId: string): Promise<void>;
42
42
  /**
43
43
  * This function creates the dropdown (HTLMElement) for available positions that Minimap can be set
44
- * @param options An array of strings representing the minimap positions (e.g., 'topLeft','bottomRight').
44
+ * @param mapPositions An array of strings representing the minimap positions (e.g., 'topLeft','bottomRight').
45
45
  * @returns HTLMElement with the specified position options.
46
46
  */
47
47
  declare function createDropdown(mapPositions: string[]): Promise<HTMLDivElement>;
package/lib/minimap.js CHANGED
@@ -866,11 +866,6 @@ function setStandaloneMap(modelId, appKey, mapId) {
866
866
  toggleSweepMarkerFloors(0);
867
867
  });
868
868
  }
869
- /**
870
- * This function creates the dropdown (HTLMElement) for available positions that Minimap can be set
871
- * @param options An array of strings representing the minimap positions (e.g., 'topLeft','bottomRight').
872
- * @returns HTLMElement with the specified position options.
873
- */
874
869
  // async function createDropdown(options: string[]) {
875
870
  // const element = document.createElement('div')
876
871
  // element.classList.add('at_flex', 'at_justify_end')
@@ -894,11 +889,23 @@ function setStandaloneMap(modelId, appKey, mapId) {
894
889
  // element.appendChild(dropdown)
895
890
  // return element;
896
891
  // }
892
+ /**
893
+ * This function creates the dropdown (HTLMElement) for available positions that Minimap can be set
894
+ * @param mapPositions An array of strings representing the minimap positions (e.g., 'topLeft','bottomRight').
895
+ * @returns HTLMElement with the specified position options.
896
+ */
897
897
  function createDropdown(mapPositions) {
898
898
  return __awaiter(this, void 0, void 0, function* () {
899
899
  log.info('createDropdown');
900
900
  const element = document.createElement('div');
901
901
  element.setAttribute('id', 'at-map-dropdown');
902
+ // const formattedPositions = mapPositions.map(position => {
903
+ // return position
904
+ // .replace('top', 'Upper ')
905
+ // .replace('bottom', 'Bottom ')
906
+ // .replace('Left', 'left')
907
+ // .replace('Right', 'right');
908
+ // });
902
909
  element.innerHTML = `
903
910
  <div style="height: 20px; padding-left: 3px" class="at_flex at_items_center">
904
911
  <span class="mdi mdi-overscan" style="color: white; cursor: pointer;" id="at-map-position-dropdown" data-cy="at-map-position-dropdown"></span>
@@ -907,16 +914,16 @@ function createDropdown(mapPositions) {
907
914
  <div style="position:absolute;">
908
915
  <div class="at_dropdown_options" style="z-index: 999 !important; width: 150px !important;" id="at-map-position-options" data-cy="at-map-position-options">
909
916
  <div id="at_map_bottom_right" class="at_dropdown at_flex at_items_center at_option at_custom_dropdown_option">
910
- <span class="mdi mdi-pan-bottom-right">Bottom right</span>
917
+ <span class="mdi mdi-pan-bottom-right">${i18n.t('BottomRight')}</span>
911
918
  </div>
912
919
  <div id="at_map_top_left" class="at_dropdown at_flex at_items_center at_option at_custom_dropdown_option">
913
- <span class="mdi mdi-pan-top-left">Upper left</span>
920
+ <span class="mdi mdi-pan-top-left">${i18n.t('UpperLeft')}</span>
914
921
  </div>
915
922
  <div id="at_map_bottom_left" class="at_dropdown at_flex at_items_center at_option at_custom_dropdown_option">
916
- <span class="mdi mdi-pan-bottom-left">Bottom left</span>
923
+ <span class="mdi mdi-pan-bottom-left">${i18n.t('BottomLeft')}</span>
917
924
  </div>
918
925
  <div id="at_map_top_right" class="at_dropdown at_flex at_items_center at_option at_custom_dropdown_option">
919
- <span class="mdi mdi-pan-top-right">Upper right</span>
926
+ <span class="mdi mdi-pan-top-right">${i18n.t('UpperRight')}</span>
920
927
  </div>
921
928
  </div>
922
929
  </div>
@@ -931,13 +938,6 @@ function mapPositionHandler(mapPositions) {
931
938
  const mapBottomRight = document.getElementById('at_map_bottom_right');
932
939
  const mapBottomLeft = document.getElementById('at_map_bottom_left');
933
940
  const options = document.getElementById('at-map-position-options');
934
- const formattedPositions = mapPositions.map(position => {
935
- return position
936
- .replace('top', 'Upper ')
937
- .replace('bottom', 'Bottom ')
938
- .replace('Left', 'left')
939
- .replace('Right', 'right');
940
- });
941
941
  dropdown.addEventListener('click', () => {
942
942
  console.log("__@ Dropdown Clicked!");
943
943
  options.classList.toggle('open');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "architwin",
3
- "version": "1.7.3",
3
+ "version": "1.7.4",
4
4
  "description": "ArchiTwin Library for Matterport",
5
5
  "main": "./lib/architwin.js",
6
6
  "types": "./lib/architwin.d.ts",
@@ -1,4 +0,0 @@
1
- import { LitElement } from 'lit';
2
- export declare class Menubar extends LitElement {
3
- render(): import("lit-html").TemplateResult<1>;
4
- }
@@ -1,35 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { html, LitElement } from 'lit';
8
- import { customElement } from 'lit/decorators.js';
9
- let Menubar = class Menubar extends LitElement {
10
- render() {
11
- return html `
12
- <div class="at_toolbar_container" id="at-menu-bar">
13
- <div class="at_sidebar_button_icon">
14
- <span class="mdi mdi-bullseye" id="at-expand-btn"></span>
15
- </div>
16
- <div class="at_sidebar_button_icon">
17
- <span class="mdi mdi-cube-outline" id="at-object-list-btn"></span>
18
- </div>
19
- <div class="at_sidebar_button_icon">
20
- <span class="mdi mdi-map" id="at-minimap-btn" target-pane="at-map"></span>
21
- </div>
22
- <div class="at_sidebar_button_icon">
23
- <span class="mdi mdi-message-video" id="at-videocall-btn"></span>
24
- </div>
25
- <div class="at_sidebar_button_icon">
26
- <span class="mdi mdi-monitor-screenshot" id="at-screenshot-btn"></span>
27
- </div>
28
- </div>
29
- `;
30
- }
31
- };
32
- Menubar = __decorate([
33
- customElement('at-menubar')
34
- ], Menubar);
35
- export { Menubar };
@@ -1,5 +0,0 @@
1
- import { LitElement } from 'lit';
2
- export declare class SidebarContainer extends LitElement {
3
- checked: boolean;
4
- render(): import("lit-html").TemplateResult<1>;
5
- }
@@ -1,27 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { html, LitElement } from 'lit';
8
- import { customElement, property } from 'lit/decorators.js';
9
- let SidebarContainer = class SidebarContainer extends LitElement {
10
- constructor() {
11
- super(...arguments);
12
- this.checked = false;
13
- }
14
- render() {
15
- return html `
16
- <div class="at_sidebar_container at_topRight" id="at-sidebar-container">
17
- </div>
18
- `;
19
- }
20
- };
21
- __decorate([
22
- property()
23
- ], SidebarContainer.prototype, "checked", void 0);
24
- SidebarContainer = __decorate([
25
- customElement('at-sidebar-container')
26
- ], SidebarContainer);
27
- export { SidebarContainer };