Skip to content

Commit

Permalink
feat: simply exports for services, transitions and utils
Browse files Browse the repository at this point in the history
  • Loading branch information
quentinderoubaix committed Jul 31, 2024
1 parent d26b366 commit df95903
Show file tree
Hide file tree
Showing 132 changed files with 326 additions and 349 deletions.
2 changes: 1 addition & 1 deletion angular/bootstrap/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export type {ToastContext, ToastProps, ToastState, ToastWidget, ToastApi, ToastD
export {createToast, getToastDefaultConfig} from './components/toast';
export * from './components/toast';

export * from '@agnos-ui/core-bootstrap/services/transitions';
export * from '@agnos-ui/core-bootstrap/transitions';
export * from '@agnos-ui/core-bootstrap/types';

export type {WidgetsConfig} from './config';
Expand Down
7 changes: 7 additions & 0 deletions angular/headless/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,10 @@
* Public API Surface of @agnos-ui/angular-headless
*/
export * from './generated';

export * from './config';
export * from './slot.directive';
export * from './types';
export * from './services';
export * from './transitions';
export * from './utils';
1 change: 1 addition & 0 deletions angular/headless/src/services/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@agnos-ui/core/services';
Empty file added angular/headless/src/slot.ts
Empty file.
1 change: 1 addition & 0 deletions angular/headless/src/transitions/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@agnos-ui/core/transitions';
4 changes: 1 addition & 3 deletions angular/headless/src/utils/directive.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import type {Directive as AgnosUIDirective, DirectiveAndParam, DirectivesAndOptParam} from '@agnos-ui/core/types';
import {multiDirective} from '@agnos-ui/core/utils/directive';
import {multiDirective} from '@agnos-ui/core/utils';
import {isPlatformServer} from '@angular/common';
import type {OnChanges} from '@angular/core';
import {DestroyRef, Directive, ElementRef, Injector, Input, PLATFORM_ID, afterNextRender, inject, runInInjectionContext} from '@angular/core';

export * from '@agnos-ui/core/utils/directive';

/**
* Set up an agnos-ui directive as an angular host directive.
*
Expand Down
6 changes: 6 additions & 0 deletions angular/headless/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export * from '@agnos-ui/core/utils';
export * from './coercion';
export * from './directive';
export * from './stores';
export * from './widget';
export * from './zone';
2 changes: 0 additions & 2 deletions angular/headless/src/utils/stores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import type {Signal} from '@angular/core';
import {DestroyRef, inject, signal} from '@angular/core';
import {ZoneWrapper} from './zone';

export * from '@agnos-ui/core/utils/stores';

/**
* Convert a tansu readable signal into an Angular signal.
*
Expand Down
3 changes: 2 additions & 1 deletion angular/headless/src/utils/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
type WidgetProps,
type WidgetState,
} from '../types';
import {toAngularSignal, toReadableStore} from './stores';
import {toAngularSignal} from './stores';
import {toReadableStore} from '@agnos-ui/core/utils';
import {ZoneWrapper} from './zone';

const createPatchSlots = <T extends object>(set: (object: Partial<T>) => void) => {
Expand Down
2 changes: 1 addition & 1 deletion common/propsValues.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {getPaginationDefaultConfig, getRatingDefaultConfig} from '@agnos-ui/core-bootstrap';
import {collapseVerticalTransition, fadeTransition} from '@agnos-ui/core-bootstrap/services/transitions';
import {collapseVerticalTransition, fadeTransition} from '@agnos-ui/core-bootstrap/transitions';

export type PropsValues = keyof typeof propsValuesList;

Expand Down
2 changes: 1 addition & 1 deletion common/samples/directives/sample-directive.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type {Directive} from '@agnos-ui/core/types';
import {browserDirective} from '@agnos-ui/core/utils/directive';
import {browserDirective} from '@agnos-ui/core/utils';

export const createSampleDirective: Directive<string> = browserDirective((element: HTMLElement, text: string) => {
console.log('Directive has been executed on node ', element.id);
Expand Down
8 changes: 4 additions & 4 deletions core-bootstrap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
"require": "./dist/components/*/index.cjs",
"default": "./dist/components/*/index.js"
},
"./services/transitions": {
"types": "./dist/services/transitions/index.d.ts",
"require": "./dist/services/transitions/index.cjs",
"default": "./dist/services/transitions/index.js"
"./transitions": {
"types": "./dist/transitions/index.d.ts",
"require": "./dist/transitions/index.cjs",
"default": "./dist/transitions/index.js"
},
"./config": {
"types": "./dist/config.d.ts",
Expand Down
6 changes: 3 additions & 3 deletions core-bootstrap/src/components/accordion/accordion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import {
createAccordionItem as createCoreAccordionItem,
getAccordionDefaultConfig as getCoreDefaultConfig,
} from '@agnos-ui/core/components/accordion';
import {collapseVerticalTransition} from '../../services/transitions';
import {extendWidgetProps} from '@agnos-ui/core/services/extendWidget';
import {collapseVerticalTransition} from '../../transitions';
import {extendWidgetProps} from '@agnos-ui/core/services';
import type {SlotContent, Widget, WidgetFactory, WidgetSlotContext} from '@agnos-ui/core/types';
import type {TransitionFn} from '@agnos-ui/core/services/transitions/baseTransitions';
import type {TransitionFn} from '@agnos-ui/core/transitions';

export * from '@agnos-ui/core/components/accordion';

Expand Down
8 changes: 4 additions & 4 deletions core-bootstrap/src/components/alert/alert.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type {AlertDirectives, AlertState as CoreState, AlertProps as CoreProps, AlertApi} from '@agnos-ui/core/components/alert';
import {createAlert as createCoreAlert, getAlertDefaultConfig as getCoreDefaultConfig} from '@agnos-ui/core/components/alert';
import type {ConfigValidator, SlotContent, Widget, WidgetFactory, WidgetSlotContext} from '@agnos-ui/core/types';
import {typeString} from '@agnos-ui/core/utils/writables';
import {extendWidgetProps} from '@agnos-ui/core/services/extendWidget';
import {fadeTransition} from '../../services/transitions';
import {typeString} from '@agnos-ui/core/utils';
import {extendWidgetProps} from '@agnos-ui/core/services';
import {fadeTransition} from '../../transitions';
import type {BSContextualClass} from '../../types';
import type {TransitionFn} from '@agnos-ui/core/services/transitions/baseTransitions';
import type {TransitionFn} from '@agnos-ui/core/transitions';

export * from '@agnos-ui/core/components/alert';

Expand Down
8 changes: 4 additions & 4 deletions core-bootstrap/src/components/modal/modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import type {
} from '@agnos-ui/core/components/modal';
import {createModal as createCoreModal, getModalDefaultConfig as getCoreDefaultConfig} from '@agnos-ui/core/components/modal';
import type {ConfigValidator, PropsConfig, SlotContent, Widget, WidgetSlotContext} from '@agnos-ui/core/types';
import {fadeTransition} from '../../services/transitions';
import {extendWidgetProps} from '@agnos-ui/core/services/extendWidget';
import {typeBoolean} from '@agnos-ui/core/utils/writables';
import type {TransitionFn} from '@agnos-ui/core/services/transitions/baseTransitions';
import {fadeTransition} from '../../transitions';
import {extendWidgetProps} from '@agnos-ui/core/services';
import {typeBoolean} from '@agnos-ui/core/utils';
import type {TransitionFn} from '@agnos-ui/core/transitions';

export * from '@agnos-ui/core/components/modal';

Expand Down
2 changes: 1 addition & 1 deletion core-bootstrap/src/components/pagination/pagination.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {extendWidgetProps} from '@agnos-ui/core/services/extendWidget';
import {extendWidgetProps} from '@agnos-ui/core/services';
import type {SlotContent, Widget, WidgetFactory, WidgetSlotContext} from '@agnos-ui/core/types';
import type {
PaginationActions,
Expand Down
4 changes: 2 additions & 2 deletions core-bootstrap/src/components/progressbar/progressbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import type {
} from '@agnos-ui/core/components/progressbar';
import {createProgressbar as createCoreProgressbar, getProgressbarDefaultConfig as getCoreDefaultConfig} from '@agnos-ui/core/components/progressbar';
import type {ConfigValidator, SlotContent, Widget, WidgetFactory, WidgetSlotContext} from '@agnos-ui/core/types';
import {typeBoolean, typeString} from '@agnos-ui/core/utils/writables';
import {extendWidgetProps} from '@agnos-ui/core/services/extendWidget';
import {typeBoolean, typeString} from '@agnos-ui/core/utils';
import {extendWidgetProps} from '@agnos-ui/core/services';
import type {BSContextualClass} from '../../types';

export * from '@agnos-ui/core/components/progressbar';
Expand Down
2 changes: 1 addition & 1 deletion core-bootstrap/src/components/rating/rating.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {
RatingProps as CoreProps,
} from '@agnos-ui/core/components/rating';
import {getRatingDefaultConfig as getCoreDefaultConfig, createRating as createCoreRating} from '@agnos-ui/core/components/rating';
import {extendWidgetProps} from '@agnos-ui/core/services/extendWidget';
import {extendWidgetProps} from '@agnos-ui/core/services';
import type {SlotContent, Widget, WidgetFactory} from '@agnos-ui/core/types';

export * from '@agnos-ui/core/components/rating';
Expand Down
2 changes: 1 addition & 1 deletion core-bootstrap/src/components/select/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {
SelectState as CoreState,
} from '@agnos-ui/core/components/select';
import {createSelect as createCoreSelect, getSelectDefaultConfig as getCoreDefaultConfig} from '@agnos-ui/core/components/select';
import {extendWidgetProps} from '@agnos-ui/core/services/extendWidget';
import {extendWidgetProps} from '@agnos-ui/core/services';
import type {PropsConfig, SlotContent, Widget, WidgetSlotContext} from '@agnos-ui/core/types';

export * from '@agnos-ui/core/components/select';
Expand Down
2 changes: 1 addition & 1 deletion core-bootstrap/src/components/slider/slider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {
SliderState as CoreState,
} from '@agnos-ui/core/components/slider';
import {createSlider as createCoreSlider, getSliderDefaultConfig as getCoreDefaultConfig} from '@agnos-ui/core/components/slider';
import {extendWidgetProps} from '@agnos-ui/core/services/extendWidget';
import {extendWidgetProps} from '@agnos-ui/core/services';
import type {SlotContent, Widget, WidgetFactory, WidgetSlotContext} from '@agnos-ui/core/types';

export * from '@agnos-ui/core/components/slider';
Expand Down
6 changes: 3 additions & 3 deletions core-bootstrap/src/components/toast/toast.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type {ToastDirectives, ToastState as CoreState, ToastProps as CoreProps, ToastApi} from '@agnos-ui/core/components/toast';
import {createToast as createCoreToast, getToastDefaultConfig as getCoreDefaultConfig} from '@agnos-ui/core/components/toast';
import type {SlotContent, Widget, WidgetFactory, WidgetSlotContext} from '@agnos-ui/core/types';
import {extendWidgetProps} from '@agnos-ui/core/services/extendWidget';
import {fadeTransition} from '../../services/transitions';
import type {TransitionFn} from '@agnos-ui/core/services/transitions/baseTransitions';
import {extendWidgetProps} from '@agnos-ui/core/services';
import {fadeTransition} from '../../transitions';
import type {TransitionFn} from '@agnos-ui/core/transitions';

export * from '@agnos-ui/core/components/toast';

Expand Down
2 changes: 1 addition & 1 deletion core-bootstrap/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ export * from './components/select';
export * from './components/slider';
export * from './components/toast';

export * from './services/transitions';
export * from './transitions';
export * from './config';
export * from './types';
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type {TransitionFn} from '@agnos-ui/core/services/transitions/baseTransitions';
import {createCollapseTransition, type CollapseConfig} from '@agnos-ui/core/services/transitions/collapse';
import {createCollapseTransition, type CollapseConfig, type TransitionFn} from '@agnos-ui/core/transitions';

const verticalConfig: CollapseConfig = {
dimension: 'height',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type {TransitionFn} from '@agnos-ui/core/services/transitions/baseTransitions';
import {createSimpleClassTransition} from '@agnos-ui/core/services/transitions/simpleClassTransition';
import {createSimpleClassTransition, type TransitionFn} from '@agnos-ui/core/transitions';

export const fadeTransition: TransitionFn = createSimpleClassTransition({
animationPendingClasses: ['fade'],
Expand Down
File renamed without changes.
24 changes: 12 additions & 12 deletions core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@
"require": "./dist/types.cjs",
"default": "./dist/types.js"
},
"./services/*": {
"types": "./dist/services/*.d.ts",
"require": "./dist/services/*.cjs",
"default": "./dist/services/*.js"
"./services": {
"types": "./dist/services/index.d.ts",
"require": "./dist/services/index.cjs",
"default": "./dist/services/index.js"
},
"./services/transitions/*": {
"types": "./dist/services/transitions/*.d.ts",
"require": "./dist/services/transitions/*.cjs",
"default": "./dist/services/transitions/*.js"
"./transitions": {
"types": "./dist/transitions/index.d.ts",
"require": "./dist/transitions/index.cjs",
"default": "./dist/transitions/index.js"
},
"./utils/*": {
"types": "./dist/utils/*.d.ts",
"require": "./dist/utils/*.cjs",
"default": "./dist/utils/*.js"
"./utils": {
"types": "./dist/utils/index.d.ts",
"require": "./dist/utils/index.cjs",
"default": "./dist/utils/index.js"
}
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/accordion/accordion.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {stateStores, writablesForProps, normalizeConfigStores, mergeConfigStores} from '../../utils/stores';
import type {TransitionFn} from '../../services/transitions/baseTransitions';
import {createTransition} from '../../services/transitions/baseTransitions';
import type {TransitionFn} from '../../transitions/baseTransitions';
import {createTransition} from '../../transitions/baseTransitions';
import type {ConfigValidator, Directive, PropsConfig, Widget, WidgetFactory} from '../../types';
import {asWritable, computed, readable, writable} from '@amadeus-it-group/tansu';
import {noop} from '../../utils/internal/func';
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/alert/common.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type {TransitionFn} from '../../services/transitions/baseTransitions';
import {createTransition} from '../../services/transitions/baseTransitions';
import type {TransitionFn} from '../../transitions/baseTransitions';
import {createTransition} from '../../transitions/baseTransitions';
import type {WidgetsCommonPropsAndState} from '../commonProps';
import type {ConfigValidator, Directive, PropsConfig, Widget} from '../../types';
import {noop} from '../../utils/internal/func';
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/modal/modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import {computed, readable} from '@amadeus-it-group/tansu';
import type {WidgetsCommonPropsAndState} from '../commonProps';
import {typeBoolean, typeFunction, typeHTMLElementOrNull, typeString} from '../../utils/writables';
import {stateStores, writablesForProps} from '../../utils/stores';
import type {TransitionFn} from '../../services/transitions/baseTransitions';
import {createTransition} from '../../services/transitions/baseTransitions';
import type {TransitionFn} from '../../transitions/baseTransitions';
import {createTransition} from '../../transitions/baseTransitions';
import {promiseFromStore} from '../../utils/internal/promise';
import type {ConfigValidator, Directive, PropsConfig, Widget} from '../../types';
import {noop} from '../../utils/internal/func';
Expand Down
21 changes: 4 additions & 17 deletions core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,10 @@ export * from './components/toast';
export * from './config';

// services
export * from './services/extendWidget';
export * from './services/floatingUI';
export * from './services/focustrack';
export * from './services/intersection';
export * from './services/matchMedia';
export * from './services/navManager';
export * from './services/portal';
export * from './services/resizeObserver';
export * from './services/siblingsInert';
export * from './services/hash';
export * from './services';

// services transitions
export * from './services/transitions/baseTransitions';
export * from './services/transitions/cssTransitions';
export * from './services/transitions/simpleClassTransition';
// transitions
export * from './transitions';

// public utils
export * from './utils/directive';
export * from './utils/stores';
export * from './utils/writables';
export * from './utils';
10 changes: 10 additions & 0 deletions core/src/services/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export * from './extendWidget';
export * from './floatingUI';
export * from './focustrack';
export * from './intersection';
export * from './matchMedia';
export * from './navManager';
export * from './portal';
export * from './resizeObserver';
export * from './siblingsInert';
export * from './hash';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {expect, test, describe, beforeEach} from 'vitest';
import {createTransition} from './baseTransitions';
import type {TransitionFn} from './baseTransitions';
import {promiseFromStore} from '../../utils/internal/promise';
import {promiseFromStore} from '../utils/internal/promise';
import {writable} from '@amadeus-it-group/tansu';

describe(`createTransition`, () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {batch, computed, derived, writable} from '@amadeus-it-group/tansu';
import {typeBoolean, typeBooleanOrNull, typeFunction} from '../../utils/writables';
import type {ConfigValidator, Directive, PropsConfig, SSRHTMLElement, Widget} from '../../types';
import {promiseWithResolve} from '../../utils/internal/promise';
import {noop} from '../../utils/internal/func';
import {bindableDerived, stateStores, writablesForProps} from '../../utils/stores';
import {createStoreDirective, directiveSubscribe, directiveUpdate, mergeDirectives} from '../../utils/directive';
import {typeBoolean, typeBooleanOrNull, typeFunction} from '../utils/writables';
import type {ConfigValidator, Directive, PropsConfig, SSRHTMLElement, Widget} from '../types';
import {promiseWithResolve} from '../utils/internal/promise';
import {noop} from '../utils/internal/func';
import {bindableDerived, stateStores, writablesForProps} from '../utils/stores';
import {createStoreDirective, directiveSubscribe, directiveUpdate, mergeDirectives} from '../utils/directive';

/**
* Function that implements a transition.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {afterEach, beforeEach, describe, expect, test, vi} from 'vitest';
import type {Directive} from '../../types';
import type {Directive} from '../types';
import type {TransitionFn, TransitionWidget} from './baseTransitions';
import {createTransition} from './baseTransitions';
import {createCollapseTransition} from './collapse';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {isBrowserHTMLElement} from '../../utils/directive';
import {addClasses, reflow, removeClasses} from '../../utils/internal/dom';
import {isBrowserHTMLElement} from '../utils/directive';
import {addClasses, reflow, removeClasses} from '../utils/internal/dom';
import type {TransitionFn} from './baseTransitions';
import {createCSSTransition} from './cssTransitions';

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {SSRHTMLElement} from '../../types';
import {isBrowserHTMLElement} from '../../utils/directive';
import {noop} from '../../utils/internal/func';
import {promiseFromEvent, promiseFromTimeout} from '../../utils/internal/promise';
import type {SSRHTMLElement} from '../types';
import {isBrowserHTMLElement} from '../utils/directive';
import {noop} from '../utils/internal/func';
import {promiseFromEvent, promiseFromTimeout} from '../utils/internal/promise';
import type {TransitionFn} from './baseTransitions';

/**
Expand Down
4 changes: 4 additions & 0 deletions core/src/transitions/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './baseTransitions';
export * from './cssTransitions';
export * from './simpleClassTransition';
export * from './collapse';
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {afterEach, beforeEach, describe, expect, test, vi} from 'vitest';
import type {Directive} from '../../types';
import type {Directive} from '../types';
import type {TransitionFn, TransitionWidget} from './baseTransitions';
import {createTransition} from './baseTransitions';
import {createSimpleClassTransition} from './simpleClassTransition';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {createCSSTransition} from './cssTransitions';
import {addClasses, reflow, removeClasses} from '../../utils/internal/dom';
import {addClasses, reflow, removeClasses} from '../utils/internal/dom';

export interface SimpleClassTransitionConfig {
/**
Expand Down
3 changes: 3 additions & 0 deletions core/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './directive';
export * from './stores';
export * from './writables';
Loading

0 comments on commit df95903

Please sign in to comment.