@filecon/react-papered 0.0.0-stage → 0.3.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/index.cjs ADDED
@@ -0,0 +1,76 @@
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_react = require("react");
37
+
38
+ // src/generated/variant.ts
39
+ var import_data = require("@filecon/js-papered/data");
40
+ var FIXED_STYLE = "papered";
41
+ var STYLES = ["papered"];
42
+
43
+ // src/file-icon.ts
44
+ function renderIcon(data, props, ref) {
45
+ const { theme, size, title, ...rest } = props;
46
+ let style = FIXED_STYLE ?? "default";
47
+ if (FIXED_STYLE === null) {
48
+ style = rest.style ?? "default";
49
+ delete rest.style;
50
+ }
51
+ return (0, import_react.createElement)("svg", {
52
+ ...(0, import_shared.svgAttributes)({ size, title }),
53
+ ...rest,
54
+ ref,
55
+ dangerouslySetInnerHTML: { __html: (0, import_shared.iconContent)(data, { style, theme, title }) }
56
+ });
57
+ }
58
+ var FileIcon = /* @__PURE__ */ (0, import_react.forwardRef)(function FileIcon2({ name, file, ...props }, ref) {
59
+ const icon = name === void 0 ? (0, import_shared.resolveIcon)(file ?? "") : (0, import_shared.toIconName)(name);
60
+ return renderIcon(import_data.iconData[icon], props, ref);
61
+ });
62
+ function createIcon(name, data) {
63
+ const Icon = (0, import_react.forwardRef)((props, ref) => renderIcon(data, props, ref));
64
+ Icon.displayName = (0, import_shared.iconComponentName)(name);
65
+ return Icon;
66
+ }
67
+ // Annotate the CommonJS export names for ESM import in node:
68
+ 0 && (module.exports = {
69
+ FIXED_STYLE,
70
+ FileIcon,
71
+ STYLES,
72
+ createIcon,
73
+ iconComponentName,
74
+ iconNames,
75
+ resolveIcon
76
+ });
@@ -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 { ForwardRefExoticComponent, SVGProps, RefAttributes } from 'react';
4
+
5
+ /** Single-style package: always renders the "papered" 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<SVGProps<SVGSVGElement>, "ref" | "children" | "dangerouslySetInnerHTML" | "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 = ForwardRefExoticComponent<IconProps & RefAttributes<SVGSVGElement>>;
32
+ /** Renders the icon for `name` (icon name / extension) or `file` (file name, via the resolver). */
33
+ declare const FileIcon: ForwardRefExoticComponent<FileIconProps & RefAttributes<SVGSVGElement>>;
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 };
@@ -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 { ForwardRefExoticComponent, SVGProps, RefAttributes } from 'react';
4
+
5
+ /** Single-style package: always renders the "papered" 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<SVGProps<SVGSVGElement>, "ref" | "children" | "dangerouslySetInnerHTML" | "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 = ForwardRefExoticComponent<IconProps & RefAttributes<SVGSVGElement>>;
32
+ /** Renders the icon for `name` (icon name / extension) or `file` (file name, via the resolver). */
33
+ declare const FileIcon: ForwardRefExoticComponent<FileIconProps & RefAttributes<SVGSVGElement>>;
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-Q62LSYE4.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,96 @@
1
1
  {
2
2
  "name": "@filecon/react-papered",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.3.0",
4
+ "description": "Filecon file icons for React – the papered style (realistic sheet of paper). SSR-safe, tree-shakable.",
5
+ "keywords": [
6
+ "filecon",
7
+ "file-icons",
8
+ "icons",
9
+ "svg",
10
+ "file-type",
11
+ "react",
12
+ "react-component"
13
+ ],
14
+ "homepage": "https://filecon.dev",
15
+ "bugs": {
16
+ "url": "https://github.com/dutobo/filecon/issues"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/dutobo/filecon.git",
21
+ "directory": "packages/react-papered"
22
+ },
23
+ "license": "Apache-2.0",
24
+ "author": {
25
+ "name": "dutobo",
26
+ "url": "https://github.com/dutobo"
27
+ },
28
+ "contributors": [
29
+ {
30
+ "name": "rafaelk-f",
31
+ "url": "https://github.com/rafaelk-f"
32
+ }
33
+ ],
34
+ "type": "module",
35
+ "sideEffects": false,
36
+ "main": "./dist/index.cjs",
37
+ "module": "./dist/index.js",
38
+ "types": "./dist/index.d.ts",
39
+ "exports": {
40
+ ".": {
41
+ "import": {
42
+ "types": "./dist/index.d.ts",
43
+ "default": "./dist/index.js"
44
+ },
45
+ "require": {
46
+ "types": "./dist/index.d.cts",
47
+ "default": "./dist/index.cjs"
48
+ }
49
+ },
50
+ "./icons": {
51
+ "import": {
52
+ "types": "./dist/icons.d.ts",
53
+ "default": "./dist/icons.js"
54
+ },
55
+ "require": {
56
+ "types": "./dist/icons.d.cts",
57
+ "default": "./dist/icons.cjs"
58
+ }
59
+ },
60
+ "./package.json": "./package.json"
61
+ },
62
+ "files": [
63
+ "dist",
64
+ "NOTICE"
65
+ ],
66
+ "engines": {
67
+ "node": ">=20"
68
+ },
69
+ "dependencies": {
70
+ "@filecon/js-papered": "^0.3.0",
71
+ "@filecon/shared": "^0.3.0"
72
+ },
73
+ "peerDependencies": {
74
+ "react": ">=18"
75
+ },
76
+ "devDependencies": {
77
+ "@types/node": "^24.19.2",
78
+ "@types/react": "^19.3.0",
79
+ "@types/react-dom": "^19.3.0",
80
+ "react": "^19.3.1",
81
+ "react-dom": "^19.3.1",
82
+ "tsup": "^9.0.0",
83
+ "typescript": "~6.0.3",
84
+ "vitest": "^5.1.0",
85
+ "@filecon/testkit": "0.0.0"
86
+ },
87
+ "publishConfig": {
88
+ "access": "public",
89
+ "provenance": true
90
+ },
91
+ "scripts": {
92
+ "build": "tsup",
93
+ "typecheck": "tsc --noEmit",
94
+ "test": "vitest run"
95
+ }
6
96
  }