@dubium/icons 0.0.2-alpha.3 → 0.0.2-alpha.4

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.
Files changed (124) hide show
  1. package/README.md +286 -49
  2. package/dist/collection/AdjustmentsPlusIcon.d.ts +3 -0
  3. package/dist/collection/{Icon123Icon.js → AdjustmentsPlusIcon.js} +3 -3
  4. package/dist/collection/AdjustmentsQuestionIcon.d.ts +3 -0
  5. package/dist/collection/AdjustmentsQuestionIcon.js +18 -0
  6. package/dist/collection/AlarmPlusFilledIcon.d.ts +3 -0
  7. package/dist/collection/AlarmPlusFilledIcon.js +29 -0
  8. package/dist/collection/AlarmSnoozeFilledIcon.d.ts +3 -0
  9. package/dist/collection/AlarmSnoozeFilledIcon.js +29 -0
  10. package/dist/collection/{Icon360ViewIcon.d.ts → AlarmSnoozeIcon.d.ts} +2 -2
  11. package/dist/collection/{Icon360Icon.js → AlarmSnoozeIcon.js} +3 -3
  12. package/dist/collection/AlbumIcon.d.ts +3 -0
  13. package/dist/collection/{Icon24HoursIcon.js → AlbumIcon.js} +3 -3
  14. package/dist/collection/AlbumOffIcon.d.ts +3 -0
  15. package/dist/collection/AlbumOffIcon.js +18 -0
  16. package/dist/collection/AlertCircleFilledIcon.d.ts +3 -0
  17. package/dist/collection/AlertCircleFilledIcon.js +15 -0
  18. package/dist/collection/{Icon24HoursIcon.d.ts → AlertCircleIcon.d.ts} +2 -2
  19. package/dist/collection/{Icon2faIcon.js → AlertCircleIcon.js} +3 -3
  20. package/dist/collection/AlertHexagonIcon.d.ts +3 -0
  21. package/dist/collection/AlertHexagonIcon.js +18 -0
  22. package/dist/collection/AlignBoxBottomRightFilledIcon.d.ts +3 -0
  23. package/dist/collection/AlignBoxBottomRightFilledIcon.js +15 -0
  24. package/dist/collection/AlignBoxBottomRightIcon.d.ts +3 -0
  25. package/dist/collection/AlignBoxBottomRightIcon.js +18 -0
  26. package/dist/collection/AlignBoxCenterMiddleFilledIcon.d.ts +3 -0
  27. package/dist/collection/AlignBoxCenterMiddleFilledIcon.js +15 -0
  28. package/dist/collection/AlignBoxCenterMiddleIcon.d.ts +3 -0
  29. package/dist/collection/AlignBoxCenterMiddleIcon.js +18 -0
  30. package/dist/collection/AlignBoxLeftBottomFilledIcon.d.ts +3 -0
  31. package/dist/collection/AlignBoxLeftBottomFilledIcon.js +15 -0
  32. package/dist/collection/AlignBoxLeftBottomIcon.d.ts +3 -0
  33. package/dist/collection/AlignBoxLeftBottomIcon.js +18 -0
  34. package/dist/collection/AlignBoxLeftMiddleFilledIcon.d.ts +3 -0
  35. package/dist/collection/AlignBoxLeftMiddleFilledIcon.js +15 -0
  36. package/dist/collection/AlignBoxLeftMiddleIcon.d.ts +3 -0
  37. package/dist/collection/AlignBoxLeftMiddleIcon.js +18 -0
  38. package/dist/collection/index.d.ts +20 -7
  39. package/dist/collection/index.js +19 -6
  40. package/dist/collection/types.d.ts +17 -1
  41. package/dist/icon/Icon.container.d.ts +29 -0
  42. package/dist/icon/Icon.container.js +19 -0
  43. package/dist/icon/Icon.d.ts +5 -0
  44. package/dist/icon/Icon.js +20 -0
  45. package/dist/icon/Icon.types.d.ts +59 -0
  46. package/dist/icon/index.d.ts +13 -0
  47. package/dist/icon/index.js +2 -0
  48. package/dist/vite/icon/Icon.create.d.ts +35 -0
  49. package/dist/{spa → vite}/icon/Icon.create.js +1 -1
  50. package/dist/vite/icon/Icon.d.ts +66 -0
  51. package/dist/vite/icon/Icon.js +79 -0
  52. package/dist/vite/icon/Icon.types.d.ts +88 -0
  53. package/dist/vite/icon/index.d.ts +6 -0
  54. package/dist/vite/index.d.ts +10 -46
  55. package/dist/vite/index.js +6 -167
  56. package/dist/vite/plugin/index.d.ts +11 -0
  57. package/dist/vite/plugin/index.js +2 -0
  58. package/dist/vite/plugin/plugin.d.ts +41 -0
  59. package/dist/vite/plugin/plugin.js +105 -0
  60. package/dist/vite/plugin/plugin.types.d.ts +99 -0
  61. package/dist/vite/plugin/scanner/index.d.ts +9 -0
  62. package/dist/vite/plugin/scanner/scanner.imports.d.ts +5 -0
  63. package/dist/vite/plugin/scanner/scanner.imports.js +36 -0
  64. package/dist/vite/plugin/scanner/scanner.jsx.d.ts +24 -0
  65. package/dist/vite/plugin/scanner/scanner.jsx.js +58 -0
  66. package/dist/vite/plugin/scanner/scanner.lexical.d.ts +30 -0
  67. package/dist/vite/plugin/scanner/scanner.lexical.js +140 -0
  68. package/dist/vite/plugin/scanner/scanner.properties.d.ts +9 -0
  69. package/dist/vite/plugin/scanner/scanner.properties.js +78 -0
  70. package/dist/vite/plugin/scanner/scanner.regex.d.ts +21 -0
  71. package/dist/vite/plugin/scanner/scanner.regex.js +24 -0
  72. package/dist/vite/plugin/scanner/scanner.source.d.ts +18 -0
  73. package/dist/vite/plugin/scanner/scanner.source.js +23 -0
  74. package/dist/vite/plugin/scanner/scanner.types.d.ts +1 -0
  75. package/dist/vite/plugin/sources/index.d.ts +11 -0
  76. package/dist/vite/plugin/sources/sources.catalog.d.ts +17 -0
  77. package/dist/vite/plugin/sources/sources.catalog.js +19 -0
  78. package/dist/vite/plugin/sources/sources.files.d.ts +34 -0
  79. package/dist/vite/plugin/sources/sources.files.js +43 -0
  80. package/dist/vite/plugin/sources/sources.types.d.ts +1 -0
  81. package/dist/vite/plugin/sources/sources.validate.d.ts +13 -0
  82. package/dist/vite/plugin/sources/sources.validate.js +12 -0
  83. package/dist/vite/plugin/virtual/index.d.ts +9 -0
  84. package/dist/vite/plugin/virtual/virtual.constants.d.ts +15 -0
  85. package/dist/vite/plugin/virtual/virtual.constants.js +4 -0
  86. package/dist/vite/plugin/virtual/virtual.module.d.ts +23 -0
  87. package/dist/vite/plugin/virtual/virtual.module.js +27 -0
  88. package/dist/vite/provider/IconProvider.context.d.ts +14 -0
  89. package/dist/vite/provider/IconProvider.context.js +5 -0
  90. package/dist/{spa → vite}/provider/IconProvider.d.ts +3 -2
  91. package/dist/{spa → vite}/provider/IconProvider.js +1 -1
  92. package/dist/{spa → vite}/provider/index.d.ts +2 -2
  93. package/dist/{spa/provider/IconProvider.context.d.ts → vite/provider/useIconContext.d.ts} +4 -14
  94. package/dist/vite/provider/useIconContext.js +6 -0
  95. package/dist/vite/runtime/IconRuntime.registry.d.ts +54 -0
  96. package/dist/vite/runtime/IconRuntime.registry.js +58 -0
  97. package/dist/vite/runtime/index.d.ts +9 -0
  98. package/package.json +17 -17
  99. package/dist/collection/Icon123Icon.d.ts +0 -3
  100. package/dist/collection/Icon2faIcon.d.ts +0 -3
  101. package/dist/collection/Icon360Icon.d.ts +0 -3
  102. package/dist/collection/Icon360ViewIcon.js +0 -18
  103. package/dist/spa/icon/Icon.create.d.ts +0 -40
  104. package/dist/spa/icon/Icon.d.ts +0 -25
  105. package/dist/spa/icon/Icon.js +0 -58
  106. package/dist/spa/icon/Icon.registry.d.ts +0 -12
  107. package/dist/spa/icon/Icon.types.d.ts +0 -71
  108. package/dist/spa/icon/index.d.ts +0 -9
  109. package/dist/spa/index.d.ts +0 -8
  110. package/dist/spa/index.js +0 -5
  111. package/dist/spa/provider/IconProvider.context.js +0 -5
  112. package/dist/ssr/icon/Icon.container.d.ts +0 -26
  113. package/dist/ssr/icon/Icon.container.js +0 -23
  114. package/dist/ssr/icon/Icon.create.d.ts +0 -35
  115. package/dist/ssr/icon/Icon.create.js +0 -8
  116. package/dist/ssr/icon/Icon.d.ts +0 -6
  117. package/dist/ssr/icon/Icon.js +0 -27
  118. package/dist/ssr/icon/Icon.registry.d.ts +0 -12
  119. package/dist/ssr/icon/Icon.registry.js +0 -10
  120. package/dist/ssr/icon/Icon.types.d.ts +0 -97
  121. package/dist/ssr/icon/index.d.ts +0 -10
  122. package/dist/ssr/index.d.ts +0 -6
  123. package/dist/ssr/index.js +0 -4
  124. /package/dist/{spa → vite}/provider/IconProvider.types.d.ts +0 -0
@@ -1,35 +0,0 @@
1
- import type { IconProps, TIconRegistry } from "./Icon.types.js";
2
- /**
3
- * Создаёт Server Component с именами встроенной npm-коллекции и
4
- * дополнительными иконками конкретного проекта.
5
- *
6
- * Registry захватывается обычным замыканием: React Context и `use client`
7
- * для SSR/RSC не нужны.
8
- *
9
- * @example
10
- * ```tsx
11
- * import BrandIcon from "./BrandIcon"
12
- * import { createIcon, defineIcons } from "@dubium/icons/ssr"
13
- *
14
- * const projectIcons = defineIcons({ Brand: BrandIcon })
15
- * export const AppIcon = createIcon(projectIcons)
16
- *
17
- * <AppIcon name="User" />
18
- * <AppIcon name="Brand" />
19
- * ```
20
- */
21
- export declare const createIcon: <const TCustomIcons extends TIconRegistry>(icons: TCustomIcons) => {
22
- (props: IconProps<TCustomIcons>): Promise<import("react").JSX.Element | null>;
23
- displayName: string;
24
- };
25
- /**
26
- * Сохраняет literal-ключи пользовательского registry.
27
- *
28
- * Позволяет передать реестр иконок без потери точности типов
29
- * (`const`-type parameters сохраняют строковые литералы ключей).
30
- *
31
- * @typeParam TIcons - Тип реестра пользовательских иконок
32
- * @param icons - Реестр иконок проекта.
33
- * @returns Тот же реестр иконок с сохранёнными literal-типами.
34
- */
35
- export declare const defineIcons: <const TIcons extends TIconRegistry>(icons: TIcons) => TIcons;
@@ -1,8 +0,0 @@
1
- import { renderIconWithRegistry as e } from "./Icon.js";
2
- //#region src/icons/ssr/icon/Icon.create.tsx
3
- var t = (t) => {
4
- let n = (n) => e(n, t);
5
- return n.displayName = "SSRIcon", n;
6
- }, n = (e) => e;
7
- //#endregion
8
- export { t as createIcon, n as defineIcons };
@@ -1,6 +0,0 @@
1
- import type { IconProps } from "./Icon.types.js";
2
- /**
3
- * Server Component для встроенной npm-коллекции.
4
- * Не использует hooks/context и не требует `use client`.
5
- */
6
- export declare const Icon: (props: IconProps) => Promise<import("react").JSX.Element | null>;
@@ -1,27 +0,0 @@
1
- import { defaultIcons as e } from "./Icon.registry.js";
2
- import { IconContainer as t } from "./Icon.container.js";
3
- import { jsx as n } from "react/jsx-runtime";
4
- //#region src/icons/ssr/icon/Icon.tsx
5
- var r = (e, t) => Object.prototype.hasOwnProperty.call(e, t), i = async (t) => {
6
- if (!r(e, t)) return null;
7
- let n = e[t];
8
- return (await n()).default;
9
- }, a = async (e, a) => {
10
- let { name: o, size: s = 24, width: c, height: l, color: u = "var(--icon-color, currentColor)", secondaryColor: d = "var(--icon-secondary-color, currentColor)", deg: f = 0, ariaLabel: p, style: m } = e, h = String(o), g = (a && r(a, h) ? a[h] : void 0) ?? await i(h);
11
- return g ? /* @__PURE__ */ n(t, {
12
- ariaLabel: p,
13
- deg: f,
14
- height: l,
15
- size: s,
16
- style: m,
17
- width: c,
18
- children: /* @__PURE__ */ n(g, {
19
- "aria-hidden": "true",
20
- color: u,
21
- focusable: "false",
22
- secondaryColor: d
23
- })
24
- }) : (console.warn(`Иконка "${h}" не найдена`), null);
25
- }, o = (e) => a(e), s = a;
26
- //#endregion
27
- export { o as Icon, s as renderIconWithRegistry };
@@ -1,12 +0,0 @@
1
- /**
2
- * AUTO-GENERATED by scripts/sync-icons.mjs.
3
- * Source of truth: icons/source/*.svg.
4
- */
5
- export declare const defaultIcons: {
6
- readonly Icon123: () => Promise<typeof import("../../collection/Icon123Icon.js")>;
7
- readonly Icon24Hours: () => Promise<typeof import("../../collection/Icon24HoursIcon.js")>;
8
- readonly Icon2fa: () => Promise<typeof import("../../collection/Icon2faIcon.js")>;
9
- readonly Icon360: () => Promise<typeof import("../../collection/Icon360Icon.js")>;
10
- readonly Icon360View: () => Promise<typeof import("../../collection/Icon360ViewIcon.js")>;
11
- };
12
- export type TDefaultIconName = keyof typeof defaultIcons;
@@ -1,10 +0,0 @@
1
- //#region src/icons/ssr/icon/Icon.registry.ts
2
- var e = {
3
- Icon123: () => import("../../collection/Icon123Icon.js"),
4
- Icon24Hours: () => import("../../collection/Icon24HoursIcon.js"),
5
- Icon2fa: () => import("../../collection/Icon2faIcon.js"),
6
- Icon360: () => import("../../collection/Icon360Icon.js"),
7
- Icon360View: () => import("../../collection/Icon360ViewIcon.js")
8
- };
9
- //#endregion
10
- export { e as defaultIcons };
@@ -1,97 +0,0 @@
1
- import type { ComponentType, CSSProperties } from "react";
2
- import type { IIconComponentProps } from "../../collection/types.js";
3
- import type { TDefaultIconName } from "./Icon.registry.js";
4
- /**
5
- * React-компонент SVG-иконки.
6
- *
7
- * Принимает пропсы {@link IIconComponentProps} для настройки атрибутов и цвета.
8
- */
9
- export type TIcon = ComponentType<IIconComponentProps>;
10
- /**
11
- * Модуль отдельной иконки, загружаемый сервером.
12
- *
13
- * @property default - React-компонент иконки
14
- */
15
- export type TIconModule = {
16
- default: TIcon;
17
- };
18
- /**
19
- * Lazy loader встроенной иконки.
20
- *
21
- * Выполняет асинхронную загрузку модуля иконки через динамический `import()`.
22
- *
23
- * @returns Промис с модулем иконки
24
- */
25
- export type TIconLoader = () => Promise<TIconModule>;
26
- /**
27
- * Реестр lazy loader-ов, генерируемый из npm-коллекции.
28
- *
29
- * Ключ — имя иконки, значение — функция её асинхронной загрузки.
30
- */
31
- export type TIconLoaderRegistry = Readonly<Record<string, TIconLoader>>;
32
- /**
33
- * Синхронный реестр пользовательских иконок проекта.
34
- *
35
- * Ключ — имя иконки, значение — готовый React-компонент без ленивой загрузки.
36
- */
37
- export type TIconRegistry = Readonly<Record<string, TIcon>>;
38
- /**
39
- * Пустой registry без расширения `keyof` до `string`.
40
- *
41
- * Используется как значение по умолчанию в generic-параметрах для сохранения
42
- * строгой типизации.
43
- */
44
- export type TEmptyIconRegistry = Readonly<Record<never, never>>;
45
- /**
46
- * Встроенные npm-иконки + иконки, добавленные через `createIcon()`.
47
- *
48
- * @typeParam TCustomIcons - Реестр пользовательских иконок проекта
49
- */
50
- export type TIconName<TCustomIcons extends TIconRegistry = TEmptyIconRegistry> = TDefaultIconName | Extract<keyof TCustomIcons, string>;
51
- /**
52
- * Props SSR/RSC-компонента иконки.
53
- *
54
- * Интерактивные handlers намеренно отсутствуют, так как серверные
55
- * компоненты не обрабатывают события на клиенте.
56
- *
57
- * @typeParam TCustomIcons - Реестр пользовательских иконок проекта
58
- */
59
- export interface IconProps<TCustomIcons extends TIconRegistry = TEmptyIconRegistry> {
60
- /**
61
- * Атрибут `aria-label` для доступности
62
- */
63
- ariaLabel?: string;
64
- /**
65
- * Цвет иконки
66
- */
67
- color?: string;
68
- /**
69
- * Вторичный цвет двухцветной иконки
70
- */
71
- secondaryColor?: string;
72
- /**
73
- * Угол поворота в градусах
74
- */
75
- deg?: number;
76
- /**
77
- * Высота иконки (если нужен прямоугольник)
78
- */
79
- height?: number | string;
80
- /**
81
- * Имя иконки
82
- */
83
- name: TIconName<TCustomIcons>;
84
- /**
85
- * Размер иконки (квадратный, по умолчанию 24)
86
- */
87
- size?: number | string;
88
- /**
89
- * Инлайн-стили контейнера
90
- */
91
- style?: CSSProperties;
92
- /**
93
- * Ширина иконки (если нужен прямоугольник)
94
- */
95
- width?: number | string;
96
- }
97
- export type { IIconComponentProps };
@@ -1,10 +0,0 @@
1
- /**
2
- * Публичный API модуля иконок для SSR/RSC.
3
- *
4
- * Экспортирует компонент `Icon`, контейнер `IconContainer`, фабрику `createIcon`
5
- * и связанные типы для серверного рендеринга без React Context и `use client`.
6
- */
7
- export { Icon } from "./Icon.js";
8
- export { IconContainer, type IconContainerProps } from "./Icon.container.js";
9
- export { createIcon, defineIcons } from "./Icon.create.js";
10
- export type { IconProps, IIconComponentProps, TEmptyIconRegistry, TIcon, TIconLoader, TIconLoaderRegistry, TIconModule, TIconName, TIconRegistry, } from "./Icon.types.js";
@@ -1,6 +0,0 @@
1
- /**
2
- * React Server Components / SSR API.
3
- *
4
- * Здесь намеренно нет React Context, hooks и `use client` boundary.
5
- */
6
- export { Icon, IconContainer, createIcon, defineIcons, type IconContainerProps, type IconProps, type IIconComponentProps, type TEmptyIconRegistry, type TIcon, type TIconLoader, type TIconLoaderRegistry, type TIconModule, type TIconName, type TIconRegistry, } from "./icon/index.js";
package/dist/ssr/index.js DELETED
@@ -1,4 +0,0 @@
1
- import { IconContainer as e } from "./icon/Icon.container.js";
2
- import { Icon as t } from "./icon/Icon.js";
3
- import { createIcon as n, defineIcons as r } from "./icon/Icon.create.js";
4
- export { t as Icon, e as IconContainer, n as createIcon, r as defineIcons };