@wcardinal/wcardinal-ui 0.298.0 → 0.300.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 (27) hide show
  1. package/dist/types/wcardinal/ui/d-diagram-serialized.d.ts +2 -0
  2. package/dist/types/wcardinal/ui/d-table-data-list-mapped.d.ts +1 -0
  3. package/dist/types/wcardinal/ui/d-table-data.d.ts +4 -0
  4. package/dist/types/wcardinal/ui/shape/e-shape-text.d.ts +2 -1
  5. package/dist/types/wcardinal/ui/shape/variant/build-text.d.ts +1 -1
  6. package/dist/types/wcardinal/ui/shape/variant/builder-text.d.ts +1 -0
  7. package/dist/types/wcardinal/ui/shape/variant/e-shape-text-impl.d.ts +4 -1
  8. package/dist/wcardinal/ui/d-diagram-serialized.js.map +1 -1
  9. package/dist/wcardinal/ui/d-table-data-list-mapped.js +11 -0
  10. package/dist/wcardinal/ui/d-table-data-list-mapped.js.map +1 -1
  11. package/dist/wcardinal/ui/d-table-data.js.map +1 -1
  12. package/dist/wcardinal/ui/shape/e-shape-text.js.map +1 -1
  13. package/dist/wcardinal/ui/shape/variant/build-text.js +56 -62
  14. package/dist/wcardinal/ui/shape/variant/build-text.js.map +1 -1
  15. package/dist/wcardinal/ui/shape/variant/builder-text.js +7 -2
  16. package/dist/wcardinal/ui/shape/variant/builder-text.js.map +1 -1
  17. package/dist/wcardinal/ui/shape/variant/e-shape-text-impl.js +26 -5
  18. package/dist/wcardinal/ui/shape/variant/e-shape-text-impl.js.map +1 -1
  19. package/dist/wcardinal-ui-theme-dark.js +1 -1
  20. package/dist/wcardinal-ui-theme-dark.min.js +1 -1
  21. package/dist/wcardinal-ui-theme-white.js +1 -1
  22. package/dist/wcardinal-ui-theme-white.min.js +1 -1
  23. package/dist/wcardinal-ui.cjs.js +100 -70
  24. package/dist/wcardinal-ui.js +100 -70
  25. package/dist/wcardinal-ui.min.js +2 -2
  26. package/dist/wcardinal-ui.min.js.map +1 -1
  27. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.298.0
2
+ Winter Cardinal UI v0.300.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -829,7 +829,7 @@
829
829
  return EShapeTextAlignVertical.OUTSIDE_TOP;
830
830
  }
831
831
  };
832
- var buildTextVertex = function (vertices, uvs, voffset, vcount, originX, originY, sizeX, sizeY, textAtlas, textSize, textValue, textStyle, textAlignHorizontal, textAlignVertical, textOffsetHorizontal, textOffsetVertical, textSpacingHorizontal, textSpacingVertical, textDirection, textPaddingHorizontal, textPaddingVertical, textClipping, textWorld, textureUvs, internalTransform) {
832
+ var buildTextVertex = function (vertices, uvs, voffset, vcount, originX, originY, sizeX, sizeY, textAtlas, textSize, textValue, textStyle, textAlignHorizontal, textAlignVertical, textOffsetHorizontal, textOffsetVertical, textSpacingHorizontal, textSpacingVertical, textDirection, textPaddingHorizontal, textPaddingVertical, textClipping, textFitting, textWorld, textureUvs, internalTransform) {
833
833
  // Calculate the transformed positions
834
834
  //
835
835
  // 0 1
@@ -919,6 +919,7 @@
919
919
  var textSizeY = textSize * vnl;
920
920
  var lineHeight = Math.max(0, textSize + textSpacingVertical) * vnl;
921
921
  var lineWidth = 0;
922
+ var lineCount = 1;
922
923
  var textAtlasCharacters = textAtlas.characters;
923
924
  var iterator = UtilCharacterIterator.from(textValue);
924
925
  var advancePrevious = 0;
@@ -943,16 +944,41 @@
943
944
  width = Math.max(width, lineWidth);
944
945
  lineWidth = 0;
945
946
  height += lineHeight;
947
+ lineCount += 1;
948
+ }
949
+ }
950
+ lineWidth += advancePrevious;
951
+ width = Math.max(width, lineWidth);
952
+ height += textSizeY;
953
+ lineWidth = 0;
954
+ if (textFitting && isIn(textAlignHorizontal, textAlignVertical)) {
955
+ var w0 = 0;
956
+ var h0 = 0;
957
+ switch (textDirection) {
958
+ case EShapeTextDirection.LEFT_TO_RIGHT:
959
+ case EShapeTextDirection.RIGHT_TO_LEFT:
960
+ w0 = Math.max(0, hl - textPaddingHorizontal * 2);
961
+ h0 = Math.max(0, vl - textPaddingVertical * 2);
962
+ break;
963
+ case EShapeTextDirection.TOP_TO_BOTTOM:
964
+ case EShapeTextDirection.BOTTOM_TO_TOP:
965
+ w0 = Math.max(0, vl - textPaddingVertical * 2);
966
+ h0 = Math.max(0, hl - textPaddingHorizontal * 2);
967
+ break;
946
968
  }
969
+ var w1 = width * hnl * (textSize / textAtlas.font.size);
970
+ var h1 = height;
971
+ var s = Math.min(1, Math.min(w0 / w1, h0 / h1));
972
+ textSize *= s;
973
+ textSizeY *= s;
974
+ lineHeight *= s;
975
+ height *= s;
947
976
  }
948
977
  var scaleZ = textSize / textAtlas.font.size;
949
978
  var scaleX = hnl * scaleZ;
950
979
  var scaleY = vnl * scaleZ;
951
- lineWidth += advancePrevious;
952
- width = Math.max(width, lineWidth) * scaleX;
953
- lineWidth = 0;
980
+ width *= scaleX;
954
981
  heightChar *= scaleY;
955
- height += textSizeY;
956
982
  //
957
983
  var tx0 = 0;
958
984
  var ty0 = 0;
@@ -962,80 +988,32 @@
962
988
  getTextBBox(textAlignHorizontal, textAlignVertical, textOffsetHorizontal, textOffsetVertical, textPaddingHorizontal, textPaddingVertical, width, height, x0, y0, x1, y1, x2, y2, x3, y3, hnx, hny, vnx, vny, work);
963
989
  tx0 = work.x;
964
990
  ty0 = work.y;
965
- if (textClipping) {
966
- switch (textAlignHorizontal) {
967
- case EShapeTextAlignHorizontal.LEFT:
968
- case EShapeTextAlignHorizontal.CENTER:
969
- case EShapeTextAlignHorizontal.RIGHT:
970
- switch (textAlignVertical) {
971
- case EShapeTextAlignVertical.TOP:
972
- case EShapeTextAlignVertical.MIDDLE:
973
- case EShapeTextAlignVertical.BOTTOM:
974
- lineWidthMaximum = hl - textPaddingHorizontal * 2;
975
- break;
976
- }
977
- break;
978
- }
991
+ if (textClipping && isIn(textAlignHorizontal, textAlignVertical)) {
992
+ lineWidthMaximum = hl - textPaddingHorizontal * 2;
979
993
  }
980
994
  break;
981
995
  case EShapeTextDirection.TOP_TO_BOTTOM:
982
996
  getTextBBox(rotateAlignVerticalRight(textAlignVertical), rotateAlignHorizontalRight(textAlignHorizontal), textOffsetVertical, textOffsetHorizontal, textPaddingVertical, textPaddingHorizontal, width, height, x1, y1, x2, y2, x3, y3, x0, y0, hnx, hny, vnx, vny, work);
983
997
  tx0 = work.x;
984
998
  ty0 = work.y;
985
- if (textClipping) {
986
- switch (textAlignVertical) {
987
- case EShapeTextAlignVertical.TOP:
988
- case EShapeTextAlignVertical.MIDDLE:
989
- case EShapeTextAlignVertical.BOTTOM:
990
- switch (textAlignHorizontal) {
991
- case EShapeTextAlignHorizontal.LEFT:
992
- case EShapeTextAlignHorizontal.CENTER:
993
- case EShapeTextAlignHorizontal.RIGHT:
994
- lineWidthMaximum = vl - textPaddingVertical * 2;
995
- break;
996
- }
997
- break;
998
- }
999
+ if (textClipping && isIn(textAlignHorizontal, textAlignVertical)) {
1000
+ lineWidthMaximum = vl - textPaddingVertical * 2;
999
1001
  }
1000
1002
  break;
1001
1003
  case EShapeTextDirection.BOTTOM_TO_TOP:
1002
1004
  getTextBBox(rotateAlignVerticalLeft(textAlignVertical), rotateAlignHorizontalLeft(textAlignHorizontal), textOffsetVertical, textOffsetHorizontal, textPaddingVertical, textPaddingHorizontal, width, height, x3, y3, x0, y0, x1, y1, x2, y2, hnx, hny, vnx, vny, work);
1003
1005
  tx0 = work.x;
1004
1006
  ty0 = work.y;
1005
- if (textClipping) {
1006
- switch (textAlignVertical) {
1007
- case EShapeTextAlignVertical.TOP:
1008
- case EShapeTextAlignVertical.MIDDLE:
1009
- case EShapeTextAlignVertical.BOTTOM:
1010
- switch (textAlignHorizontal) {
1011
- case EShapeTextAlignHorizontal.LEFT:
1012
- case EShapeTextAlignHorizontal.CENTER:
1013
- case EShapeTextAlignHorizontal.RIGHT:
1014
- lineWidthMaximum = vl - textPaddingVertical * 2;
1015
- break;
1016
- }
1017
- break;
1018
- }
1007
+ if (textClipping && isIn(textAlignHorizontal, textAlignVertical)) {
1008
+ lineWidthMaximum = vl - textPaddingVertical * 2;
1019
1009
  }
1020
1010
  break;
1021
1011
  case EShapeTextDirection.RIGHT_TO_LEFT:
1022
1012
  getTextBBox(invertAlignHorizontal(textAlignHorizontal), invertAlignVertical(textAlignVertical), textOffsetHorizontal, textOffsetVertical, textPaddingHorizontal, textPaddingVertical, width, height, x2, y2, x3, y3, x0, y0, x1, y1, hnx, hny, vnx, vny, work);
1023
1013
  tx0 = work.x;
1024
1014
  ty0 = work.y;
1025
- if (textClipping) {
1026
- switch (textAlignHorizontal) {
1027
- case EShapeTextAlignHorizontal.LEFT:
1028
- case EShapeTextAlignHorizontal.CENTER:
1029
- case EShapeTextAlignHorizontal.RIGHT:
1030
- switch (textAlignVertical) {
1031
- case EShapeTextAlignVertical.TOP:
1032
- case EShapeTextAlignVertical.MIDDLE:
1033
- case EShapeTextAlignVertical.BOTTOM:
1034
- lineWidthMaximum = hl - textPaddingHorizontal * 2;
1035
- break;
1036
- }
1037
- break;
1038
- }
1015
+ if (textClipping && isIn(textAlignHorizontal, textAlignVertical)) {
1016
+ lineWidthMaximum = hl - textPaddingHorizontal * 2;
1039
1017
  }
1040
1018
  break;
1041
1019
  }
@@ -1096,7 +1074,7 @@
1096
1074
  lineWidth = 0;
1097
1075
  advancePrevious = 0;
1098
1076
  iterator.position = 0;
1099
- var lineCount = 0;
1077
+ lineCount = 0;
1100
1078
  var iv = voffset * 2;
1101
1079
  for (; iterator.hasNext(); iv += 8) {
1102
1080
  var character = iterator.next();
@@ -1184,6 +1162,21 @@
1184
1162
  uvs[iv + 1] = uvy0;
1185
1163
  }
1186
1164
  };
1165
+ var isIn = function (textAlignHorizontal, textAlignVertical) {
1166
+ switch (textAlignHorizontal) {
1167
+ case EShapeTextAlignHorizontal.LEFT:
1168
+ case EShapeTextAlignHorizontal.CENTER:
1169
+ case EShapeTextAlignHorizontal.RIGHT:
1170
+ switch (textAlignVertical) {
1171
+ case EShapeTextAlignVertical.TOP:
1172
+ case EShapeTextAlignVertical.MIDDLE:
1173
+ case EShapeTextAlignVertical.BOTTOM:
1174
+ return true;
1175
+ }
1176
+ break;
1177
+ }
1178
+ return false;
1179
+ };
1187
1180
  var writeCharacterEmpty = function (vertices, uvs, iv, cx0, cy0, cx3, cy3, uvx0, uvy0, uvx3, uvy3) {
1188
1181
  vertices[iv + 0] = cx0;
1189
1182
  vertices[iv + 1] = cy0;
@@ -7248,6 +7241,7 @@
7248
7241
  this._direction = EShapeTextDirection.LEFT_TO_RIGHT;
7249
7242
  this.padding = new EShapeTextOffsetImpl(parent, 10, 10);
7250
7243
  this._clipping = false;
7244
+ this._fitting = false;
7251
7245
  }
7252
7246
  Object.defineProperty(EShapeTextImpl.prototype, "enable", {
7253
7247
  get: function () {
@@ -7406,9 +7400,22 @@
7406
7400
  enumerable: false,
7407
7401
  configurable: true
7408
7402
  });
7403
+ Object.defineProperty(EShapeTextImpl.prototype, "fitting", {
7404
+ get: function () {
7405
+ return this._fitting;
7406
+ },
7407
+ set: function (fitting) {
7408
+ if (this._fitting !== fitting) {
7409
+ this._fitting = fitting;
7410
+ this._parent.updateUploaded();
7411
+ }
7412
+ },
7413
+ enumerable: false,
7414
+ configurable: true
7415
+ });
7409
7416
  EShapeTextImpl.prototype.copy = function (target) {
7410
7417
  if (target) {
7411
- this.set(target.value, target.color, target.alpha, target.family, target.size, target.weight, target.style, target.direction, target.clipping);
7418
+ this.set(target.value, target.color, target.alpha, target.family, target.size, target.weight, target.style, target.direction, target.clipping, target.fitting);
7412
7419
  this.align.copy(target.align);
7413
7420
  this.offset.copy(target.offset);
7414
7421
  this.outline.copy(target.outline);
@@ -7417,7 +7424,7 @@
7417
7424
  }
7418
7425
  return this;
7419
7426
  };
7420
- EShapeTextImpl.prototype.set = function (value, color, alpha, family, size, weight, style, direction, clipping) {
7427
+ EShapeTextImpl.prototype.set = function (value, color, alpha, family, size, weight, style, direction, clipping, fitting) {
7421
7428
  var isChangedDirty = false;
7422
7429
  var isChangedUploaded = false;
7423
7430
  if (value != null && this._value !== value) {
@@ -7456,6 +7463,10 @@
7456
7463
  this._clipping = clipping;
7457
7464
  isChangedUploaded = true;
7458
7465
  }
7466
+ if (fitting != null && this._fitting !== fitting) {
7467
+ this._fitting = fitting;
7468
+ isChangedUploaded = true;
7469
+ }
7459
7470
  if (isChangedDirty) {
7460
7471
  this._parent.toDirty();
7461
7472
  }
@@ -7479,7 +7490,8 @@
7479
7490
  direction: this._direction,
7480
7491
  spacing: this.spacing.toObject(),
7481
7492
  padding: this.padding.toObject(),
7482
- clipping: this._clipping
7493
+ clipping: this._clipping,
7494
+ fitting: this._fitting
7483
7495
  };
7484
7496
  };
7485
7497
  EShapeTextImpl.prototype.serialize = function (manager) {
@@ -7490,9 +7502,11 @@
7490
7502
  var outlineId = this.outline.serialize(manager);
7491
7503
  var spacingId = this.spacing.serialize(manager);
7492
7504
  var paddingId = this.padding.serialize(manager);
7505
+ var clipping = this._clipping ? 1 : 0;
7506
+ var fitting = this._fitting ? 1 : 0;
7493
7507
  var serialized = "[".concat(valueId, ",").concat(this._color, ",").concat(this._alpha, ",").concat(familyId, ",").concat(this._size, ",") +
7494
7508
  "".concat(this._weight, ",").concat(alignId, ",").concat(offsetId, ",").concat(this._style, ",").concat(outlineId, ",") +
7495
- "".concat(spacingId, ",").concat(this._direction, ",").concat(paddingId, ",").concat(this._clipping ? 1 : 0, "]");
7509
+ "".concat(spacingId, ",").concat(this._direction, ",").concat(paddingId, ",").concat(clipping, ",").concat(fitting, "]");
7496
7510
  return manager.addResource(serialized);
7497
7511
  };
7498
7512
  EShapeTextImpl.prototype.deserialize = function (target, manager) {
@@ -7503,7 +7517,7 @@
7503
7517
  parsed = JSON.parse(resources[target]);
7504
7518
  manager.setText(target, parsed);
7505
7519
  }
7506
- this.set(resources[parsed[0]] || "", parsed[1], parsed[2], resources[parsed[3]] || "auto", parsed[4], parsed[5], parsed[8], parsed[11], !!parsed[13]);
7520
+ this.set(resources[parsed[0]] || "", parsed[1], parsed[2], resources[parsed[3]] || "auto", parsed[4], parsed[5], parsed[8], parsed[11], !!parsed[13], !!parsed[14]);
7507
7521
  this.align.deserialize(parsed[6], manager);
7508
7522
  this.offset.deserialize(parsed[7], manager);
7509
7523
  this.outline.deserialize(parsed[9], manager);
@@ -8083,6 +8097,7 @@
8083
8097
  this.paddingHorizontal = NaN;
8084
8098
  this.paddingVertical = NaN;
8085
8099
  this.clipping = false;
8100
+ this.fitting = false;
8086
8101
  }
8087
8102
  BuilderText.prototype.init = function (buffer) {
8088
8103
  var vcount = this.vertexCount;
@@ -8133,6 +8148,7 @@
8133
8148
  var textPaddingHorizontal = text.padding.horizontal;
8134
8149
  var textPaddingVertical = text.padding.vertical;
8135
8150
  var textClipping = text.clipping;
8151
+ var textFitting = text.fitting;
8136
8152
  var textTexture = text.texture || pixi_js.Texture.WHITE;
8137
8153
  var textTextureTransformId = toTextureTransformId(textTexture);
8138
8154
  var isCharChanged = textValue !== this.value || textFamily !== this.family;
@@ -8148,6 +8164,7 @@
8148
8164
  textPaddingVertical !== this.paddingVertical;
8149
8165
  var isCharDirectionChanged = textDirection !== this.direction;
8150
8166
  var isClippingChanged = this.clipping !== textClipping;
8167
+ var isFittingChanged = this.fitting !== textFitting;
8151
8168
  var isTextureChanged = textTexture !== this.texture || textTextureTransformId !== this.textureTransformId;
8152
8169
  if (isSizeChanged ||
8153
8170
  isTransformChanged ||
@@ -8159,6 +8176,7 @@
8159
8176
  isCharSpacingChanged ||
8160
8177
  isCharDirectionChanged ||
8161
8178
  isClippingChanged ||
8179
+ isFittingChanged ||
8162
8180
  isTextureChanged) {
8163
8181
  this.size = textSize;
8164
8182
  this.family = textFamily;
@@ -8174,9 +8192,10 @@
8174
8192
  this.paddingHorizontal = textPaddingHorizontal;
8175
8193
  this.paddingVertical = textPaddingVertical;
8176
8194
  this.clipping = textClipping;
8195
+ this.fitting = textFitting;
8177
8196
  this.texture = textTexture;
8178
8197
  this.textureTransformId = textTextureTransformId;
8179
- if (isCharSizeChanged) {
8198
+ if (isCharSizeChanged || isFittingChanged || (textFitting && isSizeChanged)) {
8180
8199
  // Invalidate the text weight to update the text steps.
8181
8200
  this.weight = NaN;
8182
8201
  }
@@ -8189,7 +8208,7 @@
8189
8208
  textWorld = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0];
8190
8209
  text.world = textWorld;
8191
8210
  }
8192
- buildTextVertex(buffer.vertices, buffer.uvs, this.vertexOffset, this.vertexCount, 0, 0, shapeSize.x, shapeSize.y, textAtlas, textSize, textValue, textStyle, textAlignHorizontal, textAlignVertical, textOffsetHorizontal, textOffsetVertical, textSpacingHorizontal, textSpacingVertical, textDirection, textPaddingHorizontal, textPaddingVertical, textClipping, textWorld, toTextureUvs(textTexture), shape.transform.internalTransform);
8211
+ buildTextVertex(buffer.vertices, buffer.uvs, this.vertexOffset, this.vertexCount, 0, 0, shapeSize.x, shapeSize.y, textAtlas, textSize, textValue, textStyle, textAlignHorizontal, textAlignVertical, textOffsetHorizontal, textOffsetVertical, textSpacingHorizontal, textSpacingVertical, textDirection, textPaddingHorizontal, textPaddingVertical, textClipping, textFitting, textWorld, toTextureUvs(textTexture), shape.transform.internalTransform);
8193
8212
  }
8194
8213
  };
8195
8214
  BuilderText.prototype.updateColorFill = function (buffer, shape) {
@@ -68403,6 +68422,17 @@
68403
68422
  function DTableDataListMapped(parent) {
68404
68423
  this._parent = parent;
68405
68424
  }
68425
+ Object.defineProperty(DTableDataListMapped.prototype, "rows", {
68426
+ get: function () {
68427
+ var result = [];
68428
+ this.each(function (row) {
68429
+ result.push(row);
68430
+ });
68431
+ return result;
68432
+ },
68433
+ enumerable: false,
68434
+ configurable: true
68435
+ });
68406
68436
  DTableDataListMapped.prototype.map = function (unmappedIndex) {
68407
68437
  var parent = this._parent;
68408
68438
  var sortedIndex = parent.sorter.map(unmappedIndex);