web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
2.7 KiB

  1. "use strict";
  2. exports.__esModule = true;
  3. exports.default = void 0;
  4. var _cssesc = _interopRequireDefault(require("cssesc"));
  5. var _util = require("../util");
  6. var _node = _interopRequireDefault(require("./node"));
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  9. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  10. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
  11. var Namespace =
  12. /*#__PURE__*/
  13. function (_Node) {
  14. _inheritsLoose(Namespace, _Node);
  15. function Namespace() {
  16. return _Node.apply(this, arguments) || this;
  17. }
  18. var _proto = Namespace.prototype;
  19. _proto.qualifiedName = function qualifiedName(value) {
  20. if (this.namespace) {
  21. return this.namespaceString + "|" + value;
  22. } else {
  23. return value;
  24. }
  25. };
  26. _proto.valueToString = function valueToString() {
  27. return this.qualifiedName(_Node.prototype.valueToString.call(this));
  28. };
  29. _createClass(Namespace, [{
  30. key: "namespace",
  31. get: function get() {
  32. return this._namespace;
  33. },
  34. set: function set(namespace) {
  35. if (namespace === true || namespace === "*" || namespace === "&") {
  36. this._namespace = namespace;
  37. if (this.raws) {
  38. delete this.raws.namespace;
  39. }
  40. return;
  41. }
  42. var escaped = (0, _cssesc.default)(namespace, {
  43. isIdentifier: true
  44. });
  45. this._namespace = namespace;
  46. if (escaped !== namespace) {
  47. (0, _util.ensureObject)(this, "raws");
  48. this.raws.namespace = escaped;
  49. } else if (this.raws) {
  50. delete this.raws.namespace;
  51. }
  52. }
  53. }, {
  54. key: "ns",
  55. get: function get() {
  56. return this._namespace;
  57. },
  58. set: function set(namespace) {
  59. this.namespace = namespace;
  60. }
  61. }, {
  62. key: "namespaceString",
  63. get: function get() {
  64. if (this.namespace) {
  65. var ns = this.stringifyProperty("namespace");
  66. if (ns === true) {
  67. return '';
  68. } else {
  69. return ns;
  70. }
  71. } else {
  72. return '';
  73. }
  74. }
  75. }]);
  76. return Namespace;
  77. }(_node.default);
  78. exports.default = Namespace;
  79. ;
  80. module.exports = exports.default;