@symbiote-native/linear-gradient 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.
Files changed (75) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +196 -2
  3. package/build/angular/index.d.ts +2 -0
  4. package/build/angular/index.js +3 -0
  5. package/build/angular/linear-gradient/index.android.d.ts +4 -0
  6. package/build/angular/linear-gradient/index.android.js +67 -0
  7. package/build/angular/linear-gradient/index.d.ts +1 -0
  8. package/build/angular/linear-gradient/index.ios.d.ts +5 -0
  9. package/build/angular/linear-gradient/index.ios.js +76 -0
  10. package/build/angular/linear-gradient/index.js +2 -0
  11. package/build/angular/linear-gradient/shared.d.ts +12 -0
  12. package/build/angular/linear-gradient/shared.js +97 -0
  13. package/build/core/index.d.ts +1 -0
  14. package/build/core/index.js +1 -0
  15. package/build/core/linear-gradient.d.ts +33 -0
  16. package/build/core/linear-gradient.js +105 -0
  17. package/build/react/index.d.ts +3 -0
  18. package/build/react/index.js +3 -0
  19. package/build/react/linear-gradient.d.ts +9 -0
  20. package/build/react/linear-gradient.js +7 -0
  21. package/build/solid/index.d.ts +3 -0
  22. package/build/solid/index.js +3 -0
  23. package/build/solid/linear-gradient.d.ts +10 -0
  24. package/build/solid/linear-gradient.js +4 -0
  25. package/build/svelte/index.d.ts +3 -0
  26. package/build/svelte/index.js +3 -0
  27. package/build/svelte/linear-gradient-props.d.ts +6 -0
  28. package/build/svelte/linear-gradient-props.js +1 -0
  29. package/build/svelte/linear-gradient.svelte +10 -0
  30. package/build/svelte/linear-gradient.svelte.d.ts +4 -0
  31. package/build/vue/index.d.ts +3 -0
  32. package/build/vue/index.js +3 -0
  33. package/build/vue/linear-gradient.d.ts +6 -0
  34. package/build/vue/linear-gradient.js +16 -0
  35. package/build-ngc/angular/index.d.ts +2 -0
  36. package/build-ngc/angular/index.js +4 -0
  37. package/build-ngc/angular/index.js.map +1 -0
  38. package/build-ngc/angular/linear-gradient/index.android.d.ts +7 -0
  39. package/build-ngc/angular/linear-gradient/index.android.js +28 -0
  40. package/build-ngc/angular/linear-gradient/index.android.js.map +1 -0
  41. package/build-ngc/angular/linear-gradient/index.d.ts +1 -0
  42. package/build-ngc/angular/linear-gradient/index.ios.d.ts +8 -0
  43. package/build-ngc/angular/linear-gradient/index.ios.js +37 -0
  44. package/build-ngc/angular/linear-gradient/index.ios.js.map +1 -0
  45. package/build-ngc/angular/linear-gradient/index.js +3 -0
  46. package/build-ngc/angular/linear-gradient/index.js.map +1 -0
  47. package/build-ngc/angular/linear-gradient/shared.d.ts +15 -0
  48. package/build-ngc/angular/linear-gradient/shared.js +39 -0
  49. package/build-ngc/angular/linear-gradient/shared.js.map +1 -0
  50. package/build-ngc/core/index.d.ts +1 -0
  51. package/build-ngc/core/index.js +2 -0
  52. package/build-ngc/core/index.js.map +1 -0
  53. package/build-ngc/core/linear-gradient.d.ts +33 -0
  54. package/build-ngc/core/linear-gradient.js +106 -0
  55. package/build-ngc/core/linear-gradient.js.map +1 -0
  56. package/native-link.json +12 -0
  57. package/package.json +145 -3
  58. package/src/angular/index.ts +10 -0
  59. package/src/angular/linear-gradient/index.android.ts +17 -0
  60. package/src/angular/linear-gradient/index.ios.ts +32 -0
  61. package/src/angular/linear-gradient/index.ts +2 -0
  62. package/src/angular/linear-gradient/shared.ts +27 -0
  63. package/src/core/index.ts +10 -0
  64. package/src/core/linear-gradient.ts +183 -0
  65. package/src/react/index.ts +10 -0
  66. package/src/react/linear-gradient.ts +18 -0
  67. package/src/solid/index.ts +10 -0
  68. package/src/solid/linear-gradient.ts +17 -0
  69. package/src/svelte/index.ts +10 -0
  70. package/src/svelte/linear-gradient-props.ts +9 -0
  71. package/src/svelte/linear-gradient.svelte +10 -0
  72. package/src/svelte/svelte-ambient.d.ts +6 -0
  73. package/src/svelte/svelte-compile.test-helper.ts +6 -0
  74. package/src/vue/index.ts +10 -0
  75. package/src/vue/linear-gradient.ts +23 -0
@@ -0,0 +1,3 @@
1
+ export { LinearGradient } from './linear-gradient';
2
+ export type { ILinearGradientProps } from './linear-gradient';
3
+ export { LINEAR_GRADIENT_MODULE_NAME, linearGradientViewName, type ILinearGradientPoint, type INativeLinearGradientPoint, } from '../core';
@@ -0,0 +1,3 @@
1
+ // @symbiote-native/linear-gradient/react: компонент `LinearGradient` поверх общего ядра
2
+ export { LinearGradient } from './linear-gradient.js';
3
+ export { LINEAR_GRADIENT_MODULE_NAME, linearGradientViewName, } from '../core/index.js';
@@ -0,0 +1,9 @@
1
+ import type { ReactElement, ReactNode } from 'react';
2
+ import type { IViewProps } from '@symbiote-native/react';
3
+ import type { ILinearGradientProps as ILinearGradientBaseProps } from '../core/linear-gradient';
4
+ export type ILinearGradientProps = ILinearGradientBaseProps & Omit<IViewProps, keyof ILinearGradientBaseProps | 'children'> & {
5
+ children?: ReactNode;
6
+ className?: string;
7
+ };
8
+ /** React twin of `expo-linear-gradient`'s `LinearGradient`, children paint over the gradient */
9
+ export declare function LinearGradient(props: ILinearGradientProps): ReactElement;
@@ -0,0 +1,7 @@
1
+ import { descriptorToReactWithChildren } from '@symbiote-native/react';
2
+ import { renderLinearGradient } from '../core/linear-gradient.js';
3
+ /** React twin of `expo-linear-gradient`'s `LinearGradient`, children paint over the gradient */
4
+ export function LinearGradient(props) {
5
+ const { children, ...rest } = props;
6
+ return descriptorToReactWithChildren(renderLinearGradient(rest), children);
7
+ }
@@ -0,0 +1,3 @@
1
+ export { LinearGradient } from './linear-gradient';
2
+ export type { ILinearGradientProps } from './linear-gradient';
3
+ export { LINEAR_GRADIENT_MODULE_NAME, linearGradientViewName, type ILinearGradientPoint, type INativeLinearGradientPoint, } from '../core';
@@ -0,0 +1,3 @@
1
+ // @symbiote-native/linear-gradient/solid: компонент `LinearGradient` поверх общего ядра
2
+ export { LinearGradient } from './linear-gradient.js';
3
+ export { LINEAR_GRADIENT_MODULE_NAME, linearGradientViewName, } from '../core/index.js';
@@ -0,0 +1,10 @@
1
+ import type { JSX } from 'solid-js';
2
+ import type { IViewProps } from '@symbiote-native/solid';
3
+ import type { IClassNameValue } from '@symbiote-native/engine';
4
+ import type { ILinearGradientProps as ILinearGradientBaseProps } from '../core/linear-gradient';
5
+ export type ILinearGradientProps = ILinearGradientBaseProps & Omit<IViewProps, keyof ILinearGradientBaseProps | 'children' | 'ref'> & {
6
+ children?: JSX.Element;
7
+ class?: IClassNameValue;
8
+ };
9
+ /** Solid twin of `expo-linear-gradient`'s `LinearGradient`, children paint over the gradient */
10
+ export declare const LinearGradient: (props: ILinearGradientProps) => import("@symbiote-native/engine").ISymbioteNode;
@@ -0,0 +1,4 @@
1
+ import { defineDescriptorComponent } from '@symbiote-native/solid';
2
+ import { renderLinearGradient } from '../core/linear-gradient.js';
3
+ /** Solid twin of `expo-linear-gradient`'s `LinearGradient`, children paint over the gradient */
4
+ export const LinearGradient = defineDescriptorComponent(renderLinearGradient);
@@ -0,0 +1,3 @@
1
+ export { default as LinearGradient } from './linear-gradient.svelte';
2
+ export type { ILinearGradientProps } from './linear-gradient-props';
3
+ export { LINEAR_GRADIENT_MODULE_NAME, linearGradientViewName, type ILinearGradientPoint, type INativeLinearGradientPoint, } from '../core';
@@ -0,0 +1,3 @@
1
+ // @symbiote-native/linear-gradient/svelte: компонент `LinearGradient` поверх общего ядра
2
+ export { default as LinearGradient } from './linear-gradient.svelte';
3
+ export { LINEAR_GRADIENT_MODULE_NAME, linearGradientViewName, } from '../core/index.js';
@@ -0,0 +1,6 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { IViewProps } from '@symbiote-native/svelte';
3
+ import type { ILinearGradientProps as ILinearGradientBaseProps } from '../core/linear-gradient';
4
+ export type ILinearGradientProps = ILinearGradientBaseProps & Omit<IViewProps, keyof ILinearGradientBaseProps | 'children'> & {
5
+ children?: Snippet;
6
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ <script lang="ts">
2
+ import DescriptorHost from '@symbiote-native/svelte/descriptor-host';
3
+ import { renderLinearGradient } from '../core/linear-gradient';
4
+ import type { ILinearGradientProps } from './linear-gradient-props';
5
+
6
+ const { children, ...rest }: ILinearGradientProps = $props();
7
+ const descriptor = $derived(renderLinearGradient({ ...rest }));
8
+ </script>
9
+
10
+ <DescriptorHost {descriptor} {children} />
@@ -0,0 +1,4 @@
1
+ import type { ILinearGradientProps } from './linear-gradient-props';
2
+ declare const LinearGradient: import("svelte").Component<ILinearGradientProps, {}, "">;
3
+ type LinearGradient = ReturnType<typeof LinearGradient>;
4
+ export default LinearGradient;
@@ -0,0 +1,3 @@
1
+ export { LinearGradient } from './linear-gradient';
2
+ export type { ILinearGradientProps } from './linear-gradient';
3
+ export { LINEAR_GRADIENT_MODULE_NAME, linearGradientViewName, type ILinearGradientPoint, type INativeLinearGradientPoint, } from '../core';
@@ -0,0 +1,3 @@
1
+ // @symbiote-native/linear-gradient/vue: компонент `LinearGradient` поверх общего ядра
2
+ export { LinearGradient } from './linear-gradient.js';
3
+ export { LINEAR_GRADIENT_MODULE_NAME, linearGradientViewName, } from '../core/index.js';
@@ -0,0 +1,6 @@
1
+ import { type VNode } from '@vue/runtime-core';
2
+ import type { IViewProps } from '@symbiote-native/vue';
3
+ import type { ILinearGradientProps as ILinearGradientBaseProps } from '../core/linear-gradient';
4
+ export type ILinearGradientProps = ILinearGradientBaseProps & Omit<IViewProps, keyof ILinearGradientBaseProps>;
5
+ /** Vue twin of `expo-linear-gradient`'s `LinearGradient`, the default slot paints over it */
6
+ export declare const LinearGradient: import("vue").DefineComponent<{}, () => VNode, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,16 @@
1
+ import { defineComponent } from '@vue/runtime-core';
2
+ import { descriptorToVue, normalizeVueAttrs } from '@symbiote-native/vue';
3
+ import { renderLinearGradient } from '../core/linear-gradient.js';
4
+ /** Vue twin of `expo-linear-gradient`'s `LinearGradient`, the default slot paints over it */
5
+ export const LinearGradient = defineComponent({
6
+ name: 'LinearGradient',
7
+ // Все атрибуты это пропсы нативного view, на обёртку ничего не должно просочиться
8
+ inheritAttrs: false,
9
+ setup(_props, { attrs, slots }) {
10
+ return () => {
11
+ const descriptor = renderLinearGradient(normalizeVueAttrs(attrs));
12
+ // Слот приложения идёт в корень после собственных детей дескриптора
13
+ return descriptorToVue(descriptor, slots.default?.() ?? []);
14
+ };
15
+ },
16
+ });
@@ -0,0 +1,2 @@
1
+ export { LinearGradient } from './linear-gradient';
2
+ export { LINEAR_GRADIENT_MODULE_NAME, linearGradientViewName, type ILinearGradientProps, type ILinearGradientPoint, type INativeLinearGradientPoint, } from '../core';
@@ -0,0 +1,4 @@
1
+ // @symbiote-native/linear-gradient/angular: компонент `LinearGradient` поверх общего ядра
2
+ export { LinearGradient } from './linear-gradient';
3
+ export { LINEAR_GRADIENT_MODULE_NAME, linearGradientViewName, } from '../core';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/angular/index.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAE1F,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EACL,2BAA2B,EAC3B,sBAAsB,GAIvB,MAAM,SAAS,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { LinearGradientBase } from './shared';
2
+ import * as i0 from "@angular/core";
3
+ /** Angular twin of `expo-linear-gradient`'s `LinearGradient`, a View wraps the gradient leaf */
4
+ export declare class LinearGradient extends LinearGradientBase {
5
+ static ɵfac: i0.ɵɵFactoryDeclaration<LinearGradient, never>;
6
+ static ɵcmp: i0.ɵɵComponentDeclaration<LinearGradient, "LinearGradient", never, {}, {}, never, ["*"], true, never>;
7
+ }
@@ -0,0 +1,28 @@
1
+ import { ChangeDetectionStrategy, Component } from '@angular/core';
2
+ import { DescriptorHost } from '@symbiote-native/angular';
3
+ import { LinearGradientBase } from './shared';
4
+ import * as i0 from "@angular/core";
5
+ /** Angular twin of `expo-linear-gradient`'s `LinearGradient`, a View wraps the gradient leaf */
6
+ export class LinearGradient extends LinearGradientBase {
7
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: LinearGradient, deps: null, target: i0.ɵɵFactoryTarget.Component });
8
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: LinearGradient, isStandalone: true, selector: "LinearGradient", usesInheritance: true, ngImport: i0, template: `@if (descriptor; as node) {
9
+ <symbiote-descriptor-host [node]="node"
10
+ ><ng-content
11
+ /></symbiote-descriptor-host>
12
+ }`, isInline: true, dependencies: [{ kind: "component", type: DescriptorHost, selector: "symbiote-descriptor-host", inputs: ["node"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
13
+ }
14
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: LinearGradient, decorators: [{
15
+ type: Component,
16
+ args: [{
17
+ selector: 'LinearGradient',
18
+ standalone: true,
19
+ imports: [DescriptorHost],
20
+ changeDetection: ChangeDetectionStrategy.OnPush,
21
+ template: `@if (descriptor; as node) {
22
+ <symbiote-descriptor-host [node]="node"
23
+ ><ng-content
24
+ /></symbiote-descriptor-host>
25
+ }`,
26
+ }]
27
+ }] });
28
+ //# sourceMappingURL=index.android.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.android.js","sourceRoot":"","sources":["../../../src/angular/linear-gradient/index.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;;AAE9C,gGAAgG;AAYhG,MAAM,OAAO,cAAe,SAAQ,kBAAkB;uGAAzC,cAAc;2FAAd,cAAc,iGANf;;;;IAIR,4DANQ,cAAc;;2FAQb,cAAc;kBAX1B,SAAS;mBAAC;oBACT,QAAQ,EAAE,gBAAgB;oBAC1B,UAAU,EAAE,IAAI;oBAChB,OAAO,EAAE,CAAC,cAAc,CAAC;oBACzB,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,QAAQ,EAAE;;;;IAIR;iBACH"}
@@ -0,0 +1 @@
1
+ export { LinearGradient } from './index.ios';
@@ -0,0 +1,8 @@
1
+ import { LinearGradientBase } from './shared';
2
+ import * as i0 from "@angular/core";
3
+ /** Angular twin of `expo-linear-gradient`'s `LinearGradient`, children go inside the native view */
4
+ export declare class LinearGradient extends LinearGradientBase {
5
+ constructor();
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<LinearGradient, never>;
7
+ static ɵcmp: i0.ɵɵComponentDeclaration<LinearGradient, "LinearGradient", never, {}, {}, never, ["*"], true, never>;
8
+ }
@@ -0,0 +1,37 @@
1
+ import { ChangeDetectionStrategy, Component, NO_ERRORS_SCHEMA, } from '@angular/core';
2
+ import { SymbioteHostPropsDirective } from '@symbiote-native/angular';
3
+ import { warnIfViewNameIsDynamic } from '@symbiote-native/engine';
4
+ import { LINEAR_GRADIENT_MODULE_NAME } from '../../core';
5
+ import { LinearGradientBase } from './shared';
6
+ import * as i0 from "@angular/core";
7
+ const TEMPLATE_TAG = 'ViewManagerAdapter_ExpoLinearGradient';
8
+ /** Angular twin of `expo-linear-gradient`'s `LinearGradient`, children go inside the native view */
9
+ export class LinearGradient extends LinearGradientBase {
10
+ constructor() {
11
+ super();
12
+ warnIfViewNameIsDynamic(TEMPLATE_TAG, LINEAR_GRADIENT_MODULE_NAME);
13
+ }
14
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: LinearGradient, deps: [], target: i0.ɵɵFactoryTarget.Component });
15
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: LinearGradient, isStandalone: true, selector: "LinearGradient", usesInheritance: true, ngImport: i0, template: `@if (descriptor; as node) {
16
+ <ViewManagerAdapter_ExpoLinearGradient [symbioteHostProps]="node.props">
17
+ <ng-content />
18
+ </ViewManagerAdapter_ExpoLinearGradient>
19
+ }`, isInline: true, dependencies: [{ kind: "directive", type: SymbioteHostPropsDirective, selector: "[symbioteHostProps]", inputs: ["symbioteHostProps"], exportAs: ["symbioteHost"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
20
+ }
21
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: LinearGradient, decorators: [{
22
+ type: Component,
23
+ args: [{
24
+ selector: 'LinearGradient',
25
+ standalone: true,
26
+ imports: [SymbioteHostPropsDirective],
27
+ schemas: [NO_ERRORS_SCHEMA],
28
+ changeDetection: ChangeDetectionStrategy.OnPush,
29
+ // Имя тега это нативное имя view, его нельзя собрать динамически
30
+ template: `@if (descriptor; as node) {
31
+ <ViewManagerAdapter_ExpoLinearGradient [symbioteHostProps]="node.props">
32
+ <ng-content />
33
+ </ViewManagerAdapter_ExpoLinearGradient>
34
+ }`,
35
+ }]
36
+ }], ctorParameters: () => [] });
37
+ //# sourceMappingURL=index.ios.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.ios.js","sourceRoot":"","sources":["../../../src/angular/linear-gradient/index.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;;AAE9C,MAAM,YAAY,GAAG,uCAAuC,CAAC;AAE7D,oGAAoG;AAcpG,MAAM,OAAO,cAAe,SAAQ,kBAAkB;IACpD;QACE,KAAK,EAAE,CAAC;QACR,uBAAuB,CAAC,YAAY,EAAE,2BAA2B,CAAC,CAAC;IACrE,CAAC;uGAJU,cAAc;2FAAd,cAAc,iGANf;;;;IAIR,4DARQ,0BAA0B;;2FAUzB,cAAc;kBAb1B,SAAS;mBAAC;oBACT,QAAQ,EAAE,gBAAgB;oBAC1B,UAAU,EAAE,IAAI;oBAChB,OAAO,EAAE,CAAC,0BAA0B,CAAC;oBACrC,OAAO,EAAE,CAAC,gBAAgB,CAAC;oBAC3B,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,iEAAiE;oBACjE,QAAQ,EAAE;;;;IAIR;iBACH"}
@@ -0,0 +1,3 @@
1
+ // Базовая точка для headless и tsc, Metro берёт `index.ios` или `index.android`
2
+ export { LinearGradient } from './index.ios';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/angular/linear-gradient/index.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { NativeViewBase } from '@symbiote-native/angular';
2
+ import type { IDescriptor } from '@symbiote-native/components';
3
+ import type { ILinearGradientProps } from '../../core/linear-gradient';
4
+ import * as i0 from "@angular/core";
5
+ export declare abstract class LinearGradientBase extends NativeViewBase {
6
+ colors: ILinearGradientProps['colors'];
7
+ locations?: ILinearGradientProps['locations'];
8
+ start?: ILinearGradientProps['start'];
9
+ end?: ILinearGradientProps['end'];
10
+ dither?: ILinearGradientProps['dither'];
11
+ protected readonly propNames: readonly ["colors", "locations", "start", "end", "dither"];
12
+ protected renderView(props: object): IDescriptor;
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<LinearGradientBase, never>;
14
+ static ɵdir: i0.ɵɵDirectiveDeclaration<LinearGradientBase, never, never, { "colors": { "alias": "colors"; "required": true; }; "locations": { "alias": "locations"; "required": false; }; "start": { "alias": "start"; "required": false; }; "end": { "alias": "end"; "required": false; }; "dither": { "alias": "dither"; "required": false; }; }, {}, never, never, true, never>;
15
+ }
@@ -0,0 +1,39 @@
1
+ import { Directive, Input } from '@angular/core';
2
+ import { NativeViewBase } from '@symbiote-native/angular';
3
+ import { renderLinearGradient } from '../../core/linear-gradient';
4
+ import * as i0 from "@angular/core";
5
+ // Inputs и сборка дескриптора общие, платформы различаются только шаблоном
6
+ export class LinearGradientBase extends NativeViewBase {
7
+ colors;
8
+ locations;
9
+ start;
10
+ end;
11
+ dither;
12
+ propNames = [
13
+ 'colors',
14
+ 'locations',
15
+ 'start',
16
+ 'end',
17
+ 'dither',
18
+ ];
19
+ renderView(props) {
20
+ return renderLinearGradient(props);
21
+ }
22
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: LinearGradientBase, deps: null, target: i0.ɵɵFactoryTarget.Directive });
23
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.8", type: LinearGradientBase, isStandalone: true, inputs: { colors: "colors", locations: "locations", start: "start", end: "end", dither: "dither" }, usesInheritance: true, ngImport: i0 });
24
+ }
25
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: LinearGradientBase, decorators: [{
26
+ type: Directive
27
+ }], propDecorators: { colors: [{
28
+ type: Input,
29
+ args: [{ required: true }]
30
+ }], locations: [{
31
+ type: Input
32
+ }], start: [{
33
+ type: Input
34
+ }], end: [{
35
+ type: Input
36
+ }], dither: [{
37
+ type: Input
38
+ }] } });
39
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/angular/linear-gradient/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;;AAGlE,2EAA2E;AAE3E,MAAM,OAAgB,kBAAmB,SAAQ,cAAc;IAClC,MAAM,CAAkC;IAC1D,SAAS,CAAqC;IAC9C,KAAK,CAAiC;IACtC,GAAG,CAA+B;IAClC,MAAM,CAAkC;IAErB,SAAS,GAAG;QACtC,QAAQ;QACR,WAAW;QACX,OAAO;QACP,KAAK;QACL,QAAQ;KACgD,CAAC;IAExC,UAAU,CAAC,KAAa;QACzC,OAAO,oBAAoB,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;uGAjBmB,kBAAkB;2FAAlB,kBAAkB;;2FAAlB,kBAAkB;kBADvC,SAAS;;sBAEP,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBACxB,KAAK;;sBACL,KAAK;;sBACL,KAAK;;sBACL,KAAK"}
@@ -0,0 +1 @@
1
+ export { LINEAR_GRADIENT_MODULE_NAME, ensureLinearGradientRegistered, linearGradientViewName, normalizePoint, renderLinearGradient, type ILinearGradientPoint, type ILinearGradientProps, type INativeLinearGradientPoint, } from './linear-gradient';
@@ -0,0 +1,2 @@
1
+ export { LINEAR_GRADIENT_MODULE_NAME, ensureLinearGradientRegistered, linearGradientViewName, normalizePoint, renderLinearGradient, } from './linear-gradient';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,8BAA8B,EAC9B,sBAAsB,EACtB,cAAc,EACd,oBAAoB,GAIrB,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,33 @@
1
+ import type { IAccessibilityProps, IAriaProps, IDescriptor, IResponderProps } from '@symbiote-native/components';
2
+ import type { IColorValue, IStyleProp, ISymbioteEvent, IViewStyle } from '@symbiote-native/engine';
3
+ export declare const LINEAR_GRADIENT_MODULE_NAME = "ExpoLinearGradient";
4
+ export type INativeLinearGradientPoint = [x: number, y: number];
5
+ /** Доли размера градиента от 0 до 1, объект `{ x, y }` или пара `[x, y]` */
6
+ export type ILinearGradientPoint = {
7
+ x: number;
8
+ y: number;
9
+ } | INativeLinearGradientPoint;
10
+ export type ILinearGradientProps = IAccessibilityProps & IAriaProps & IResponderProps & {
11
+ /** Минимум два цвета, для одного используйте `style.backgroundColor` у View */
12
+ colors: readonly [IColorValue, IColorValue, ...IColorValue[]];
13
+ /** Позиции остановок от 0 до 1 по возрастанию, той же длины, что и `colors` */
14
+ locations?: readonly [number, number, ...number[]] | null;
15
+ /** @default { x: 0.5, y: 0.0 } */
16
+ start?: ILinearGradientPoint | null;
17
+ /** @default { x: 0.5, y: 1.0 } */
18
+ end?: ILinearGradientPoint | null;
19
+ /**
20
+ * Дизеринг убирает полосы в градиенте, false может ускорить отрисовку
21
+ * @default true
22
+ * @platform android
23
+ */
24
+ dither?: boolean;
25
+ style?: IStyleProp<IViewStyle>;
26
+ testID?: string;
27
+ nativeID?: string;
28
+ onLayout?: (event: ISymbioteEvent) => void;
29
+ };
30
+ export declare function linearGradientViewName(): string;
31
+ export declare function ensureLinearGradientRegistered(): boolean;
32
+ export declare function normalizePoint(point: unknown): INativeLinearGradientPoint | undefined;
33
+ export declare function renderLinearGradient(props: object): IDescriptor;
@@ -0,0 +1,106 @@
1
+ // Ядро `LinearGradient`, порт `LinearGradient.tsx` из expo-linear-gradient
2
+ import { Platform, requireNativeViewManager } from 'expo-modules-core';
3
+ import { el } from '@symbiote-native/components';
4
+ import { expoViewManagerName, flattenStyle, processColor, styleOfProps, tryRegisterNativeView, } from '@symbiote-native/engine';
5
+ export const LINEAR_GRADIENT_MODULE_NAME = 'ExpoLinearGradient';
6
+ // Эти ключи разбираются здесь, остальное уходит на хост как есть
7
+ const GRADIENT_KEYS = new Set([
8
+ 'colors',
9
+ 'locations',
10
+ 'start',
11
+ 'end',
12
+ 'dither',
13
+ ]);
14
+ const ABSOLUTE_FILL = {
15
+ position: 'absolute',
16
+ left: 0,
17
+ right: 0,
18
+ top: 0,
19
+ bottom: 0,
20
+ };
21
+ export function linearGradientViewName() {
22
+ return expoViewManagerName(LINEAR_GRADIENT_MODULE_NAME);
23
+ }
24
+ // Регистрирует view config в реестре RN, из него движок берёт события и процессоры пропсов
25
+ // Зовётся при рендере, а не при импорте: регистрация в побочном эффекте барреля теряется в release
26
+ export function ensureLinearGradientRegistered() {
27
+ return tryRegisterNativeView(() => requireNativeViewManager(LINEAR_GRADIENT_MODULE_NAME));
28
+ }
29
+ function isNumber(value) {
30
+ return typeof value === 'number';
31
+ }
32
+ export function normalizePoint(point) {
33
+ if (!point)
34
+ return undefined;
35
+ if (Array.isArray(point)) {
36
+ const [x, y] = point;
37
+ if (point.length === 2 && isNumber(x) && isNumber(y))
38
+ return [x, y];
39
+ console.warn('start and end props for LinearGradient must be of the format [x,y] or {x, y}');
40
+ return undefined;
41
+ }
42
+ const x = Reflect.get(Object(point), 'x');
43
+ const y = Reflect.get(Object(point), 'y');
44
+ return isNumber(x) && isNumber(y) ? [x, y] : undefined;
45
+ }
46
+ function resolveLocations(colors, locations) {
47
+ if (!Array.isArray(locations))
48
+ return undefined;
49
+ if (locations.length === colors.length)
50
+ return locations;
51
+ console.warn('LinearGradient colors and locations props should be arrays of the same length');
52
+ return locations.slice(0, colors.length);
53
+ }
54
+ function radiusOr(value, fallback) {
55
+ return isNumber(value) ? value : fallback;
56
+ }
57
+ // Формат из `Path.addRoundRect`: по два значения на угол, начиная с верхнего левого
58
+ function borderRadiiOf(style) {
59
+ const flat = flattenStyle(style) ?? {};
60
+ const base = radiusOr(flat.borderRadius, 0);
61
+ const topLeft = radiusOr(flat.borderTopLeftRadius, base);
62
+ const topRight = radiusOr(flat.borderTopRightRadius, base);
63
+ const bottomRight = radiusOr(flat.borderBottomRightRadius, base);
64
+ const bottomLeft = radiusOr(flat.borderBottomLeftRadius, base);
65
+ return [
66
+ topLeft,
67
+ topLeft,
68
+ topRight,
69
+ topRight,
70
+ bottomRight,
71
+ bottomRight,
72
+ bottomLeft,
73
+ bottomLeft,
74
+ ];
75
+ }
76
+ function withoutUndefined(props) {
77
+ return Object.fromEntries(Object.entries(props).filter(([, value]) => value !== undefined));
78
+ }
79
+ // `object`, а не тип пропсов: Vue и Angular отдают нетипизированный набор атрибутов
80
+ export function renderLinearGradient(props) {
81
+ const hostProps = Object.fromEntries(Object.entries(props).filter(([key]) => !GRADIENT_KEYS.has(key)));
82
+ if (!ensureLinearGradientRegistered()) {
83
+ console.warn('LinearGradient is not available on this platform');
84
+ return el('view', hostProps);
85
+ }
86
+ const colors = Reflect.get(props, 'colors');
87
+ const colorList = Array.isArray(colors) ? colors : [];
88
+ const nativeProps = withoutUndefined({
89
+ colors: colorList.map(color => processColor(color)),
90
+ locations: resolveLocations(colorList, Reflect.get(props, 'locations')),
91
+ startPoint: normalizePoint(Reflect.get(props, 'start')),
92
+ endPoint: normalizePoint(Reflect.get(props, 'end')),
93
+ });
94
+ if (!Platform.select({ android: true, default: false })) {
95
+ return el(linearGradientViewName(), { ...hostProps, ...nativeProps });
96
+ }
97
+ // Нативный градиент заполняет View и сам скругляет углы, т.к. RN не обрезает по радиусу
98
+ const native = el(linearGradientViewName(), withoutUndefined({
99
+ ...nativeProps,
100
+ style: ABSOLUTE_FILL,
101
+ borderRadii: borderRadiiOf(styleOfProps(props)),
102
+ dither: Reflect.get(props, 'dither'),
103
+ }));
104
+ return el('view', hostProps, [native]);
105
+ }
106
+ //# sourceMappingURL=linear-gradient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linear-gradient.js","sourceRoot":"","sources":["../../src/core/linear-gradient.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,OAAO,EAAE,QAAQ,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,EAAE,EAAE,MAAM,6BAA6B,CA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AgB,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QACvE,UAAU,EAAE,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACvD,QAAQ,EAAE,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;KACpD,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QACxD,OAAO,EAAE,CAAC,sBAAsB,EAAE,EAAE,EAAE,GAAG,SAAS,EAAE,GAAG,WAAW,EAAE,CAAC,CAAC;IACxE,CAAC;IAED,wFAAwF;IACxF,MAAM,MAAM,GAAG,EAAE,CACf,sBAAsB,EAAE,EACxB,gBAAgB,CAAC;QACf,GAAG,WAAW;QACd,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,aAAa,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QAC/C,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC;KACrC,CAAC,CACH,CAAC;IACF,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,12 @@
1
+ {
2
+ "android": {
3
+ "gradleProjectName": "expo-linear-gradient",
4
+ "modules": [
5
+ {
6
+ "importPath": "expo.modules.lineargradient.LinearGradientModule",
7
+ "className": "LinearGradientModule",
8
+ "nativeName": "ExpoLinearGradient"
9
+ }
10
+ ]
11
+ }
12
+ }