@ui0/icon 0.0.0-stage → 0.1.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.
- package/dist/defaults.d.ts +14 -0
- package/dist/defaults.d.ts.map +1 -0
- package/dist/framework.d.ts +30 -0
- package/dist/framework.d.ts.map +1 -0
- package/dist/getIcon.d.ts +3 -0
- package/dist/getIcon.d.ts.map +1 -0
- package/dist/helpers.d.ts +32 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/icon.config.d.ts +22 -0
- package/dist/icon.config.d.ts.map +1 -0
- package/dist/icon.d.ts +26 -0
- package/dist/icon.d.ts.map +1 -0
- package/dist/icon.module.css +21 -0
- package/dist/icon.vue.d.ts +5 -0
- package/dist/icon.vue.d.ts.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +496 -0
- package/dist/keys.d.ts +5 -0
- package/dist/keys.d.ts.map +1 -0
- package/dist/plugin.d.ts +23 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/style.css +1 -0
- package/dist/types.d.ts +218 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/ui0/index.d.ts +8 -0
- package/dist/ui0/index.d.ts.map +1 -0
- package/dist/ui0/index.js +19 -0
- package/dist/util.d.ts +33 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/vite/blocks/index.d.ts +9 -0
- package/dist/vite/blocks/index.d.ts.map +1 -0
- package/dist/vite/compose.d.ts +68 -0
- package/dist/vite/compose.d.ts.map +1 -0
- package/dist/vite/index.d.ts +6 -0
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/index.js +829 -0
- package/dist/vite/options.d.ts +51 -0
- package/dist/vite/options.d.ts.map +1 -0
- package/dist/vite/transformer.d.ts +47 -0
- package/dist/vite/transformer.d.ts.map +1 -0
- package/dist/vite/types.d.ts +57 -0
- package/dist/vite/types.d.ts.map +1 -0
- package/dist/vite/util.d.ts +66 -0
- package/dist/vite/util.d.ts.map +1 -0
- package/dist/vite/xml-parser.d.ts +48 -0
- package/dist/vite/xml-parser.d.ts.map +1 -0
- package/package.json +64 -4
- package/README.md +0 -3
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { IconTransformerOptions } from './transformer';
|
|
2
|
+
import type { IconVirtualOptions } from './types';
|
|
3
|
+
export type IconLoaderFit = boolean | [number, number, number?];
|
|
4
|
+
/**
|
|
5
|
+
* A pack source by name: a directory of svg files, an icons dictionary, or a
|
|
6
|
+
* host-provided pack module (see example.ts). How a module pack yields its
|
|
7
|
+
* svg content is up to the loader implementation.
|
|
8
|
+
*/
|
|
9
|
+
export type IconLoaderPack = string | Record<string, unknown> | ((...args: never[]) => unknown);
|
|
10
|
+
/**
|
|
11
|
+
* Options of the `?icon` vite loader (ViteUi0Icon).
|
|
12
|
+
*
|
|
13
|
+
* The config is plain data - see example.ts for the full annotated sample.
|
|
14
|
+
* Icon sources resolve by query name ('<pack>/<icon>'):
|
|
15
|
+
* - 'blocks/<name>' - the built-in blocks pack, embedded in the plugin
|
|
16
|
+
* - `dir` directories - each becomes a pack named after its folder
|
|
17
|
+
* - pack names from `packs` - explicit sources, win for their own names
|
|
18
|
+
* - names from `virtual` - consumer compositions and template sheets
|
|
19
|
+
* - `sources` directories - file-backed pack icons ('ui0/arrow' etc.)
|
|
20
|
+
*/
|
|
21
|
+
export interface IconLoaderOptions {
|
|
22
|
+
/**
|
|
23
|
+
* Fit the icons. if 2 value, then default = 1, if 3 value, - default = fit[1]
|
|
24
|
+
*/
|
|
25
|
+
fit?: IconLoaderFit;
|
|
26
|
+
include?: string | string[];
|
|
27
|
+
exclude?: string | string[];
|
|
28
|
+
/**
|
|
29
|
+
* Consumer directories of svg files: every folder becomes a pack named
|
|
30
|
+
* after it ('./src/assets/' -> 'assets/hexagon' etc.)
|
|
31
|
+
*/
|
|
32
|
+
dir?: string | string[];
|
|
33
|
+
/**
|
|
34
|
+
* Dynamically composed icons (see ./types.ts): template sheets (`file`)
|
|
35
|
+
* and compositions (`cells`), addressed by name like pack icons.
|
|
36
|
+
*/
|
|
37
|
+
virtual?: IconVirtualOptions;
|
|
38
|
+
/**
|
|
39
|
+
* Named packs: 'my/arrow' resolves through packs.my. Directory packs map to
|
|
40
|
+
* '<dir>/arrow.svg' and take precedence over the built-in 'blocks' pack
|
|
41
|
+
* and the `virtual` registry for their own pack names.
|
|
42
|
+
*/
|
|
43
|
+
packs?: Record<string, IconLoaderPack>;
|
|
44
|
+
/**
|
|
45
|
+
* Directories probed for a source icon file when a composition references
|
|
46
|
+
* a bare pack value ('ui0/arrow' -> '<dir>/arrow.svg').
|
|
47
|
+
*/
|
|
48
|
+
sources?: string[];
|
|
49
|
+
icons?: Record<string, IconTransformerOptions>;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/vite/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAEjD,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;AAE/D;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,OAAO,CAAC,CAAA;AAE/F;;;;;;;;;;GAUG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,GAAG,CAAC,EAAE,aAAa,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC3B;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,kBAAkB,CAAA;IAC5B;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;IACtC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAA;CAC/C"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type SVGLine, type SVGRect } from './util';
|
|
2
|
+
type VueSFC = Record<'template' | 'style' | 'script', string>;
|
|
3
|
+
type VueCompiledSFC = string;
|
|
4
|
+
type IconFlag = 'accent' | 'progress' | 'animation' | 'modifiers' | 'no-fit' | 'no-progress' | 'no-fill' | 'no-stroke' | 'no-rescale' | 'always-stroke' | 'always-fill' | 'no-process-stroke' | 'composed' | string;
|
|
5
|
+
interface IconOptions {
|
|
6
|
+
flags: IconFlag[];
|
|
7
|
+
modifiers: string[];
|
|
8
|
+
layers: string[];
|
|
9
|
+
paintNodesCount: number;
|
|
10
|
+
}
|
|
11
|
+
export interface IconTransformerOptions {
|
|
12
|
+
fit?: boolean | 'default' | 'small' | 'large' | [number, number, number?];
|
|
13
|
+
process?: boolean;
|
|
14
|
+
rescaling?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export type IconVirtualGridRows = 1 | 2 | 3 | 4;
|
|
17
|
+
export type IconVirtualGridColumns = 1 | 2 | 3 | 4;
|
|
18
|
+
export type IconFeatures = {
|
|
19
|
+
modifiers: string[];
|
|
20
|
+
noProgress: boolean;
|
|
21
|
+
noFit: boolean;
|
|
22
|
+
noFill: boolean;
|
|
23
|
+
noStroke: boolean;
|
|
24
|
+
noAnimate: boolean;
|
|
25
|
+
noProcessing: boolean;
|
|
26
|
+
};
|
|
27
|
+
export type IconFitData = Record<'default' | 'small' | 'large', string | SVGLine | SVGRect>[];
|
|
28
|
+
export declare class IconTransformer {
|
|
29
|
+
options: IconTransformerOptions;
|
|
30
|
+
name: string;
|
|
31
|
+
result: Record<string, {
|
|
32
|
+
sfc: VueSFC;
|
|
33
|
+
options: IconOptions;
|
|
34
|
+
}>;
|
|
35
|
+
constructor(options?: IconTransformerOptions);
|
|
36
|
+
process(name: string, code?: string | undefined, _options?: IconTransformerOptions): VueSFC;
|
|
37
|
+
render(name: string): VueCompiledSFC;
|
|
38
|
+
private processBoxScaling;
|
|
39
|
+
private processNode;
|
|
40
|
+
private processNodesIfModifiers;
|
|
41
|
+
private processPointNodes;
|
|
42
|
+
private processRendering;
|
|
43
|
+
private processFit;
|
|
44
|
+
private processFeatures;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=transformer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformer.d.ts","sourceRoot":"","sources":["../../src/vite/transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkD,KAAK,OAAO,EAAE,KAAK,OAAO,EAAa,MAAM,QAAQ,CAAA;AAG9G,KAAK,MAAM,GAAG,MAAM,CAAC,UAAU,GAAG,OAAO,GAAG,QAAQ,EAAE,MAAM,CAAC,CAAA;AAC7D,KAAK,cAAc,GAAG,MAAM,CAAA;AAC5B,KAAK,QAAQ,GACT,QAAQ,GACR,UAAU,GACV,WAAW,GACX,WAAW,GACX,QAAQ,GACR,aAAa,GACb,SAAS,GACT,WAAW,GACX,YAAY,GACZ,eAAe,GACf,aAAa,GACb,mBAAmB,GACnB,UAAU,GACV,MAAM,CAAA;AAEV,UAAU,WAAW;IACnB,KAAK,EAAE,QAAQ,EAAE,CAAA;IACjB,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,eAAe,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,sBAAsB;IACrC,GAAG,CAAC,EAAE,OAAO,GAAG,SAAS,GAA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IAkBxB,OAAO,CAAC,UAAU;IAyHlB,OAAO,CAAC,eAAe;CA6ExB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { IconTransformerOptions } from './transformer';
|
|
2
|
+
/** grid divisions of the 960 icon canvas a template or composition uses */
|
|
3
|
+
export type IconVirtualGridRows = 1 | 2 | 3 | 4;
|
|
4
|
+
export type IconVirtualGridColumns = 1 | 2 | 3 | 4;
|
|
5
|
+
/** a grid cell address, 1-based: '1-1' is the top-left cell */
|
|
6
|
+
export type IconVirtualCell = `${IconVirtualGridRows}-${IconVirtualGridColumns}`;
|
|
7
|
+
/** rotation of a placed source; 90/270 swap the source's width/height */
|
|
8
|
+
export type IconVirtualRotate = 0 | 90 | 180 | 270;
|
|
9
|
+
/**
|
|
10
|
+
* A source placed into a composition cell. `value` is the regular icon query
|
|
11
|
+
* language - a pack icon ('ui0/arrow'), with modifiers/params
|
|
12
|
+
* ('ui0/circle.filled?weight=800'), a composed icon, or a TEMPLATE PART when
|
|
13
|
+
* a cell address follows the hash: 'ui0/chart#1-2' = the part marked
|
|
14
|
+
* `<g data-cell="1-2">` inside the 'chart' template sheet.
|
|
15
|
+
*/
|
|
16
|
+
export interface IconVirtualSource {
|
|
17
|
+
value: string;
|
|
18
|
+
/** rotate the placed source about its cell center (90/270 transpose the aspect) */
|
|
19
|
+
rotate?: IconVirtualRotate;
|
|
20
|
+
/** 'full' places into the full-pitch CELL-FULL (bleeding/filled parts); default is the guttered CELL */
|
|
21
|
+
cell?: 'full';
|
|
22
|
+
}
|
|
23
|
+
/** per-cell shorthand: a bare value string or the full source options */
|
|
24
|
+
export type IconVirtualCellValue = string | IconVirtualSource;
|
|
25
|
+
/**
|
|
26
|
+
* A template sheet: a real svg file whose parts are marked with
|
|
27
|
+
* `<g data-cell="row-col">` matching the declared grid. The rows/cols pair IS
|
|
28
|
+
* the sheet's aspect contract - a 1x3 sheet addresses 1x3 cells directly and
|
|
29
|
+
* 3x1 cells when the consumer rotates it 90/270.
|
|
30
|
+
*/
|
|
31
|
+
export interface IconVirtualTemplate {
|
|
32
|
+
rows: IconVirtualGridRows;
|
|
33
|
+
cols: IconVirtualGridColumns;
|
|
34
|
+
/** absolute path to the sheet svg, or the sheet svg content inline */
|
|
35
|
+
file: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A composed (virtual) icon: parts placed into the cells of a grid drawn over
|
|
39
|
+
* the 960 canvas. Composed at build time - the output is an ordinary icon.
|
|
40
|
+
*/
|
|
41
|
+
export interface IconVirtualIcon {
|
|
42
|
+
rows: IconVirtualGridRows;
|
|
43
|
+
cols: IconVirtualGridColumns;
|
|
44
|
+
/** cell address -> what is placed there; unaddressed cells stay empty */
|
|
45
|
+
cells: Partial<Record<IconVirtualCell, IconVirtualCellValue>>;
|
|
46
|
+
/** transformer options for the composed result */
|
|
47
|
+
options?: IconTransformerOptions;
|
|
48
|
+
/**
|
|
49
|
+
* reserved: the cell the runtime badge anchors to (corner anchors stay the
|
|
50
|
+
* default until badge positioning learns the grid)
|
|
51
|
+
*/
|
|
52
|
+
badge?: IconVirtualCell;
|
|
53
|
+
}
|
|
54
|
+
/** the `virtual` registry of the loader: template sheets and composed icons by name */
|
|
55
|
+
export type IconVirtualOptions = Record<string, IconVirtualTemplate | IconVirtualIcon>;
|
|
56
|
+
export declare function isVirtualTemplate(def: IconVirtualTemplate | IconVirtualIcon): def is IconVirtualTemplate;
|
|
57
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/vite/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAE3D,2EAA2E;AAC3E,MAAM,MAAM,mBAAmB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAC/C,MAAM,MAAM,sBAAsB,GAAG,CAAC,GAAG,CAAC,GAAG,CAA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ine {
|
|
4
|
+
x1: string;
|
|
5
|
+
y1: string;
|
|
6
|
+
x2: string;
|
|
7
|
+
y2: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SVGRect {
|
|
10
|
+
x: string;
|
|
11
|
+
y: string;
|
|
12
|
+
width: string;
|
|
13
|
+
height: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* scales polyline
|
|
17
|
+
* @param points - points string ("x1 y1 x2 y2" or "x1,y1 x2,y2")
|
|
18
|
+
* @param scaleX - horizontal scale
|
|
19
|
+
* @param scaleY - vertical scale
|
|
20
|
+
* @param centerX - view box x center
|
|
21
|
+
* @param centerY - view box y center
|
|
22
|
+
* @returns Scaled points
|
|
23
|
+
*/
|
|
24
|
+
export declare function scalePolyline(points: string, scaleX: number, scaleY: number, centerX?: number, centerY?: number): string;
|
|
25
|
+
/**
|
|
26
|
+
* Scales polyline points with separate X and Y scale factors
|
|
27
|
+
* @param points - Points string in format "x1 y1 x2 y2" or "x1,y1 x2,y2"
|
|
28
|
+
* @param scaleX - Horizontal scale factor
|
|
29
|
+
* @param scaleY - Vertical scale factor
|
|
30
|
+
* @returns Scaled points string with 2 decimal precision
|
|
31
|
+
*/
|
|
32
|
+
export declare function scalePolyline2(points: string, scaleX: number, scaleY: number): string;
|
|
33
|
+
/**
|
|
34
|
+
* Scales polygon points by a given percentage relative to a specified origin point.
|
|
35
|
+
* @returns {string} - Updated points string with scaled coordinates
|
|
36
|
+
* @param pathData
|
|
37
|
+
* @param scale - scale 1 by default
|
|
38
|
+
*/
|
|
39
|
+
export declare function scalePath(pathData: string, scale: number): string;
|
|
40
|
+
export declare function scalePathXY(pathData: string, scaleX: number, scaleY: number): string;
|
|
41
|
+
export declare function scaleLine(attrs: SVGLine, scale: number, origin: [x: number, y: number]): SVGLine;
|
|
42
|
+
export declare function scaleRect(attrs: SVGRect, scale: number, origin: [x: number, y: number]): SVGRect;
|
|
43
|
+
export declare function scaleCircle(): void;
|
|
44
|
+
/**
|
|
45
|
+
* Translates the path data by the given x and y values.
|
|
46
|
+
* @param {string} pathData - The path data to translate.
|
|
47
|
+
* @param {number} x - The x value to translate by.
|
|
48
|
+
* @param {number} y - The y value to translate by.
|
|
49
|
+
* @returns {string} - The translated path data.
|
|
50
|
+
*/
|
|
51
|
+
export declare function translate(pathData: string, x: number, y: number): string;
|
|
52
|
+
export declare function kebabize(str: string): string;
|
|
53
|
+
/**
|
|
54
|
+
* Converts string to camelCase
|
|
55
|
+
* @param str - Input string (kebab-case, snake_case, etc.)
|
|
56
|
+
* @returns camelCase string
|
|
57
|
+
*/
|
|
58
|
+
export declare function toCamelCase(str: string): string;
|
|
59
|
+
export declare function fileIdToVirtual(fileId: string): string;
|
|
60
|
+
export declare function extractFileName(name: string): string | undefined;
|
|
61
|
+
export declare function extractFileDir(file: string): string;
|
|
62
|
+
export declare function getNameFromRequest(request: string): string | undefined;
|
|
63
|
+
export declare function readFile(path: string): string | undefined;
|
|
64
|
+
/** like {@link readFile} but silent - for probing resolution candidate paths */
|
|
65
|
+
export declare function readFileQuiet(path: string): string | undefined;
|
|
66
|
+
//# sourceMappingURL=util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/vite/util.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,GAAG,SAAS,CAAA;AACzB,eAAO,MAAM,OAAO,cAAc,CAAA;AAElC,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;CACX;AACD,MAAM,WAAW,OAAO;IACtB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM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,CAAC,OAAO,EAAE,MAAM,sBAGjD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,sBAUpC;AAED,gFAAgF;AAChF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,sBAMzC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export interface Node {
|
|
2
|
+
tag: string;
|
|
3
|
+
attributes: NodeAttributes;
|
|
4
|
+
children: Node[];
|
|
5
|
+
parent: Node | null;
|
|
6
|
+
content: string;
|
|
7
|
+
raw: string;
|
|
8
|
+
hasAttr: (key: string) => key is keyof NodeAttributes;
|
|
9
|
+
setAttr: (key: string, val: string) => void;
|
|
10
|
+
getAttr: (key: string) => string | null;
|
|
11
|
+
hasClass: (key: string) => boolean;
|
|
12
|
+
isChildOf: (parent: Node | Node[]) => boolean;
|
|
13
|
+
walk: (onEntry: (node: Node) => void | boolean) => void;
|
|
14
|
+
serialize: () => string;
|
|
15
|
+
addClass: (key: string) => void;
|
|
16
|
+
addStyle: (key: string) => void;
|
|
17
|
+
removeClass: (key: string) => void;
|
|
18
|
+
}
|
|
19
|
+
export type NodeAttributes = Record<string, string>;
|
|
20
|
+
type ProcessFn = ((node: Node) => Node | Node[] | null) | null;
|
|
21
|
+
interface ParseOptions {
|
|
22
|
+
parent?: Node | null;
|
|
23
|
+
}
|
|
24
|
+
export declare class XmlParser {
|
|
25
|
+
static createNode(initial?: Partial<Node>): Node;
|
|
26
|
+
static parse(xml: string, onProcess?: ProcessFn, options?: ParseOptions): Node[];
|
|
27
|
+
static parseAsSingle(xml: string, onProcess?: (node: Node) => Node | Node[] | null, options?: ParseOptions): Node;
|
|
28
|
+
/**
|
|
29
|
+
* Serialize
|
|
30
|
+
* @param node Node or nodes to serialize
|
|
31
|
+
* @returns XML string
|
|
32
|
+
*/
|
|
33
|
+
static serialize(node: Node | Node[]): string;
|
|
34
|
+
/**
|
|
35
|
+
* walk nodes with callback
|
|
36
|
+
* if callback returns false, stop traversal
|
|
37
|
+
* @param node Root node or nodes
|
|
38
|
+
* @param onEntry
|
|
39
|
+
* @param options Optional traversal options
|
|
40
|
+
*/
|
|
41
|
+
static walk(node: Node | Node[], onEntry: (node: Node) => void | boolean, options?: {
|
|
42
|
+
includeText?: boolean;
|
|
43
|
+
}): void;
|
|
44
|
+
static clone(node: Node, newParent?: Node | null): Node;
|
|
45
|
+
private static parseAttributes;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=xml-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xml-parser.d.ts","sourceRoot":"","sources":["../../src/vite/xml-parser.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,IAAI;IACnB,GAAG,EAAE,MAAM,CAAA;IACX,UAAU,EAAE,cAAc,CAAA;IAC1B,QAAQ,EAAE,IAAI,EAAE,CAAA;IAChB,MAAM,EAAE,IAAI,GAAG,IAAI,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;IAEX,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,IAAI,MAAM,cAAc,CAAA;IACrD,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3C,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAA;IACvC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAA;IAClC,SAAS,EAAE,CAAC,MAAM,EAAE,IAAI,GAAG,IAAI,EAAE,KAAK,OAAO,CAAA;IAC7C,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,GAAG,OAAO,KAAK,IAAI,CAAA;IACvD,SAAS,EAAE,MAAM,MAAM,CAAA;IACvB,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B,QAAQ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Ae;CAW/B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,66 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui0/icon",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Vue icon component with an svg ?icon vite loader",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
8
|
+
"type": "module",
|
|
9
|
+
"sideEffects": [
|
|
10
|
+
"**/*.css"
|
|
11
|
+
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./vite": {
|
|
18
|
+
"types": "./dist/vite/index.d.ts",
|
|
19
|
+
"import": "./dist/vite/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./ui0": {
|
|
22
|
+
"types": "./dist/ui0/index.d.ts",
|
|
23
|
+
"import": "./dist/ui0/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./style.css": "./dist/style.css",
|
|
26
|
+
"./style": "./dist/style.css",
|
|
27
|
+
"./classes": "./dist/icon.module.css",
|
|
28
|
+
"./icon.module.css": "./dist/icon.module.css",
|
|
29
|
+
"./package.json": "./package.json"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"icon:build": "vite build && vue-tsc --emitDeclarationOnly -p tsconfig.build.json",
|
|
33
|
+
"icon:typecheck": "vue-tsc --noEmit",
|
|
34
|
+
"icon:test": "vitest run"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/node": "^20.14.8",
|
|
39
|
+
"@ui0/core": "workspace:*",
|
|
40
|
+
"@ui0/theme": "workspace:*",
|
|
41
|
+
"@ui0/vite": "workspace:*",
|
|
42
|
+
"@vitejs/plugin-vue": "^6.0.1",
|
|
43
|
+
"@vue/test-utils": "^2.4.6",
|
|
44
|
+
"sass-embedded": "^1.80.0",
|
|
45
|
+
"vite": "^6.4.1",
|
|
46
|
+
"vitest": "^3.2.4",
|
|
47
|
+
"vue": "^3.5.45",
|
|
48
|
+
"vue-tsc": "^3.2.1"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"@ui0/composable": "workspace:*",
|
|
52
|
+
"@ui0/core": "workspace:*",
|
|
53
|
+
"@ui0/theme": "workspace:*",
|
|
54
|
+
"@ui0/types": "workspace:*",
|
|
55
|
+
"@ui0/util": "workspace:*",
|
|
56
|
+
"vue": "^3.5.45"
|
|
57
|
+
},
|
|
58
|
+
"peerDependenciesMeta": {
|
|
59
|
+
"@ui0/core": {
|
|
60
|
+
"optional": true
|
|
61
|
+
},
|
|
62
|
+
"@ui0/theme": {
|
|
63
|
+
"optional": true
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
package/README.md
DELETED