ninegrid2 6.1207.0 → 6.1209.0

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.
@@ -119434,14 +119434,14 @@ class nxDialog extends HTMLElement
119434
119434
 
119435
119435
  const v = this.innerHTML;
119436
119436
  const cssFile = this.getAttribute("css-file");
119437
- const customFile1 = cssFile ? `@import "https://cdn.jsdelivr.net/npm/ninegrid2@${ninegrid.version}/dist/css/${cssFile}";`: "";
119437
+ const customFile1 = cssFile ? `@import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/${cssFile}";`: "";
119438
119438
  const customFile2 = cssFile ? ninegrid.getCustomPath(this, cssFile) : "";
119439
119439
 
119440
119440
  //console.log(ninegrid.getCustomPath(this,"nxDialog.css"));
119441
119441
 
119442
119442
  this.innerHTML = `
119443
119443
  <style>
119444
- @import "https://cdn.jsdelivr.net/npm/ninegrid2@${ninegrid.version}/dist/css/nxDialog.css";
119444
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxDialog.css";
119445
119445
  ${ninegrid.getCustomPath(this,"nxDialog.css") || ""}
119446
119446
  ${customFile1 || ""}
119447
119447
  ${customFile2 || ""}
@@ -122253,6 +122253,146 @@ class nxButtons extends nxDiv {
122253
122253
 
122254
122254
  customElements.define("nx-buttons", nxButtons);
122255
122255
 
122256
+ class nxModal extends HTMLElement
122257
+ {
122258
+ //#owner;
122259
+ #shift;
122260
+
122261
+ constructor () {
122262
+ super();
122263
+ }
122264
+
122265
+ connectedCallback() {
122266
+
122267
+ const v = this.innerHTML;
122268
+ const cssFile = this.getAttribute("css-file");
122269
+ cssFile ? `@import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/${cssFile}";`: "";
122270
+ cssFile ? ninegrid.getCustomPath(this, cssFile) : "";
122271
+
122272
+ //console.log(ninegrid.getCustomPath(this,"nxDialog.css"));
122273
+
122274
+ this.innerHTML = `
122275
+
122276
+ <div>
122277
+ <div class="head">
122278
+ <div class="rect1"></div>
122279
+ <div class="rect2"></div>
122280
+ <div class="rect3"></div>
122281
+ <ng-sphere class="icon" end-fill="#666" size="8"></ng-sphere>
122282
+ <span class="title"></span>
122283
+ <span class="sub-title"></span>
122284
+ <buttons>
122285
+ <ng-sphere class="apply" start-fill="#cc6" end-fill="#660" size="16" title="apply"></ng-sphere>
122286
+ <ng-sphere class="reset" start-fill="#99f" end-fill="#00f" size="16" title="reset"></ng-sphere>
122287
+ <ng-sphere class="close" start-fill="#f99" end-fill="#f00" size="16" title="close"></ng-sphere>
122288
+ </buttons>
122289
+ </div>
122290
+ <div class="contents">
122291
+ <div class="left">
122292
+ <span>가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하</span>
122293
+ </div>
122294
+ <div class="body">
122295
+ ${v}
122296
+ </div>
122297
+ <div class="close2">
122298
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
122299
+ <path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"/>
122300
+ </svg>
122301
+ </div>
122302
+ </div>
122303
+ </div>
122304
+ `;
122305
+
122306
+ //$(".title", this).html("Details");
122307
+
122308
+ //this.#init();
122309
+ };
122310
+
122311
+ showModal = () => {
122312
+ this.querySelector('dialog').showModal();
122313
+ };
122314
+
122315
+ close = () => {
122316
+ $(".head", this) .off('mousedown', this.#onMouseDown);
122317
+ $(".head", this) .off('touchstart', this.#onTouchStart);
122318
+ $(document) .off('mouseup', this.#onMouseUp);
122319
+ $(document) .off('touchend', this.#onTouchEnd);
122320
+ $(document) .off('mousemove', this.#onMouseMove);
122321
+ $(document) .off("touchmove", this.#onTouchMove);
122322
+
122323
+ this.querySelector('dialog').close();
122324
+ };
122325
+
122326
+ #init = () => {
122327
+ /**
122328
+ $(".close,.close2", this).on("click", e => {
122329
+ ninegrid.j.querySelectorAll('dialog', this).addClass("out");
122330
+ setTimeout(() => { this.close(); }, 300);
122331
+ }); */
122332
+
122333
+ $(".close", this).on("click", e => {
122334
+ ninegrid.j.querySelectorAll('dialog', this).addClass("out");
122335
+ setTimeout(() => { this.close(); }, 300);
122336
+ });
122337
+
122338
+ $(".close2", this).on("click", e => {
122339
+ this.close();
122340
+ });
122341
+
122342
+ $(".head", this) .on('mousedown', this.#onMouseDown);
122343
+ $(".head", this) .on('touchstart', this.#onTouchStart);
122344
+ $(document) .on('mouseup', this.#onMouseUp);
122345
+ $(document) .on('touchend', this.#onTouchEnd);
122346
+ };
122347
+
122348
+
122349
+ #onMouseDown = e => {
122350
+ if (e.target.closest("buttons")) return;
122351
+ if (e.buttons != 1 || e.altKey || e.ctrlKey || e.shiftkey) return;
122352
+
122353
+ var rect = this.querySelector('dialog').getBoundingClientRect();
122354
+
122355
+ this.#shift = {
122356
+ x : e.clientX - rect.x,
122357
+ y : e.clientY - rect.y,
122358
+ };
122359
+
122360
+ $(document).on('mousemove', this.#onMouseMove);
122361
+ };
122362
+
122363
+
122364
+ #onMouseMove = e => {
122365
+ $(this.querySelector('dialog')).offset( { left : e.pageX - this.#shift.x, top : e.pageY - this.#shift.y });
122366
+ };
122367
+
122368
+ #onMouseUp = e => {
122369
+ $(document).off('mousemove', this.#onMouseMove);
122370
+ };
122371
+
122372
+ #onTouchStart = e => {
122373
+ if (e.target.closest("buttons")) return;
122374
+
122375
+ var rect = this.querySelector('dialog').getBoundingClientRect();
122376
+
122377
+ this.#shift = {
122378
+ x : e.changedTouches[0].pageX - rect.x,
122379
+ y : e.changedTouches[0].pageY - rect.y,
122380
+ };
122381
+
122382
+ $(document).on("touchmove", this.#onTouchMove);
122383
+ };
122384
+
122385
+ #onTouchMove = e => {
122386
+ $(this.querySelector('dialog')).offset( { left : e.changedTouches[0].pageX - this.#shift.x, top : e.changedTouches[0].pageY - this.#shift.y });
122387
+ };
122388
+
122389
+ #onTouchEnd = e => {
122390
+ $(document).off('touchmove', this.#onTouchMove);
122391
+ };
122392
+ }
122393
+
122394
+ customElements.define("nx-modal", nxModal);
122395
+
122256
122396
  class aiSettings extends HTMLElement
122257
122397
  {
122258
122398
  constructor() {
@@ -119430,14 +119430,14 @@ class nxDialog extends HTMLElement
119430
119430
 
119431
119431
  const v = this.innerHTML;
119432
119432
  const cssFile = this.getAttribute("css-file");
119433
- const customFile1 = cssFile ? `@import "https://cdn.jsdelivr.net/npm/ninegrid2@${ninegrid.version}/dist/css/${cssFile}";`: "";
119433
+ const customFile1 = cssFile ? `@import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/${cssFile}";`: "";
119434
119434
  const customFile2 = cssFile ? ninegrid.getCustomPath(this, cssFile) : "";
119435
119435
 
119436
119436
  //console.log(ninegrid.getCustomPath(this,"nxDialog.css"));
119437
119437
 
119438
119438
  this.innerHTML = `
119439
119439
  <style>
119440
- @import "https://cdn.jsdelivr.net/npm/ninegrid2@${ninegrid.version}/dist/css/nxDialog.css";
119440
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxDialog.css";
119441
119441
  ${ninegrid.getCustomPath(this,"nxDialog.css") || ""}
119442
119442
  ${customFile1 || ""}
119443
119443
  ${customFile2 || ""}
@@ -122249,6 +122249,146 @@ class nxButtons extends nxDiv {
122249
122249
 
122250
122250
  customElements.define("nx-buttons", nxButtons);
122251
122251
 
122252
+ class nxModal extends HTMLElement
122253
+ {
122254
+ //#owner;
122255
+ #shift;
122256
+
122257
+ constructor () {
122258
+ super();
122259
+ }
122260
+
122261
+ connectedCallback() {
122262
+
122263
+ const v = this.innerHTML;
122264
+ const cssFile = this.getAttribute("css-file");
122265
+ cssFile ? `@import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/${cssFile}";`: "";
122266
+ cssFile ? ninegrid.getCustomPath(this, cssFile) : "";
122267
+
122268
+ //console.log(ninegrid.getCustomPath(this,"nxDialog.css"));
122269
+
122270
+ this.innerHTML = `
122271
+
122272
+ <div>
122273
+ <div class="head">
122274
+ <div class="rect1"></div>
122275
+ <div class="rect2"></div>
122276
+ <div class="rect3"></div>
122277
+ <ng-sphere class="icon" end-fill="#666" size="8"></ng-sphere>
122278
+ <span class="title"></span>
122279
+ <span class="sub-title"></span>
122280
+ <buttons>
122281
+ <ng-sphere class="apply" start-fill="#cc6" end-fill="#660" size="16" title="apply"></ng-sphere>
122282
+ <ng-sphere class="reset" start-fill="#99f" end-fill="#00f" size="16" title="reset"></ng-sphere>
122283
+ <ng-sphere class="close" start-fill="#f99" end-fill="#f00" size="16" title="close"></ng-sphere>
122284
+ </buttons>
122285
+ </div>
122286
+ <div class="contents">
122287
+ <div class="left">
122288
+ <span>가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하</span>
122289
+ </div>
122290
+ <div class="body">
122291
+ ${v}
122292
+ </div>
122293
+ <div class="close2">
122294
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
122295
+ <path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"/>
122296
+ </svg>
122297
+ </div>
122298
+ </div>
122299
+ </div>
122300
+ `;
122301
+
122302
+ //$(".title", this).html("Details");
122303
+
122304
+ //this.#init();
122305
+ };
122306
+
122307
+ showModal = () => {
122308
+ this.querySelector('dialog').showModal();
122309
+ };
122310
+
122311
+ close = () => {
122312
+ $(".head", this) .off('mousedown', this.#onMouseDown);
122313
+ $(".head", this) .off('touchstart', this.#onTouchStart);
122314
+ $(document) .off('mouseup', this.#onMouseUp);
122315
+ $(document) .off('touchend', this.#onTouchEnd);
122316
+ $(document) .off('mousemove', this.#onMouseMove);
122317
+ $(document) .off("touchmove", this.#onTouchMove);
122318
+
122319
+ this.querySelector('dialog').close();
122320
+ };
122321
+
122322
+ #init = () => {
122323
+ /**
122324
+ $(".close,.close2", this).on("click", e => {
122325
+ ninegrid.j.querySelectorAll('dialog', this).addClass("out");
122326
+ setTimeout(() => { this.close(); }, 300);
122327
+ }); */
122328
+
122329
+ $(".close", this).on("click", e => {
122330
+ ninegrid.j.querySelectorAll('dialog', this).addClass("out");
122331
+ setTimeout(() => { this.close(); }, 300);
122332
+ });
122333
+
122334
+ $(".close2", this).on("click", e => {
122335
+ this.close();
122336
+ });
122337
+
122338
+ $(".head", this) .on('mousedown', this.#onMouseDown);
122339
+ $(".head", this) .on('touchstart', this.#onTouchStart);
122340
+ $(document) .on('mouseup', this.#onMouseUp);
122341
+ $(document) .on('touchend', this.#onTouchEnd);
122342
+ };
122343
+
122344
+
122345
+ #onMouseDown = e => {
122346
+ if (e.target.closest("buttons")) return;
122347
+ if (e.buttons != 1 || e.altKey || e.ctrlKey || e.shiftkey) return;
122348
+
122349
+ var rect = this.querySelector('dialog').getBoundingClientRect();
122350
+
122351
+ this.#shift = {
122352
+ x : e.clientX - rect.x,
122353
+ y : e.clientY - rect.y,
122354
+ };
122355
+
122356
+ $(document).on('mousemove', this.#onMouseMove);
122357
+ };
122358
+
122359
+
122360
+ #onMouseMove = e => {
122361
+ $(this.querySelector('dialog')).offset( { left : e.pageX - this.#shift.x, top : e.pageY - this.#shift.y });
122362
+ };
122363
+
122364
+ #onMouseUp = e => {
122365
+ $(document).off('mousemove', this.#onMouseMove);
122366
+ };
122367
+
122368
+ #onTouchStart = e => {
122369
+ if (e.target.closest("buttons")) return;
122370
+
122371
+ var rect = this.querySelector('dialog').getBoundingClientRect();
122372
+
122373
+ this.#shift = {
122374
+ x : e.changedTouches[0].pageX - rect.x,
122375
+ y : e.changedTouches[0].pageY - rect.y,
122376
+ };
122377
+
122378
+ $(document).on("touchmove", this.#onTouchMove);
122379
+ };
122380
+
122381
+ #onTouchMove = e => {
122382
+ $(this.querySelector('dialog')).offset( { left : e.changedTouches[0].pageX - this.#shift.x, top : e.changedTouches[0].pageY - this.#shift.y });
122383
+ };
122384
+
122385
+ #onTouchEnd = e => {
122386
+ $(document).off('touchmove', this.#onTouchMove);
122387
+ };
122388
+ }
122389
+
122390
+ customElements.define("nx-modal", nxModal);
122391
+
122252
122392
  class aiSettings extends HTMLElement
122253
122393
  {
122254
122394
  constructor() {
@@ -13,14 +13,14 @@ class nxDialog extends HTMLElement
13
13
 
14
14
  const v = this.innerHTML;
15
15
  const cssFile = this.getAttribute("css-file");
16
- const customFile1 = cssFile ? `@import "https://cdn.jsdelivr.net/npm/ninegrid2@${ninegrid.version}/dist/css/${cssFile}";`: "";
16
+ const customFile1 = cssFile ? `@import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/${cssFile}";`: "";
17
17
  const customFile2 = cssFile ? ninegrid.getCustomPath(this, cssFile) : "";
18
18
 
19
19
  //console.log(ninegrid.getCustomPath(this,"nxDialog.css"));
20
20
 
21
21
  this.innerHTML = `
22
22
  <style>
23
- @import "https://cdn.jsdelivr.net/npm/ninegrid2@${ninegrid.version}/dist/css/nxDialog.css";
23
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxDialog.css";
24
24
  ${ninegrid.getCustomPath(this,"nxDialog.css") || ""}
25
25
  ${customFile1 || ""}
26
26
  ${customFile2 || ""}
package/dist/index.js CHANGED
@@ -111,6 +111,7 @@ import "./nx/nxLayout.js";
111
111
  import "./nx/nxLayout2.js";
112
112
  import "./nx/nxPanel.js";
113
113
  import "./nx/nxButtons.js";
114
+ import "./nx/nxModal.js";
114
115
 
115
116
  import "./ai/aiSettings.js";
116
117
  import "./ai/aiMessage.js";
@@ -0,0 +1,141 @@
1
+ import ninegrid from "../index.js";
2
+
3
+ class nxModal extends HTMLElement
4
+ {
5
+ //#owner;
6
+ #shift;
7
+
8
+ constructor () {
9
+ super();
10
+ }
11
+
12
+ connectedCallback() {
13
+
14
+ const v = this.innerHTML;
15
+ const cssFile = this.getAttribute("css-file");
16
+ const customFile1 = cssFile ? `@import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/${cssFile}";`: "";
17
+ const customFile2 = cssFile ? ninegrid.getCustomPath(this, cssFile) : "";
18
+
19
+ //console.log(ninegrid.getCustomPath(this,"nxDialog.css"));
20
+
21
+ this.innerHTML = `
22
+
23
+ <div>
24
+ <div class="head">
25
+ <div class="rect1"></div>
26
+ <div class="rect2"></div>
27
+ <div class="rect3"></div>
28
+ <ng-sphere class="icon" end-fill="#666" size="8"></ng-sphere>
29
+ <span class="title"></span>
30
+ <span class="sub-title"></span>
31
+ <buttons>
32
+ <ng-sphere class="apply" start-fill="#cc6" end-fill="#660" size="16" title="apply"></ng-sphere>
33
+ <ng-sphere class="reset" start-fill="#99f" end-fill="#00f" size="16" title="reset"></ng-sphere>
34
+ <ng-sphere class="close" start-fill="#f99" end-fill="#f00" size="16" title="close"></ng-sphere>
35
+ </buttons>
36
+ </div>
37
+ <div class="contents">
38
+ <div class="left">
39
+ <span>가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하</span>
40
+ </div>
41
+ <div class="body">
42
+ ${v}
43
+ </div>
44
+ <div class="close2">
45
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
46
+ <path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"/>
47
+ </svg>
48
+ </div>
49
+ </div>
50
+ </div>
51
+ `;
52
+
53
+ //$(".title", this).html("Details");
54
+
55
+ //this.#init();
56
+ };
57
+
58
+ showModal = () => {
59
+ this.querySelector('dialog').showModal();
60
+ };
61
+
62
+ close = () => {
63
+ $(".head", this) .off('mousedown', this.#onMouseDown);
64
+ $(".head", this) .off('touchstart', this.#onTouchStart);
65
+ $(document) .off('mouseup', this.#onMouseUp);
66
+ $(document) .off('touchend', this.#onTouchEnd);
67
+ $(document) .off('mousemove', this.#onMouseMove);
68
+ $(document) .off("touchmove", this.#onTouchMove);
69
+
70
+ this.querySelector('dialog').close();
71
+ };
72
+
73
+ #init = () => {
74
+ /**
75
+ $(".close,.close2", this).on("click", e => {
76
+ ninegrid.j.querySelectorAll('dialog', this).addClass("out");
77
+ setTimeout(() => { this.close(); }, 300);
78
+ }); */
79
+
80
+ $(".close", this).on("click", e => {
81
+ ninegrid.j.querySelectorAll('dialog', this).addClass("out");
82
+ setTimeout(() => { this.close(); }, 300);
83
+ });
84
+
85
+ $(".close2", this).on("click", e => {
86
+ this.close();
87
+ });
88
+
89
+ $(".head", this) .on('mousedown', this.#onMouseDown);
90
+ $(".head", this) .on('touchstart', this.#onTouchStart);
91
+ $(document) .on('mouseup', this.#onMouseUp);
92
+ $(document) .on('touchend', this.#onTouchEnd);
93
+ };
94
+
95
+
96
+ #onMouseDown = e => {
97
+ if (e.target.closest("buttons")) return;
98
+ if (e.buttons != 1 || e.altKey || e.ctrlKey || e.shiftkey) return;
99
+
100
+ var rect = this.querySelector('dialog').getBoundingClientRect();
101
+
102
+ this.#shift = {
103
+ x : e.clientX - rect.x,
104
+ y : e.clientY - rect.y,
105
+ }
106
+
107
+ $(document).on('mousemove', this.#onMouseMove);
108
+ };
109
+
110
+
111
+ #onMouseMove = e => {
112
+ $(this.querySelector('dialog')).offset( { left : e.pageX - this.#shift.x, top : e.pageY - this.#shift.y });
113
+ };
114
+
115
+ #onMouseUp = e => {
116
+ $(document).off('mousemove', this.#onMouseMove);
117
+ };
118
+
119
+ #onTouchStart = e => {
120
+ if (e.target.closest("buttons")) return;
121
+
122
+ var rect = this.querySelector('dialog').getBoundingClientRect();
123
+
124
+ this.#shift = {
125
+ x : e.changedTouches[0].pageX - rect.x,
126
+ y : e.changedTouches[0].pageY - rect.y,
127
+ }
128
+
129
+ $(document).on("touchmove", this.#onTouchMove);
130
+ };
131
+
132
+ #onTouchMove = e => {
133
+ $(this.querySelector('dialog')).offset( { left : e.changedTouches[0].pageX - this.#shift.x, top : e.changedTouches[0].pageY - this.#shift.y });
134
+ };
135
+
136
+ #onTouchEnd = e => {
137
+ $(document).off('touchmove', this.#onTouchMove);
138
+ };
139
+ }
140
+
141
+ customElements.define("nx-modal", nxModal);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.1207.0",
4
+ "version": "6.1209.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -13,14 +13,14 @@ class nxDialog extends HTMLElement
13
13
 
14
14
  const v = this.innerHTML;
15
15
  const cssFile = this.getAttribute("css-file");
16
- const customFile1 = cssFile ? `@import "https://cdn.jsdelivr.net/npm/ninegrid2@${ninegrid.version}/dist/css/${cssFile}";`: "";
16
+ const customFile1 = cssFile ? `@import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/${cssFile}";`: "";
17
17
  const customFile2 = cssFile ? ninegrid.getCustomPath(this, cssFile) : "";
18
18
 
19
19
  //console.log(ninegrid.getCustomPath(this,"nxDialog.css"));
20
20
 
21
21
  this.innerHTML = `
22
22
  <style>
23
- @import "https://cdn.jsdelivr.net/npm/ninegrid2@${ninegrid.version}/dist/css/nxDialog.css";
23
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxDialog.css";
24
24
  ${ninegrid.getCustomPath(this,"nxDialog.css") || ""}
25
25
  ${customFile1 || ""}
26
26
  ${customFile2 || ""}
package/src/index.js CHANGED
@@ -111,6 +111,7 @@ import "./nx/nxLayout.js";
111
111
  import "./nx/nxLayout2.js";
112
112
  import "./nx/nxPanel.js";
113
113
  import "./nx/nxButtons.js";
114
+ import "./nx/nxModal.js";
114
115
 
115
116
  import "./ai/aiSettings.js";
116
117
  import "./ai/aiMessage.js";
@@ -0,0 +1,141 @@
1
+ import ninegrid from "../index.js";
2
+
3
+ class nxModal extends HTMLElement
4
+ {
5
+ //#owner;
6
+ #shift;
7
+
8
+ constructor () {
9
+ super();
10
+ }
11
+
12
+ connectedCallback() {
13
+
14
+ const v = this.innerHTML;
15
+ const cssFile = this.getAttribute("css-file");
16
+ const customFile1 = cssFile ? `@import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/${cssFile}";`: "";
17
+ const customFile2 = cssFile ? ninegrid.getCustomPath(this, cssFile) : "";
18
+
19
+ //console.log(ninegrid.getCustomPath(this,"nxDialog.css"));
20
+
21
+ this.innerHTML = `
22
+
23
+ <div>
24
+ <div class="head">
25
+ <div class="rect1"></div>
26
+ <div class="rect2"></div>
27
+ <div class="rect3"></div>
28
+ <ng-sphere class="icon" end-fill="#666" size="8"></ng-sphere>
29
+ <span class="title"></span>
30
+ <span class="sub-title"></span>
31
+ <buttons>
32
+ <ng-sphere class="apply" start-fill="#cc6" end-fill="#660" size="16" title="apply"></ng-sphere>
33
+ <ng-sphere class="reset" start-fill="#99f" end-fill="#00f" size="16" title="reset"></ng-sphere>
34
+ <ng-sphere class="close" start-fill="#f99" end-fill="#f00" size="16" title="close"></ng-sphere>
35
+ </buttons>
36
+ </div>
37
+ <div class="contents">
38
+ <div class="left">
39
+ <span>가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하</span>
40
+ </div>
41
+ <div class="body">
42
+ ${v}
43
+ </div>
44
+ <div class="close2">
45
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
46
+ <path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"/>
47
+ </svg>
48
+ </div>
49
+ </div>
50
+ </div>
51
+ `;
52
+
53
+ //$(".title", this).html("Details");
54
+
55
+ //this.#init();
56
+ };
57
+
58
+ showModal = () => {
59
+ this.querySelector('dialog').showModal();
60
+ };
61
+
62
+ close = () => {
63
+ $(".head", this) .off('mousedown', this.#onMouseDown);
64
+ $(".head", this) .off('touchstart', this.#onTouchStart);
65
+ $(document) .off('mouseup', this.#onMouseUp);
66
+ $(document) .off('touchend', this.#onTouchEnd);
67
+ $(document) .off('mousemove', this.#onMouseMove);
68
+ $(document) .off("touchmove", this.#onTouchMove);
69
+
70
+ this.querySelector('dialog').close();
71
+ };
72
+
73
+ #init = () => {
74
+ /**
75
+ $(".close,.close2", this).on("click", e => {
76
+ ninegrid.j.querySelectorAll('dialog', this).addClass("out");
77
+ setTimeout(() => { this.close(); }, 300);
78
+ }); */
79
+
80
+ $(".close", this).on("click", e => {
81
+ ninegrid.j.querySelectorAll('dialog', this).addClass("out");
82
+ setTimeout(() => { this.close(); }, 300);
83
+ });
84
+
85
+ $(".close2", this).on("click", e => {
86
+ this.close();
87
+ });
88
+
89
+ $(".head", this) .on('mousedown', this.#onMouseDown);
90
+ $(".head", this) .on('touchstart', this.#onTouchStart);
91
+ $(document) .on('mouseup', this.#onMouseUp);
92
+ $(document) .on('touchend', this.#onTouchEnd);
93
+ };
94
+
95
+
96
+ #onMouseDown = e => {
97
+ if (e.target.closest("buttons")) return;
98
+ if (e.buttons != 1 || e.altKey || e.ctrlKey || e.shiftkey) return;
99
+
100
+ var rect = this.querySelector('dialog').getBoundingClientRect();
101
+
102
+ this.#shift = {
103
+ x : e.clientX - rect.x,
104
+ y : e.clientY - rect.y,
105
+ }
106
+
107
+ $(document).on('mousemove', this.#onMouseMove);
108
+ };
109
+
110
+
111
+ #onMouseMove = e => {
112
+ $(this.querySelector('dialog')).offset( { left : e.pageX - this.#shift.x, top : e.pageY - this.#shift.y });
113
+ };
114
+
115
+ #onMouseUp = e => {
116
+ $(document).off('mousemove', this.#onMouseMove);
117
+ };
118
+
119
+ #onTouchStart = e => {
120
+ if (e.target.closest("buttons")) return;
121
+
122
+ var rect = this.querySelector('dialog').getBoundingClientRect();
123
+
124
+ this.#shift = {
125
+ x : e.changedTouches[0].pageX - rect.x,
126
+ y : e.changedTouches[0].pageY - rect.y,
127
+ }
128
+
129
+ $(document).on("touchmove", this.#onTouchMove);
130
+ };
131
+
132
+ #onTouchMove = e => {
133
+ $(this.querySelector('dialog')).offset( { left : e.changedTouches[0].pageX - this.#shift.x, top : e.changedTouches[0].pageY - this.#shift.y });
134
+ };
135
+
136
+ #onTouchEnd = e => {
137
+ $(document).off('touchmove', this.#onTouchMove);
138
+ };
139
+ }
140
+
141
+ customElements.define("nx-modal", nxModal);