x4js 1.5.32 → 1.5.33

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.
package/lib/src/icon.ts CHANGED
@@ -36,6 +36,14 @@ import { BasicEvent, EvChange, EventMap, EventSource } from './x4events';
36
36
  // [ICON]
37
37
  // ============================================================================
38
38
 
39
+ /**
40
+ * iconID can be:
41
+ * - "url( <path to image> )" ex: "url(my/path/to/my/image.svg)"
42
+ * - "var( <css variable> )"
43
+ * - "cls( <font class> )"
44
+ * - "char( <character> )" ex: "font-char( \uf00d )"
45
+ */
46
+
39
47
  export type IconID = string | number;
40
48
 
41
49
  export interface IconProps extends CProps {
@@ -245,6 +253,17 @@ export class Icon extends Component<IconProps>
245
253
  this._setSVG( url );
246
254
  return;
247
255
  }
256
+
257
+ // url( "www.google.com" )
258
+ //
259
+ const reChar = /\s*font-char\s*\(\s*(.+)\s*\)\s*/gi;
260
+ let match_char = reChar.exec( icon );
261
+ if( match_char ) {
262
+ this.removeClass( '@svg-icon' );
263
+ this.setContent( match_char[1], false );
264
+ return;
265
+ }
266
+
248
267
  else {
249
268
  // todo: deprecated
250
269
  console.error( "deprecation error: invalid icon name" );
@@ -68,7 +68,7 @@ function clean( a, ...b ) {
68
68
  *
69
69
  */
70
70
 
71
- abstract class SVGItem {
71
+ export abstract class SVGItem {
72
72
  private m_tag: string
73
73
  private m_attrs: Map<string,string>;
74
74
  private m_style: Map<string,string>;
@@ -242,7 +242,7 @@ abstract class SVGItem {
242
242
  *
243
243
  */
244
244
 
245
- class SVGPath extends SVGItem {
245
+ export class SVGPath extends SVGItem {
246
246
  private m_path: string;
247
247
 
248
248
  constructor( ) {
@@ -314,7 +314,7 @@ class SVGPath extends SVGItem {
314
314
  *
315
315
  */
316
316
 
317
- class SVGText extends SVGItem {
317
+ export class SVGText extends SVGItem {
318
318
 
319
319
  private m_text;
320
320
 
@@ -377,7 +377,7 @@ class SVGText extends SVGItem {
377
377
  *
378
378
  */
379
379
 
380
- class SVGShape extends SVGItem {
380
+ export class SVGShape extends SVGItem {
381
381
  constructor( tag: string ) {
382
382
  super( tag );
383
383
  }
@@ -389,7 +389,7 @@ class SVGShape extends SVGItem {
389
389
 
390
390
  type number_or_perc = number | `${string}%`
391
391
 
392
- class SVGGradient extends SVGItem {
392
+ export class SVGGradient extends SVGItem {
393
393
 
394
394
  private static g_id = 1;
395
395
 
@@ -434,7 +434,7 @@ class SVGGradient extends SVGItem {
434
434
  *
435
435
  */
436
436
 
437
- class SVGGroup extends SVGItem {
437
+ export class SVGGroup extends SVGItem {
438
438
  protected m_items: SVGItem[];
439
439
 
440
440
  constructor( tag = "g" ) {
@@ -27,4 +27,4 @@
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
29
 
30
- export const x4js_version = "1.5.32";
30
+ export const x4js_version = "1.5.33";
@@ -28,6 +28,13 @@
28
28
  **/
29
29
  import { Component, CProps } from './component';
30
30
  import { BasicEvent } from './x4events';
31
+ /**
32
+ * iconID can be:
33
+ * - "url( <path to image> )" ex: "url(my/path/to/my/image.svg)"
34
+ * - "var( <css variable> )"
35
+ * - "cls( <font class> )"
36
+ * - "char( <character> )" ex: "font-char( \uf00d )"
37
+ */
31
38
  export type IconID = string | number;
32
39
  export interface IconProps extends CProps {
33
40
  icon: IconID;
@@ -30,7 +30,7 @@ import { Component, CProps } from './component';
30
30
  /**
31
31
  *
32
32
  */
33
- declare abstract class SVGItem {
33
+ export declare abstract class SVGItem {
34
34
  private m_tag;
35
35
  private m_attrs;
36
36
  private m_style;
@@ -98,7 +98,7 @@ declare abstract class SVGItem {
98
98
  /**
99
99
  *
100
100
  */
101
- declare class SVGPath extends SVGItem {
101
+ export declare class SVGPath extends SVGItem {
102
102
  private m_path;
103
103
  constructor();
104
104
  renderAttrs(): string;
@@ -134,7 +134,7 @@ declare class SVGPath extends SVGItem {
134
134
  /**
135
135
  *
136
136
  */
137
- declare class SVGText extends SVGItem {
137
+ export declare class SVGText extends SVGItem {
138
138
  private m_text;
139
139
  constructor(x: number, y: number, txt: string);
140
140
  font(font: string): this;
@@ -147,14 +147,14 @@ declare class SVGText extends SVGItem {
147
147
  /**
148
148
  *
149
149
  */
150
- declare class SVGShape extends SVGItem {
150
+ export declare class SVGShape extends SVGItem {
151
151
  constructor(tag: string);
152
152
  }
153
153
  /**
154
154
  *
155
155
  */
156
156
  type number_or_perc = number | `${string}%`;
157
- declare class SVGGradient extends SVGItem {
157
+ export declare class SVGGradient extends SVGItem {
158
158
  private static g_id;
159
159
  private m_id;
160
160
  private m_stops;
@@ -166,7 +166,7 @@ declare class SVGGradient extends SVGItem {
166
166
  /**
167
167
  *
168
168
  */
169
- declare class SVGGroup extends SVGItem {
169
+ export declare class SVGGroup extends SVGItem {
170
170
  protected m_items: SVGItem[];
171
171
  constructor(tag?: string);
172
172
  path(): SVGPath;
@@ -26,4 +26,4 @@
26
26
  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
- export declare const x4js_version = "1.5.32";
29
+ export declare const x4js_version = "1.5.33";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x4js",
3
- "version": "1.5.32",
3
+ "version": "1.5.33",
4
4
  "description": "X4js core files",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",