@wcardinal/wcardinal-ui 0.432.0 → 0.434.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.
Files changed (30) hide show
  1. package/dist/types/wcardinal/ui/d-diagram-canvas-editor-snap.d.ts +7 -5
  2. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-diagram-canvas-editor.d.ts +0 -1
  3. package/dist/types/wcardinal/ui/theme/white/d-theme-white-diagram-canvas-editor.d.ts +0 -1
  4. package/dist/wcardinal/ui/d-diagram-canvas-editor-snap.js +22 -24
  5. package/dist/wcardinal/ui/d-diagram-canvas-editor-snap.js.map +1 -1
  6. package/dist/wcardinal/ui/theme/dark/d-theme-dark-diagram-canvas-editor.js +15 -4
  7. package/dist/wcardinal/ui/theme/dark/d-theme-dark-diagram-canvas-editor.js.map +1 -1
  8. package/dist/wcardinal/ui/theme/white/d-theme-white-diagram-canvas-editor.js +15 -4
  9. package/dist/wcardinal/ui/theme/white/d-theme-white-diagram-canvas-editor.js.map +1 -1
  10. package/dist/wcardinal-ui-theme-dark-en-us.js +16 -5
  11. package/dist/wcardinal-ui-theme-dark-en-us.min.js +2 -2
  12. package/dist/wcardinal-ui-theme-dark-en-us.min.js.map +1 -1
  13. package/dist/wcardinal-ui-theme-dark-ja-jp.js +16 -5
  14. package/dist/wcardinal-ui-theme-dark-ja-jp.min.js +2 -2
  15. package/dist/wcardinal-ui-theme-dark-ja-jp.min.js.map +1 -1
  16. package/dist/wcardinal-ui-theme-dark.js +16 -5
  17. package/dist/wcardinal-ui-theme-dark.min.js +2 -2
  18. package/dist/wcardinal-ui-theme-white-en-us.js +16 -5
  19. package/dist/wcardinal-ui-theme-white-en-us.min.js +2 -2
  20. package/dist/wcardinal-ui-theme-white-en-us.min.js.map +1 -1
  21. package/dist/wcardinal-ui-theme-white-ja-jp.js +16 -5
  22. package/dist/wcardinal-ui-theme-white-ja-jp.min.js +2 -2
  23. package/dist/wcardinal-ui-theme-white-ja-jp.min.js.map +1 -1
  24. package/dist/wcardinal-ui-theme-white.js +16 -5
  25. package/dist/wcardinal-ui-theme-white.min.js +2 -2
  26. package/dist/wcardinal-ui.cjs.js +53 -33
  27. package/dist/wcardinal-ui.js +23 -25
  28. package/dist/wcardinal-ui.min.js +2 -2
  29. package/dist/wcardinal-ui.min.js.map +1 -1
  30. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.432.0
2
+ Winter Cardinal UI v0.434.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -56317,9 +56317,23 @@ var loadThemeWhiteEnUsDiagram = function () {
56317
56317
  * Copyright (C) 2019 Toshiba Corporation
56318
56318
  * SPDX-License-Identifier: Apache-2.0
56319
56319
  */
56320
- var toGridSize$1 = function (grid, width, height) {
56320
+ var toGridScale$1 = function (scale) {
56321
+ if (scale <= 0 || 1 <= scale) {
56322
+ return 1;
56323
+ }
56324
+ var s = 1 / scale;
56325
+ s = s | (s >> 1);
56326
+ s = s | (s >> 2);
56327
+ s = s | (s >> 4);
56328
+ s = s | (s >> 8);
56329
+ s = s | (s >> 16);
56330
+ s = s | (s >> 32);
56331
+ return s - (s >> 1);
56332
+ };
56333
+ var toGridSize$1 = function (grid, width, height, scale) {
56321
56334
  var canvas = Math.max(width, height);
56322
56335
  if (0 < grid) {
56336
+ grid *= toGridScale$1(scale);
56323
56337
  var minimum = canvas / 1000;
56324
56338
  for (var i = 0; i < 10 && grid < minimum; ++i) {
56325
56339
  grid *= 10;
@@ -56375,9 +56389,6 @@ var DThemeWhiteDiagramCanvasEditor = /** @class */ (function (_super) {
56375
56389
  DThemeWhiteDiagramCanvasEditor.prototype.getSnapGridSize = function () {
56376
56390
  return toGridSize$1;
56377
56391
  };
56378
- DThemeWhiteDiagramCanvasEditor.prototype.isSnapGridAdaptive = function () {
56379
- return true;
56380
- };
56381
56392
  DThemeWhiteDiagramCanvasEditor.prototype.getSnapTargetColor = function () {
56382
56393
  return DThemeWhiteConstants.HIGHLIGHT_COLOR;
56383
56394
  };
@@ -66853,9 +66864,23 @@ var loadThemeDarkEnUsDiagram = function () {
66853
66864
  * Copyright (C) 2019 Toshiba Corporation
66854
66865
  * SPDX-License-Identifier: Apache-2.0
66855
66866
  */
66856
- var toGridSize = function (grid, width, height) {
66867
+ var toGridScale = function (scale) {
66868
+ if (scale <= 0 || 1 <= scale) {
66869
+ return 1;
66870
+ }
66871
+ var s = 1 / scale;
66872
+ s = s | (s >> 1);
66873
+ s = s | (s >> 2);
66874
+ s = s | (s >> 4);
66875
+ s = s | (s >> 8);
66876
+ s = s | (s >> 16);
66877
+ s = s | (s >> 32);
66878
+ return s - (s >> 1);
66879
+ };
66880
+ var toGridSize = function (grid, width, height, scale) {
66857
66881
  var canvas = Math.max(width, height);
66858
66882
  if (0 < grid) {
66883
+ grid *= toGridScale(scale);
66859
66884
  var minimum = canvas / 1000;
66860
66885
  for (var i = 0; i < 10 && grid < minimum; ++i) {
66861
66886
  grid *= 10;
@@ -66911,9 +66936,6 @@ var DThemeDarkDiagramCanvasEditor = /** @class */ (function (_super) {
66911
66936
  DThemeDarkDiagramCanvasEditor.prototype.getSnapGridSize = function () {
66912
66937
  return toGridSize;
66913
66938
  };
66914
- DThemeDarkDiagramCanvasEditor.prototype.isSnapGridAdaptive = function () {
66915
- return true;
66916
- };
66917
66939
  DThemeDarkDiagramCanvasEditor.prototype.getSnapTargetColor = function () {
66918
66940
  return DThemeDarkConstants.HIGHLIGHT_COLOR;
66919
66941
  };
@@ -87324,25 +87346,26 @@ var DDiagramCanvasEditorSnap = /** @class */ (function () {
87324
87346
  parent.addChildAt(container, parent.children.length - 1);
87325
87347
  // Grid
87326
87348
  this._grid = this.toGrid(theme, options.grid);
87327
- this._gridScale = this.toGridScale(parent.scale.x);
87349
+ this._gridParentWidth = parent.width;
87350
+ this._gridParentHeight = parent.height;
87351
+ this._gridParentScale = parent.scale.x;
87352
+ this._gridSize = this.newGridSize();
87328
87353
  // Target
87329
87354
  this._target = this.toTarget(theme, options.target);
87330
87355
  }
87331
87356
  DDiagramCanvasEditorSnap.prototype.toGrid = function (theme, options) {
87332
- var _a, _b;
87357
+ var _a;
87333
87358
  if (options != null) {
87334
87359
  return {
87335
87360
  major: this.toGridMajor(theme, options.major),
87336
87361
  minor: this.toGridMinor(theme, options.minor),
87337
- size: (_a = options.size) !== null && _a !== void 0 ? _a : theme.getSnapGridSize(),
87338
- adaptive: (_b = options.adaptive) !== null && _b !== void 0 ? _b : theme.isSnapGridAdaptive()
87362
+ size: (_a = options.size) !== null && _a !== void 0 ? _a : theme.getSnapGridSize()
87339
87363
  };
87340
87364
  }
87341
87365
  return {
87342
87366
  major: this.toGridMajor(theme),
87343
87367
  minor: this.toGridMinor(theme),
87344
- size: theme.getSnapGridSize(),
87345
- adaptive: theme.isSnapGridAdaptive()
87368
+ size: theme.getSnapGridSize()
87346
87369
  };
87347
87370
  };
87348
87371
  DDiagramCanvasEditorSnap.prototype.toGridMajor = function (theme, options) {
@@ -87413,25 +87436,23 @@ var DDiagramCanvasEditorSnap = /** @class */ (function () {
87413
87436
  return this._controller.serialize();
87414
87437
  };
87415
87438
  DDiagramCanvasEditorSnap.prototype.onResize = function (newWidth, newHeight, oldWidth, oldHeight) {
87416
- this._isDirty = true;
87439
+ this._gridParentWidth = newWidth;
87440
+ this._gridParentHeight = newHeight;
87441
+ this.updateGridSize();
87417
87442
  };
87418
87443
  DDiagramCanvasEditorSnap.prototype.onScale = function (newX, newY, oldX, oldY) {
87419
- var gridScale = this.toGridScale(newX);
87420
- if (this._gridScale !== gridScale) {
87421
- this._gridScale = gridScale;
87444
+ this._gridParentScale = newX;
87445
+ this.updateGridSize();
87446
+ };
87447
+ DDiagramCanvasEditorSnap.prototype.updateGridSize = function () {
87448
+ var gridSize = this.newGridSize();
87449
+ if (this._gridSize !== gridSize) {
87450
+ this._gridSize = gridSize;
87422
87451
  this._isDirty = true;
87423
87452
  }
87424
87453
  };
87425
- DDiagramCanvasEditorSnap.prototype.toGridScale = function (sx) {
87426
- if (!this._grid.adaptive || sx <= 0 || 1 <= sx) {
87427
- return 1;
87428
- }
87429
- var target = 1 / sx;
87430
- var result = 1;
87431
- while (result < target && result < Number.MAX_SAFE_INTEGER) {
87432
- result <<= 1;
87433
- }
87434
- return result;
87454
+ DDiagramCanvasEditorSnap.prototype.newGridSize = function () {
87455
+ return this._grid.size(this._controller.grid.size, this._gridParentWidth, this._gridParentHeight, this._gridParentScale);
87435
87456
  };
87436
87457
  DDiagramCanvasEditorSnap.prototype.onRender = function () {
87437
87458
  if (this._isDirty) {
@@ -87440,14 +87461,13 @@ var DDiagramCanvasEditorSnap = /** @class */ (function () {
87440
87461
  }
87441
87462
  };
87442
87463
  DDiagramCanvasEditorSnap.prototype.updateAll = function () {
87443
- var parent = this._parent;
87444
87464
  var container = this._container;
87445
87465
  var controller = this._controller;
87446
87466
  var isGridVisible = controller.grid.visible;
87447
87467
  var isTargetVisible = controller.target.visible;
87448
87468
  if (isGridVisible || isTargetVisible) {
87449
- var w = parent.width;
87450
- var h = parent.height;
87469
+ var w = this._gridParentWidth;
87470
+ var h = this._gridParentHeight;
87451
87471
  var wh = 0.5 * w;
87452
87472
  var hh = 0.5 * h;
87453
87473
  var TOP = EShapeBarPosition.TOP;
@@ -87460,7 +87480,7 @@ var DDiagramCanvasEditorSnap = /** @class */ (function () {
87460
87480
  var major = grid.major;
87461
87481
  var minor = grid.minor;
87462
87482
  var interval = major.interval;
87463
- var size = grid.size(controller.grid.size * this._gridScale, w, h);
87483
+ var size = this._gridSize;
87464
87484
  for (var x = size, ix = 1; x < w; x += size, ix += 1, index += 1) {
87465
87485
  var style = ix % interval === 0 ? major : minor;
87466
87486
  this.update(container, shapes, index, x, hh, TOP, w, h, style);
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.432.0
2
+ Winter Cardinal UI v0.434.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -66157,25 +66157,26 @@
66157
66157
  parent.addChildAt(container, parent.children.length - 1);
66158
66158
  // Grid
66159
66159
  this._grid = this.toGrid(theme, options.grid);
66160
- this._gridScale = this.toGridScale(parent.scale.x);
66160
+ this._gridParentWidth = parent.width;
66161
+ this._gridParentHeight = parent.height;
66162
+ this._gridParentScale = parent.scale.x;
66163
+ this._gridSize = this.newGridSize();
66161
66164
  // Target
66162
66165
  this._target = this.toTarget(theme, options.target);
66163
66166
  }
66164
66167
  DDiagramCanvasEditorSnap.prototype.toGrid = function (theme, options) {
66165
- var _a, _b;
66168
+ var _a;
66166
66169
  if (options != null) {
66167
66170
  return {
66168
66171
  major: this.toGridMajor(theme, options.major),
66169
66172
  minor: this.toGridMinor(theme, options.minor),
66170
- size: (_a = options.size) !== null && _a !== void 0 ? _a : theme.getSnapGridSize(),
66171
- adaptive: (_b = options.adaptive) !== null && _b !== void 0 ? _b : theme.isSnapGridAdaptive()
66173
+ size: (_a = options.size) !== null && _a !== void 0 ? _a : theme.getSnapGridSize()
66172
66174
  };
66173
66175
  }
66174
66176
  return {
66175
66177
  major: this.toGridMajor(theme),
66176
66178
  minor: this.toGridMinor(theme),
66177
- size: theme.getSnapGridSize(),
66178
- adaptive: theme.isSnapGridAdaptive()
66179
+ size: theme.getSnapGridSize()
66179
66180
  };
66180
66181
  };
66181
66182
  DDiagramCanvasEditorSnap.prototype.toGridMajor = function (theme, options) {
@@ -66246,25 +66247,23 @@
66246
66247
  return this._controller.serialize();
66247
66248
  };
66248
66249
  DDiagramCanvasEditorSnap.prototype.onResize = function (newWidth, newHeight, oldWidth, oldHeight) {
66249
- this._isDirty = true;
66250
+ this._gridParentWidth = newWidth;
66251
+ this._gridParentHeight = newHeight;
66252
+ this.updateGridSize();
66250
66253
  };
66251
66254
  DDiagramCanvasEditorSnap.prototype.onScale = function (newX, newY, oldX, oldY) {
66252
- var gridScale = this.toGridScale(newX);
66253
- if (this._gridScale !== gridScale) {
66254
- this._gridScale = gridScale;
66255
+ this._gridParentScale = newX;
66256
+ this.updateGridSize();
66257
+ };
66258
+ DDiagramCanvasEditorSnap.prototype.updateGridSize = function () {
66259
+ var gridSize = this.newGridSize();
66260
+ if (this._gridSize !== gridSize) {
66261
+ this._gridSize = gridSize;
66255
66262
  this._isDirty = true;
66256
66263
  }
66257
66264
  };
66258
- DDiagramCanvasEditorSnap.prototype.toGridScale = function (sx) {
66259
- if (!this._grid.adaptive || sx <= 0 || 1 <= sx) {
66260
- return 1;
66261
- }
66262
- var target = 1 / sx;
66263
- var result = 1;
66264
- while (result < target && result < Number.MAX_SAFE_INTEGER) {
66265
- result <<= 1;
66266
- }
66267
- return result;
66265
+ DDiagramCanvasEditorSnap.prototype.newGridSize = function () {
66266
+ return this._grid.size(this._controller.grid.size, this._gridParentWidth, this._gridParentHeight, this._gridParentScale);
66268
66267
  };
66269
66268
  DDiagramCanvasEditorSnap.prototype.onRender = function () {
66270
66269
  if (this._isDirty) {
@@ -66273,14 +66272,13 @@
66273
66272
  }
66274
66273
  };
66275
66274
  DDiagramCanvasEditorSnap.prototype.updateAll = function () {
66276
- var parent = this._parent;
66277
66275
  var container = this._container;
66278
66276
  var controller = this._controller;
66279
66277
  var isGridVisible = controller.grid.visible;
66280
66278
  var isTargetVisible = controller.target.visible;
66281
66279
  if (isGridVisible || isTargetVisible) {
66282
- var w = parent.width;
66283
- var h = parent.height;
66280
+ var w = this._gridParentWidth;
66281
+ var h = this._gridParentHeight;
66284
66282
  var wh = 0.5 * w;
66285
66283
  var hh = 0.5 * h;
66286
66284
  var TOP = EShapeBarPosition.TOP;
@@ -66293,7 +66291,7 @@
66293
66291
  var major = grid.major;
66294
66292
  var minor = grid.minor;
66295
66293
  var interval = major.interval;
66296
- var size = grid.size(controller.grid.size * this._gridScale, w, h);
66294
+ var size = this._gridSize;
66297
66295
  for (var x = size, ix = 1; x < w; x += size, ix += 1, index += 1) {
66298
66296
  var style = ix % interval === 0 ? major : minor;
66299
66297
  this.update(container, shapes, index, x, hh, TOP, w, h, style);