@nu-art/ts-short-url-frontend 0.400.7

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.
@@ -0,0 +1,13 @@
1
+ import './ATS_ShortUrl.scss';
2
+ import { AppToolsScreen, ComponentSync } from '@nu-art/thunderstorm-frontend/index';
3
+ import { DispatcherType_ShortUrl } from '../../_entity/short-url/index.js';
4
+ import { ApiCallerEventType, DispatcherInterface } from '@nu-art/thunderstorm-frontend/core/db-api-gen/types';
5
+ import { DBProto_ShortUrl } from '@nu-art/ts-short-url-shared';
6
+ type State = {};
7
+ type Props = {};
8
+ export declare class ATS_ShortUrl extends ComponentSync<Props, State> implements DispatcherInterface<DispatcherType_ShortUrl> {
9
+ static screen: AppToolsScreen;
10
+ __onShortUrlsUpdated(...params: ApiCallerEventType<DBProto_ShortUrl>): void;
11
+ render(): import("react/jsx-runtime").JSX.Element;
12
+ }
13
+ export {};
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import './ATS_ShortUrl.scss';
3
+ import { ATS_Fullstack, Button, ComponentSync, LL_H_C, LL_V_L, TS_AppTools } from '@nu-art/thunderstorm-frontend/index';
4
+ import { ModuleFE_ShortUrl } from '../../_entity/short-url/index.js';
5
+ import { Component_ShortUrlEditor } from './components/Component_ShortUrlEditor.js';
6
+ import { sortArray, voidFunction } from '@nu-art/ts-common';
7
+ import { TS_EditableItemController } from '@nu-art/thunderstorm-frontend/components/TS_EditableItemController/index';
8
+ export class ATS_ShortUrl extends ComponentSync {
9
+ static screen = {
10
+ name: 'Short Url',
11
+ key: 'short-url',
12
+ renderer: this,
13
+ modulesToAwait: [ModuleFE_ShortUrl],
14
+ group: ATS_Fullstack
15
+ };
16
+ __onShortUrlsUpdated(...params) {
17
+ this.forceUpdate();
18
+ }
19
+ render() {
20
+ const allMutable = ModuleFE_ShortUrl.cache.allMutable();
21
+ return _jsxs("div", { className: 'short-url', children: [_jsxs(LL_H_C, { className: 'page-title', children: [TS_AppTools.renderPageHeader('Manage App Short Urls'), _jsx(Button, { variant: 'primary', onClick: voidFunction, children: "Add Short Url" })] }), _jsxs(LL_V_L, { className: 'url-cards', children: [_jsx(Card_ShortUrl, {}, `new-short-url-${allMutable.length}`), sortArray(allMutable, (item) => item.title + item._shortUrl)
22
+ .map((shortUrl) => _jsx(Card_ShortUrl, { editorProps: { deleteCallback: () => this.forceUpdate() }, item: shortUrl }, shortUrl._id))] })] });
23
+ }
24
+ }
25
+ class Card_ShortUrl extends TS_EditableItemController {
26
+ static defaultProps = {
27
+ module: ModuleFE_ShortUrl,
28
+ editor: Component_ShortUrlEditor,
29
+ createInitialInstance: () => ({})
30
+ };
31
+ }
@@ -0,0 +1,29 @@
1
+ @use "@nu-art/ts-styles" as styles;
2
+
3
+ .short-url {
4
+ width: 100%;
5
+ height: 100%;
6
+ padding: 20px;
7
+ @include styles.customScrollbar('vertical', true);
8
+
9
+ .page-title {
10
+ position: relative;
11
+
12
+ .app-tools-page__page__header {
13
+ width: 100%;
14
+ }
15
+
16
+ .ts-button {
17
+ position: absolute;
18
+ right: 10px;
19
+ }
20
+ }
21
+
22
+ .url-cards {
23
+ display: grid;
24
+ grid-template-columns: repeat(auto-fit, minmax(650px, 1fr));
25
+ padding-top: 10px;
26
+ width: 100%;
27
+ gap: 15px;
28
+ }
29
+ }
@@ -0,0 +1,13 @@
1
+ import './Component_ShortUrlEditor.scss';
2
+ import { EditableRef, TS_EditableContent } from '@nu-art/thunderstorm-frontend/editable-item';
3
+ import { InferProps, InferState } from '@nu-art/thunderstorm-frontend/index';
4
+ import { DBProto_ShortUrl, UI_ShortUrl } from '@nu-art/ts-short-url-shared';
5
+ type Props = EditableRef<UI_ShortUrl> & {
6
+ deleteCallback?: VoidFunction;
7
+ };
8
+ type State = EditableRef<UI_ShortUrl>;
9
+ export declare class Component_ShortUrlEditor extends TS_EditableContent<DBProto_ShortUrl, Props, State> {
10
+ protected deriveStateFromProps(nextProps: InferProps<this>, state: InferState<this>): InferState<this>;
11
+ render(): import("react/jsx-runtime").JSX.Element;
12
+ }
13
+ export {};
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import './Component_ShortUrlEditor.scss';
3
+ import { TS_EditableContent, TS_EditableItemStatus } from '@nu-art/thunderstorm-frontend/editable-item';
4
+ import { Button, LL_H_C, ModuleFE_Thunderstorm, TS_Card, TS_PropRenderer } from '@nu-art/thunderstorm-frontend/index';
5
+ import { TS_InputV2 } from '@nu-art/thunderstorm-frontend/components/TS_V2_Input/index';
6
+ import { TS_Icons } from '@nu-art/ts-styles';
7
+ import { TS_TextAreaV2 } from '@nu-art/thunderstorm-frontend/components/TS_V2_TextArea/index';
8
+ import { ModuleFE_ShortUrl } from '../../../_entity/short-url/index.js';
9
+ const StringEditableInput = TS_InputV2.editable({
10
+ type: 'text',
11
+ saveEvent: ['blur', 'accept']
12
+ });
13
+ const TextArea = TS_TextAreaV2.editable({
14
+ saveEvent: ['blur', 'accept']
15
+ });
16
+ export class Component_ShortUrlEditor extends TS_EditableContent {
17
+ deriveStateFromProps(nextProps, state) {
18
+ state = super.deriveStateFromProps(nextProps, state);
19
+ return state;
20
+ }
21
+ render() {
22
+ const _id = this.state.editable.get('_id');
23
+ return _jsxs(TS_Card, { className: 'short-url-editor', children: [_jsxs(LL_H_C, { className: 'utils', children: [_jsx(TS_EditableItemStatus, { editable: this.state.editable }), _jsx(TS_Icons.x.component, { onClick: async () => {
24
+ if (this.state.editable.get('_id'))
25
+ await this.state.editable.delete();
26
+ this.props.deleteCallback?.();
27
+ } })] }), _jsxs(LL_H_C, { children: [_jsx(TS_PropRenderer.Vertical, { label: 'Title', children: _jsx(StringEditableInput, { editable: this.state.editable, prop: 'title', onChange: value => {
28
+ if (value.length)
29
+ return this.state.editable.updateObj({ title: value });
30
+ return this.state.editable.updateObj({ title: undefined });
31
+ } }) }), _jsx(TS_PropRenderer.Vertical, { label: 'Short Url', children: _jsx("div", { children: this.state.editable.item._shortUrl }) })] }), _jsx(TS_PropRenderer.Vertical, { label: 'Full Url', children: _jsx(TextArea, { editable: this.state.editable, prop: 'fullUrl', className: 'url-input', onChange: value => {
32
+ if (value.length)
33
+ return this.state.editable.updateObj({ fullUrl: value });
34
+ return this.state.editable.updateObj({ fullUrl: undefined });
35
+ } }) }), _jsx(TS_PropRenderer.Vertical, { label: 'Description', children: _jsx(TextArea, { editable: this.state.editable, prop: 'description', onChange: value => {
36
+ if (value?.length)
37
+ return this.state.editable.updateObj({ description: value });
38
+ return this.state.editable.updateObj({ description: undefined });
39
+ } }) }), _jsxs(LL_H_C, { className: 'buttons-container', children: [_jsx(Button, { variant: 'tertiary', disabled: !_id, onClick: async () => {
40
+ const { shortUrl } = await ModuleFE_ShortUrl._v1.getShortUrl({ _id: _id }).executeSync();
41
+ await ModuleFE_Thunderstorm.copyToClipboard(shortUrl);
42
+ }, children: "Copy ShortUrl To Clipboard" }), _jsx(Button, { variant: 'primary', onClick: async () => {
43
+ await this.state.editable.save();
44
+ }, children: "Save" })] })] });
45
+ }
46
+ }
@@ -0,0 +1,46 @@
1
+ .short-url-editor {
2
+ display: flex;
3
+ flex-direction: column;
4
+ position: relative;
5
+ gap: 15px;
6
+ height: fit-content;
7
+ padding: 15px;
8
+ width: 650px;
9
+ background: white;
10
+ justify-content: space-between;
11
+
12
+
13
+ .ts-textarea {
14
+ resize: none;
15
+ height: 120px;
16
+
17
+ &.url-input {
18
+ font-family: monospace;
19
+ font-weight: normal;
20
+ resize: vertical;
21
+ }
22
+
23
+ }
24
+
25
+ .utils {
26
+ position: absolute;
27
+ right: 15px;
28
+ top: 10px;
29
+ gap: 10px;
30
+
31
+ .icon--wrapper {
32
+ cursor: pointer;
33
+ }
34
+ }
35
+
36
+ .buttons-container {
37
+ gap: 10px;
38
+ width: 100%;
39
+ padding-top: 10px;
40
+ justify-content: flex-end;
41
+
42
+ .ts-busy-button {
43
+ margin: 0;
44
+ }
45
+ }
46
+ }
@@ -0,0 +1 @@
1
+ export * from './ATS_ShortUrl/ATS_ShortUrl.js';
package/_ats/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from './ATS_ShortUrl/ATS_ShortUrl.js';
@@ -0,0 +1,11 @@
1
+ import { ApiStruct_ShortUrl, DBProto_ShortUrl } from '@nu-art/ts-short-url-shared';
2
+ import { DispatcherDef, ThunderDispatcherV3 } from '@nu-art/thunderstorm-frontend/core/db-api-gen/types';
3
+ import { ModuleFE_BaseApi } from '@nu-art/thunderstorm-frontend/index';
4
+ import { ApiDefCaller } from '@nu-art/thunderstorm-shared';
5
+ export type DispatcherType_ShortUrl = DispatcherDef<DBProto_ShortUrl, `__onShortUrlsUpdated`>;
6
+ export declare const dispatch_onShortUrlsUpdated: ThunderDispatcherV3<DispatcherType_ShortUrl>;
7
+ export declare class ModuleFE_ShortUrl_Class extends ModuleFE_BaseApi<DBProto_ShortUrl> implements ApiDefCaller<ApiStruct_ShortUrl> {
8
+ _v1: ApiDefCaller<ApiStruct_ShortUrl>['_v1'];
9
+ constructor();
10
+ }
11
+ export declare const ModuleFE_ShortUrl: ModuleFE_ShortUrl_Class;
@@ -0,0 +1,14 @@
1
+ import { ApiDef_ShortUrl, DBDef_ShortUrl } from '@nu-art/ts-short-url-shared';
2
+ import { ThunderDispatcherV3 } from '@nu-art/thunderstorm-frontend/core/db-api-gen/types';
3
+ import { apiWithQuery, ModuleFE_BaseApi } from '@nu-art/thunderstorm-frontend/index';
4
+ export const dispatch_onShortUrlsUpdated = new ThunderDispatcherV3('__onShortUrlsUpdated');
5
+ export class ModuleFE_ShortUrl_Class extends ModuleFE_BaseApi {
6
+ _v1;
7
+ constructor() {
8
+ super(DBDef_ShortUrl, dispatch_onShortUrlsUpdated);
9
+ this._v1 = {
10
+ getShortUrl: apiWithQuery(ApiDef_ShortUrl._v1.getShortUrl)
11
+ };
12
+ }
13
+ }
14
+ export const ModuleFE_ShortUrl = new ModuleFE_ShortUrl_Class();
@@ -0,0 +1,2 @@
1
+ export * from './ModuleFE_ShortUrl.js';
2
+ export * from './module-pack.js';
@@ -0,0 +1,2 @@
1
+ export * from './ModuleFE_ShortUrl.js';
2
+ export * from './module-pack.js';
@@ -0,0 +1 @@
1
+ export declare const ModulePackFE_ShortUrlDB: import("./ModuleFE_ShortUrl.js").ModuleFE_ShortUrl_Class[];
@@ -0,0 +1,2 @@
1
+ import { ModuleFE_ShortUrl } from './ModuleFE_ShortUrl.js';
2
+ export const ModulePackFE_ShortUrlDB = [ModuleFE_ShortUrl];
@@ -0,0 +1,36 @@
1
+ export declare const DropDown_ShortUrl: {
2
+ editable: (props: import("@nu-art/thunderstorm-frontend/components/types").ComponentProps_Error & {
3
+ dropdownRef?: import("react").RefObject<any>;
4
+ className?: string;
5
+ style?: import("react").CSSProperties;
6
+ placeholder?: string;
7
+ mapper?: ((item: import("@nu-art/ts-short-url-shared").DB_ShortUrl) => (string | undefined)[]) | undefined;
8
+ noOptionsRenderer?: import("react").ReactNode | ((filter?: string) => import("react").ReactNode);
9
+ renderer?: ((item: import("@nu-art/ts-short-url-shared").DB_ShortUrl) => import("react").ReactElement) | undefined;
10
+ ifNoneShowAll?: boolean;
11
+ caret?: {
12
+ open: import("react").ReactNode;
13
+ close: import("react").ReactNode;
14
+ };
15
+ onNoMatchingSelectionForString?: ((filterText: string, matchingItems: import("@nu-art/ts-short-url-shared").DB_ShortUrl[], e: import("react").KeyboardEvent) => any) | undefined;
16
+ limitItems?: number;
17
+ hidePlaceholderOnOpen?: boolean;
18
+ itemResolver?: (() => import("@nu-art/ts-short-url-shared").DB_ShortUrl[]) | undefined;
19
+ innerRef?: import("react").RefObject<any>;
20
+ tabIndex?: number;
21
+ unselectLabel?: string;
22
+ id?: string;
23
+ queryFilter?: ((item: import("@nu-art/ts-short-url-shared").DB_ShortUrl) => boolean) | undefined;
24
+ sortBy?: ("title" | "description" | "_id" | "__metadata1" | "__hardDelete" | "__created" | "__updated" | "_v" | "_originDocId" | "_shortUrl" | "fullUrl" | ((item: import("@nu-art/ts-short-url-shared").DB_ShortUrl) => string | number))[] | undefined;
25
+ } & {
26
+ inputValue?: string;
27
+ boundingParentSelector?: string;
28
+ renderSearch?: ((dropDown: import("@nu-art/thunderstorm-frontend/index").TS_DropDown<import("@nu-art/ts-short-url-shared").DB_ShortUrl>) => import("react").ReactNode) | undefined;
29
+ limitItems?: number;
30
+ disabled?: boolean;
31
+ } & import("@nu-art/thunderstorm-frontend/index").UIProps_EditableItem<any, any, string> & {
32
+ onSelected?: ((selected: import("@nu-art/ts-short-url-shared").DB_ShortUrl | undefined, superOnSelected: (selected?: import("@nu-art/ts-short-url-shared").DB_ShortUrl | undefined) => Promise<void>) => void) | undefined;
33
+ canUnselect?: boolean;
34
+ }) => import("react/jsx-runtime").JSX.Element;
35
+ selectable: (props: import("@nu-art/thunderstorm-frontend/index").AppLevelProps_TS_GenericDropDownV3<import("@nu-art/ts-short-url-shared").DB_ShortUrl>) => import("react/jsx-runtime").JSX.Element;
36
+ };
@@ -0,0 +1,11 @@
1
+ import { jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ModuleFE_ShortUrl } from './ModuleFE_ShortUrl.js';
3
+ import { GenericDropDownV3 } from '@nu-art/thunderstorm-frontend/index';
4
+ const Props_DropDown = {
5
+ module: ModuleFE_ShortUrl,
6
+ modules: [ModuleFE_ShortUrl],
7
+ mapper: item => [item.title],
8
+ placeholder: 'Choose a ShortUrl',
9
+ renderer: item => _jsxs("div", { className: "ll_h_c", children: [" ", item.title, " "] })
10
+ };
11
+ export const DropDown_ShortUrl = GenericDropDownV3.prepare(Props_DropDown);
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './_ats/index.js';
2
+ export * from './_entity/short-url/index.js';
package/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './_ats/index.js';
2
+ export * from './_entity/short-url/index.js';
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@nu-art/ts-short-url-frontend",
3
+ "version": "0.400.7",
4
+ "description": "ts-short-url - Express & Typescript based backend framework Frontend",
5
+ "keywords": [
6
+ "TacB0sS",
7
+ "infra",
8
+ "nu-art",
9
+ "thunderstorm",
10
+ "typescript",
11
+ "ts-short-url"
12
+ ],
13
+ "homepage": "https://github.com/nu-art-js/thunderstorm",
14
+ "bugs": {
15
+ "url": "https://github.com/nu-art-js/thunderstorm/issues"
16
+ },
17
+ "publishConfig": {
18
+ "directory": "dist",
19
+ "linkDirectory": true
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+ssh://git@github.com:nu-art-js/thunderstorm.git"
24
+ },
25
+ "license": "Apache-2.0",
26
+ "author": "TacB0sS",
27
+ "files": [
28
+ "**/*"
29
+ ],
30
+ "scripts": {
31
+ "build": "tsc"
32
+ },
33
+ "dependencies": {
34
+ "@nu-art/ts-short-url-shared": "0.400.7",
35
+ "@nu-art/firebase-frontend": "0.400.7",
36
+ "@nu-art/firebase-shared": "0.400.7",
37
+ "@nu-art/permissions-frontend": "0.400.7",
38
+ "@nu-art/permissions-shared": "0.400.7",
39
+ "@nu-art/thunderstorm-frontend": "0.400.7",
40
+ "@nu-art/thunderstorm-shared": "0.400.7",
41
+ "@nu-art/ts-common": "0.400.7",
42
+ "@nu-art/ts-styles": "0.400.7",
43
+ "firebase": "^11.9.0",
44
+ "firebase-admin": "13.4.0",
45
+ "firebase-functions": "6.3.2",
46
+ "react": "^18.0.0"
47
+ },
48
+ "devDependencies": {
49
+ "@types/react": "^18.0.0",
50
+ "@types/chai": "^4.3.4",
51
+ "@types/mocha": "^10.0.1"
52
+ },
53
+ "unitConfig": {
54
+ "type": "typescript-lib"
55
+ },
56
+ "type": "module",
57
+ "exports": {
58
+ ".": {
59
+ "types": "./index.d.ts",
60
+ "import": "./index.js"
61
+ },
62
+ "./*": {
63
+ "types": "./*.d.ts",
64
+ "import": "./*.js"
65
+ }
66
+ }
67
+ }