@filecon/solid-papered-craft 0.0.0-stage → 0.2.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/LICENSE +202 -0
- package/NOTICE +18 -0
- package/README.md +46 -2
- package/dist/chunk-PJ32TCST.js +66 -0
- package/dist/icons.cjs +2188 -0
- package/dist/icons.d.cts +709 -0
- package/dist/icons.d.ts +709 -0
- package/dist/icons.js +2118 -0
- package/dist/index.cjs +97 -0
- package/dist/index.d.cts +38 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +18 -0
- package/package.json +91 -3
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
FIXED_STYLE: () => FIXED_STYLE,
|
|
24
|
+
FileIcon: () => FileIcon,
|
|
25
|
+
STYLES: () => STYLES,
|
|
26
|
+
createIcon: () => createIcon,
|
|
27
|
+
iconComponentName: () => import_shared2.iconComponentName,
|
|
28
|
+
iconNames: () => import_shared2.iconNames,
|
|
29
|
+
resolveIcon: () => import_shared2.resolveIcon
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(src_exports);
|
|
32
|
+
var import_shared2 = require("@filecon/shared");
|
|
33
|
+
|
|
34
|
+
// src/file-icon.ts
|
|
35
|
+
var import_shared = require("@filecon/shared");
|
|
36
|
+
var import_solid_js = require("solid-js");
|
|
37
|
+
var import_web = require("solid-js/web");
|
|
38
|
+
|
|
39
|
+
// src/generated/variant.ts
|
|
40
|
+
var import_data = require("@filecon/js-papered-craft/data");
|
|
41
|
+
var FIXED_STYLE = "papered-craft";
|
|
42
|
+
var STYLES = ["papered-craft"];
|
|
43
|
+
|
|
44
|
+
// src/file-icon.ts
|
|
45
|
+
var LOCAL_KEYS = FIXED_STYLE === null ? ["theme", "size", "title", "style"] : ["theme", "size", "title"];
|
|
46
|
+
function renderIcon(data, props) {
|
|
47
|
+
const [local, others] = (0, import_solid_js.splitProps)(props, LOCAL_KEYS);
|
|
48
|
+
const style = () => FIXED_STYLE ?? (local.style || "default");
|
|
49
|
+
const size = () => String(local.size ?? import_shared.DEFAULT_SIZE);
|
|
50
|
+
return (0, import_solid_js.createComponent)(
|
|
51
|
+
import_web.Dynamic,
|
|
52
|
+
(0, import_solid_js.mergeProps)(
|
|
53
|
+
{
|
|
54
|
+
component: "svg",
|
|
55
|
+
xmlns: import_shared.SVG_NAMESPACE,
|
|
56
|
+
viewBox: import_shared.VIEW_BOX,
|
|
57
|
+
fill: "none",
|
|
58
|
+
get width() {
|
|
59
|
+
return size();
|
|
60
|
+
},
|
|
61
|
+
get height() {
|
|
62
|
+
return size();
|
|
63
|
+
},
|
|
64
|
+
get role() {
|
|
65
|
+
return local.title ? "img" : void 0;
|
|
66
|
+
},
|
|
67
|
+
get "aria-hidden"() {
|
|
68
|
+
return local.title ? void 0 : "true";
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
others,
|
|
72
|
+
{
|
|
73
|
+
get innerHTML() {
|
|
74
|
+
return (0, import_shared.iconContent)(data(), { style: style(), theme: local.theme, title: local.title });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
function FileIcon(props) {
|
|
81
|
+
const [selection, rest] = (0, import_solid_js.splitProps)(props, ["name", "file"]);
|
|
82
|
+
const data = () => import_data.iconData[selection.name === void 0 ? (0, import_shared.resolveIcon)(selection.file ?? "") : (0, import_shared.toIconName)(selection.name)];
|
|
83
|
+
return renderIcon(data, rest);
|
|
84
|
+
}
|
|
85
|
+
function createIcon(_name, data) {
|
|
86
|
+
return (props) => renderIcon(() => data, props);
|
|
87
|
+
}
|
|
88
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
89
|
+
0 && (module.exports = {
|
|
90
|
+
FIXED_STYLE,
|
|
91
|
+
FileIcon,
|
|
92
|
+
STYLES,
|
|
93
|
+
createIcon,
|
|
94
|
+
iconComponentName,
|
|
95
|
+
iconNames,
|
|
96
|
+
resolveIcon
|
|
97
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Style, Theme, IconName, IconData } from '@filecon/shared';
|
|
2
|
+
export { IconName, Style, Theme, iconComponentName, iconNames, resolveIcon } from '@filecon/shared';
|
|
3
|
+
import { Component, JSX } from 'solid-js';
|
|
4
|
+
|
|
5
|
+
/** Single-style package: always renders the "papered-craft" style. */
|
|
6
|
+
declare const FIXED_STYLE: Style | null;
|
|
7
|
+
/** Styles contained in this package. */
|
|
8
|
+
declare const STYLES: readonly Style[];
|
|
9
|
+
/** `true` when the package offers the `style` option. */
|
|
10
|
+
type MultiStyle = false;
|
|
11
|
+
/** Style option of this package (absent in single-style packages). */
|
|
12
|
+
type StyleOption = {};
|
|
13
|
+
|
|
14
|
+
/** Native SVG props. In the all-styles package `style` selects the icon style instead of inline CSS. */
|
|
15
|
+
type NativeSvgProps = Omit<JSX.SvgSVGAttributes<SVGSVGElement>, "children" | "innerHTML" | "textContent" | "name" | (MultiStyle extends true ? "style" : never)>;
|
|
16
|
+
type IconProps = NativeSvgProps & StyleOption & {
|
|
17
|
+
/** `light` (default), `dark` or `auto` (follows `prefers-color-scheme`, SSR-safe). */
|
|
18
|
+
theme?: Theme | undefined;
|
|
19
|
+
/** Width and height, default 40. */
|
|
20
|
+
size?: number | string | undefined;
|
|
21
|
+
/** Accessible name: adds `<title>` and `role="img"`. Without it the icon is `aria-hidden`. */
|
|
22
|
+
title?: string | undefined;
|
|
23
|
+
};
|
|
24
|
+
type FileIconProps = IconProps & ({
|
|
25
|
+
name: IconName | (string & {});
|
|
26
|
+
file?: undefined;
|
|
27
|
+
} | {
|
|
28
|
+
file: string;
|
|
29
|
+
name?: undefined;
|
|
30
|
+
});
|
|
31
|
+
type IconComponent = Component<IconProps>;
|
|
32
|
+
/** Renders the icon for `name` (icon name / extension) or `file` (file name, via the resolver). */
|
|
33
|
+
declare function FileIcon(props: FileIconProps): JSX.Element;
|
|
34
|
+
/** Creates a single-icon component (used by the generated `icons` entry). */
|
|
35
|
+
declare function createIcon(_name: IconName, data: IconData): IconComponent;
|
|
36
|
+
|
|
37
|
+
export { FIXED_STYLE, FileIcon, STYLES, createIcon };
|
|
38
|
+
export type { FileIconProps, IconComponent, IconProps };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Style, Theme, IconName, IconData } from '@filecon/shared';
|
|
2
|
+
export { IconName, Style, Theme, iconComponentName, iconNames, resolveIcon } from '@filecon/shared';
|
|
3
|
+
import { Component, JSX } from 'solid-js';
|
|
4
|
+
|
|
5
|
+
/** Single-style package: always renders the "papered-craft" style. */
|
|
6
|
+
declare const FIXED_STYLE: Style | null;
|
|
7
|
+
/** Styles contained in this package. */
|
|
8
|
+
declare const STYLES: readonly Style[];
|
|
9
|
+
/** `true` when the package offers the `style` option. */
|
|
10
|
+
type MultiStyle = false;
|
|
11
|
+
/** Style option of this package (absent in single-style packages). */
|
|
12
|
+
type StyleOption = {};
|
|
13
|
+
|
|
14
|
+
/** Native SVG props. In the all-styles package `style` selects the icon style instead of inline CSS. */
|
|
15
|
+
type NativeSvgProps = Omit<JSX.SvgSVGAttributes<SVGSVGElement>, "children" | "innerHTML" | "textContent" | "name" | (MultiStyle extends true ? "style" : never)>;
|
|
16
|
+
type IconProps = NativeSvgProps & StyleOption & {
|
|
17
|
+
/** `light` (default), `dark` or `auto` (follows `prefers-color-scheme`, SSR-safe). */
|
|
18
|
+
theme?: Theme | undefined;
|
|
19
|
+
/** Width and height, default 40. */
|
|
20
|
+
size?: number | string | undefined;
|
|
21
|
+
/** Accessible name: adds `<title>` and `role="img"`. Without it the icon is `aria-hidden`. */
|
|
22
|
+
title?: string | undefined;
|
|
23
|
+
};
|
|
24
|
+
type FileIconProps = IconProps & ({
|
|
25
|
+
name: IconName | (string & {});
|
|
26
|
+
file?: undefined;
|
|
27
|
+
} | {
|
|
28
|
+
file: string;
|
|
29
|
+
name?: undefined;
|
|
30
|
+
});
|
|
31
|
+
type IconComponent = Component<IconProps>;
|
|
32
|
+
/** Renders the icon for `name` (icon name / extension) or `file` (file name, via the resolver). */
|
|
33
|
+
declare function FileIcon(props: FileIconProps): JSX.Element;
|
|
34
|
+
/** Creates a single-icon component (used by the generated `icons` entry). */
|
|
35
|
+
declare function createIcon(_name: IconName, data: IconData): IconComponent;
|
|
36
|
+
|
|
37
|
+
export { FIXED_STYLE, FileIcon, STYLES, createIcon };
|
|
38
|
+
export type { FileIconProps, IconComponent, IconProps };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FIXED_STYLE,
|
|
3
|
+
FileIcon,
|
|
4
|
+
STYLES,
|
|
5
|
+
createIcon
|
|
6
|
+
} from "./chunk-PJ32TCST.js";
|
|
7
|
+
|
|
8
|
+
// src/index.ts
|
|
9
|
+
import { iconComponentName, iconNames, resolveIcon } from "@filecon/shared";
|
|
10
|
+
export {
|
|
11
|
+
FIXED_STYLE,
|
|
12
|
+
FileIcon,
|
|
13
|
+
STYLES,
|
|
14
|
+
createIcon,
|
|
15
|
+
iconComponentName,
|
|
16
|
+
iconNames,
|
|
17
|
+
resolveIcon
|
|
18
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,94 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@filecon/solid-papered-craft",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Filecon file icons for SolidJS – the papered-craft style (cut paper layers). SSR-safe, tree-shakable.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"filecon",
|
|
7
|
+
"file-icons",
|
|
8
|
+
"icons",
|
|
9
|
+
"svg",
|
|
10
|
+
"file-type",
|
|
11
|
+
"solid",
|
|
12
|
+
"solidjs",
|
|
13
|
+
"solid-component"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://filecon.dev",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/dutobo/filecon/issues"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/dutobo/filecon.git",
|
|
22
|
+
"directory": "packages/solid-papered-craft"
|
|
23
|
+
},
|
|
24
|
+
"license": "Apache-2.0",
|
|
25
|
+
"author": {
|
|
26
|
+
"name": "dutobo",
|
|
27
|
+
"url": "https://github.com/dutobo"
|
|
28
|
+
},
|
|
29
|
+
"contributors": [
|
|
30
|
+
{
|
|
31
|
+
"name": "rafaelk-f",
|
|
32
|
+
"url": "https://github.com/rafaelk-f"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"type": "module",
|
|
36
|
+
"sideEffects": false,
|
|
37
|
+
"main": "./dist/index.cjs",
|
|
38
|
+
"module": "./dist/index.js",
|
|
39
|
+
"types": "./dist/index.d.ts",
|
|
40
|
+
"exports": {
|
|
41
|
+
".": {
|
|
42
|
+
"import": {
|
|
43
|
+
"types": "./dist/index.d.ts",
|
|
44
|
+
"default": "./dist/index.js"
|
|
45
|
+
},
|
|
46
|
+
"require": {
|
|
47
|
+
"types": "./dist/index.d.cts",
|
|
48
|
+
"default": "./dist/index.cjs"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"./icons": {
|
|
52
|
+
"import": {
|
|
53
|
+
"types": "./dist/icons.d.ts",
|
|
54
|
+
"default": "./dist/icons.js"
|
|
55
|
+
},
|
|
56
|
+
"require": {
|
|
57
|
+
"types": "./dist/icons.d.cts",
|
|
58
|
+
"default": "./dist/icons.cjs"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"./package.json": "./package.json"
|
|
62
|
+
},
|
|
63
|
+
"files": [
|
|
64
|
+
"dist",
|
|
65
|
+
"NOTICE"
|
|
66
|
+
],
|
|
67
|
+
"engines": {
|
|
68
|
+
"node": ">=20"
|
|
69
|
+
},
|
|
70
|
+
"dependencies": {
|
|
71
|
+
"@filecon/js-papered-craft": "^0.2.0",
|
|
72
|
+
"@filecon/shared": "^0.2.0"
|
|
73
|
+
},
|
|
74
|
+
"peerDependencies": {
|
|
75
|
+
"solid-js": "^1.8.0"
|
|
76
|
+
},
|
|
77
|
+
"devDependencies": {
|
|
78
|
+
"@types/node": "^24.19.2",
|
|
79
|
+
"solid-js": "^1.9.19",
|
|
80
|
+
"tsup": "^9.0.0",
|
|
81
|
+
"typescript": "~6.0.3",
|
|
82
|
+
"vitest": "^5.1.0",
|
|
83
|
+
"@filecon/testkit": "0.0.0"
|
|
84
|
+
},
|
|
85
|
+
"publishConfig": {
|
|
86
|
+
"access": "public",
|
|
87
|
+
"provenance": true
|
|
88
|
+
},
|
|
89
|
+
"scripts": {
|
|
90
|
+
"build": "tsup",
|
|
91
|
+
"typecheck": "tsc --noEmit",
|
|
92
|
+
"test": "vitest run"
|
|
93
|
+
}
|
|
6
94
|
}
|