@filecon/react-native-chalk 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,85 @@
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
+ var import_react_native = require("react-native");
38
+ var import_react_native_svg = require("react-native-svg");
39
+
40
+ // src/generated/variant.ts
41
+ var import_data = require("@filecon/js-chalk/data");
42
+ var FIXED_STYLE = "chalk";
43
+ var STYLES = ["chalk"];
44
+
45
+ // src/file-icon.ts
46
+ function useIcon(data, props, ref) {
47
+ const scheme = (0, import_react_native.useColorScheme)();
48
+ const { theme = "light", size = 40, title, ...rest } = props;
49
+ let style = FIXED_STYLE ?? "default";
50
+ if (FIXED_STYLE === null) {
51
+ style = rest.style ?? "default";
52
+ delete rest.style;
53
+ }
54
+ const resolvedTheme = theme === "auto" ? scheme === "dark" ? "dark" : "light" : theme;
55
+ return (0, import_react.createElement)(import_react_native_svg.SvgXml, {
56
+ xml: (0, import_shared.renderSvg)(data, { style, theme: resolvedTheme, size, title }),
57
+ width: size,
58
+ height: size,
59
+ accessible: Boolean(title),
60
+ accessibilityLabel: title,
61
+ accessibilityRole: title ? "image" : void 0,
62
+ importantForAccessibility: title ? "auto" : "no-hide-descendants",
63
+ ...rest,
64
+ ref
65
+ });
66
+ }
67
+ var FileIcon = /* @__PURE__ */ (0, import_react.forwardRef)(function FileIcon2({ name, file, ...props }, ref) {
68
+ const icon = name === void 0 ? (0, import_shared.resolveIcon)(file ?? "") : (0, import_shared.toIconName)(name);
69
+ return useIcon(import_data.iconData[icon], props, ref);
70
+ });
71
+ function createIcon(name, data) {
72
+ const Icon = (0, import_react.forwardRef)((props, ref) => useIcon(data, props, ref));
73
+ Icon.displayName = (0, import_shared.iconComponentName)(name);
74
+ return Icon;
75
+ }
76
+ // Annotate the CommonJS export names for ESM import in node:
77
+ 0 && (module.exports = {
78
+ FIXED_STYLE,
79
+ FileIcon,
80
+ STYLES,
81
+ createIcon,
82
+ iconComponentName,
83
+ iconNames,
84
+ resolveIcon
85
+ });
@@ -0,0 +1,39 @@
1
+ import { Style, Theme, IconName, IconData } from '@filecon/shared';
2
+ export { IconName, Style, Theme, iconComponentName, iconNames, resolveIcon } from '@filecon/shared';
3
+ import { ForwardRefExoticComponent, RefAttributes } from 'react';
4
+ import { XmlProps } from 'react-native-svg';
5
+
6
+ /** Single-style package: always renders the "chalk" style. */
7
+ declare const FIXED_STYLE: Style | null;
8
+ /** Styles contained in this package. */
9
+ declare const STYLES: readonly Style[];
10
+ /** `true` when the package offers the `style` option. */
11
+ type MultiStyle = false;
12
+ /** Style option of this package (absent in single-style packages). */
13
+ type StyleOption = {};
14
+
15
+ /** `SvgXml` props. In the all-styles package `style` selects the icon style instead of a view style. */
16
+ type NativeProps = Omit<XmlProps, "xml" | "width" | "height" | "children" | "override" | (MultiStyle extends true ? "style" : never)>;
17
+ type IconProps = NativeProps & StyleOption & {
18
+ /** `light` (default), `dark` or `auto` (follows the system color scheme via `useColorScheme`). */
19
+ theme?: Theme | undefined;
20
+ /** Width and height, default 40. */
21
+ size?: number | string | undefined;
22
+ /** Accessible name: sets `accessibilityLabel` and adds `<title>`. Without it the icon is hidden from a11y. */
23
+ title?: string | undefined;
24
+ };
25
+ type FileIconProps = IconProps & ({
26
+ name: IconName | (string & {});
27
+ file?: undefined;
28
+ } | {
29
+ file: string;
30
+ name?: undefined;
31
+ });
32
+ type IconComponent = ForwardRefExoticComponent<IconProps & RefAttributes<any>>;
33
+ /** Renders the icon for `name` (icon name / extension) or `file` (file name, via the resolver). */
34
+ declare const FileIcon: ForwardRefExoticComponent<FileIconProps & RefAttributes<unknown>>;
35
+ /** Creates a single-icon component (used by the generated `icons` entry). */
36
+ declare function createIcon(name: IconName, data: IconData): IconComponent;
37
+
38
+ export { FIXED_STYLE, FileIcon, STYLES, createIcon };
39
+ export type { FileIconProps, IconComponent, IconProps };
@@ -0,0 +1,39 @@
1
+ import { Style, Theme, IconName, IconData } from '@filecon/shared';
2
+ export { IconName, Style, Theme, iconComponentName, iconNames, resolveIcon } from '@filecon/shared';
3
+ import { ForwardRefExoticComponent, RefAttributes } from 'react';
4
+ import { XmlProps } from 'react-native-svg';
5
+
6
+ /** Single-style package: always renders the "chalk" style. */
7
+ declare const FIXED_STYLE: Style | null;
8
+ /** Styles contained in this package. */
9
+ declare const STYLES: readonly Style[];
10
+ /** `true` when the package offers the `style` option. */
11
+ type MultiStyle = false;
12
+ /** Style option of this package (absent in single-style packages). */
13
+ type StyleOption = {};
14
+
15
+ /** `SvgXml` props. In the all-styles package `style` selects the icon style instead of a view style. */
16
+ type NativeProps = Omit<XmlProps, "xml" | "width" | "height" | "children" | "override" | (MultiStyle extends true ? "style" : never)>;
17
+ type IconProps = NativeProps & StyleOption & {
18
+ /** `light` (default), `dark` or `auto` (follows the system color scheme via `useColorScheme`). */
19
+ theme?: Theme | undefined;
20
+ /** Width and height, default 40. */
21
+ size?: number | string | undefined;
22
+ /** Accessible name: sets `accessibilityLabel` and adds `<title>`. Without it the icon is hidden from a11y. */
23
+ title?: string | undefined;
24
+ };
25
+ type FileIconProps = IconProps & ({
26
+ name: IconName | (string & {});
27
+ file?: undefined;
28
+ } | {
29
+ file: string;
30
+ name?: undefined;
31
+ });
32
+ type IconComponent = ForwardRefExoticComponent<IconProps & RefAttributes<any>>;
33
+ /** Renders the icon for `name` (icon name / extension) or `file` (file name, via the resolver). */
34
+ declare const FileIcon: ForwardRefExoticComponent<FileIconProps & RefAttributes<unknown>>;
35
+ /** Creates a single-icon component (used by the generated `icons` entry). */
36
+ declare function createIcon(name: IconName, data: IconData): IconComponent;
37
+
38
+ export { FIXED_STYLE, FileIcon, STYLES, createIcon };
39
+ 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-KRQMPXGN.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,100 @@
1
1
  {
2
2
  "name": "@filecon/react-native-chalk",
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 Native – the chalk style (chalk on a blackboard, marker on a whiteboard). Rendered with react-native-svg, tree-shakable.",
5
+ "keywords": [
6
+ "filecon",
7
+ "file-icons",
8
+ "icons",
9
+ "svg",
10
+ "file-type",
11
+ "react-native",
12
+ "react-native-svg",
13
+ "expo"
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/react-native-chalk"
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
+ "react-native": "./dist/index.js",
64
+ "files": [
65
+ "dist",
66
+ "NOTICE"
67
+ ],
68
+ "engines": {
69
+ "node": ">=20"
70
+ },
71
+ "dependencies": {
72
+ "@filecon/js-chalk": "^0.3.0",
73
+ "@filecon/shared": "^0.3.0"
74
+ },
75
+ "peerDependencies": {
76
+ "react": ">=18",
77
+ "react-native": ">=0.72",
78
+ "react-native-svg": ">=13"
79
+ },
80
+ "devDependencies": {
81
+ "@types/node": "^24.19.2",
82
+ "@types/react": "^19.3.0",
83
+ "react": "^19.3.1",
84
+ "react-native": "^0.88.1",
85
+ "react-native-svg": "^15.16.1",
86
+ "tsup": "^9.0.0",
87
+ "typescript": "~6.0.3",
88
+ "vitest": "^5.1.0",
89
+ "@filecon/testkit": "0.0.0"
90
+ },
91
+ "publishConfig": {
92
+ "access": "public",
93
+ "provenance": true
94
+ },
95
+ "scripts": {
96
+ "build": "tsup",
97
+ "typecheck": "tsc --noEmit",
98
+ "test": "vitest run"
99
+ }
6
100
  }