Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(soffit-pwa): new version with i18n, content loader, form submit signal #769

Merged
merged 41 commits into from
Feb 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
1190e7c
feat(soffit-pwa): l18e director
njfamirm Feb 5, 2023
6f780fd
feat(soffit-pwa): localize messages
njfamirm Feb 5, 2023
f97c6b8
feat(soffit-pwa): content loader
njfamirm Feb 5, 2023
ae54953
feat(soffit-pwa): load content on radio group
njfamirm Feb 5, 2023
65e8e96
feat(soffit-pwa): radio group i18n
njfamirm Feb 5, 2023
c5cedeb
fix(soffit-pwa): DirectionMixin for all classes user i18n
njfamirm Feb 5, 2023
3864fa2
fix(soffit-pwa): LocalizeMixin for all classes user i18n
njfamirm Feb 5, 2023
5f564aa
fix(soffit-pwa): submit form director
njfamirm Feb 5, 2023
9b17ff0
fix(soffit-pwa): submit form response check
njfamirm Feb 5, 2023
6f1b160
feat(soffit-pwa): product description
njfamirm Feb 5, 2023
e3cf679
fix(soffit-pwa): remove additional mixing
njfamirm Feb 5, 2023
05e30b6
chore(soffit-pwa): beta 6 version
njfamirm Feb 5, 2023
3646f14
fix(pwa-helper): version and old workbox config
alimd Feb 5, 2023
ddf2ee3
chore(package): update and fix ts version
alimd Feb 6, 2023
ad7cb96
fix(snackbar): position
alimd Feb 6, 2023
00fd0b3
feat(soffit/page-home): footer styles
alimd Feb 6, 2023
3c63908
refactor(ui/radio-group): options and render template
alimd Feb 6, 2023
d4b5f5b
feat(soffit): enhance develope scripts
alimd Feb 6, 2023
b860d61
fix(soffit-pwa): radio group options
njfamirm Feb 6, 2023
295e782
fix(soffit-pwa): remove direction mixing from page home
njfamirm Feb 6, 2023
58e6292
feat(dev-server): debug mode
njfamirm Feb 6, 2023
9dc1724
refactor(icon-box): IconBoxContent type
alimd Feb 6, 2023
faca9ec
refactor(soffit/form-submit): validate formId and change return type
alimd Feb 6, 2023
c5fa792
refactor(soffit): content types
alimd Feb 6, 2023
4b99377
feat(soffit-pwa): remove agency cards on en locale
njfamirm Feb 6, 2023
92d9419
feat(soffit-pwa): youtube & contact us card
njfamirm Feb 6, 2023
47656d0
refactor: StringifyableRecord type
alimd Feb 6, 2023
f661650
refactor(soffit): content type
alimd Feb 6, 2023
896a983
refactor(soffit): director
alimd Feb 6, 2023
76f6de5
fix(soffit-pwa): director logging
njfamirm Feb 6, 2023
01a5b6e
fix(soffit-pwa): director logging
njfamirm Feb 6, 2023
cdf43f8
fix(soffit): build issue
alimd Feb 6, 2023
0e3afbc
fix(icon-box): IconBoxContent target type
alimd Feb 6, 2023
29c2abb
feat(soffit): localize phone number
alimd Feb 6, 2023
ad8a18a
fix(soffit): content fa
alimd Feb 6, 2023
d934369
fix(soffit): localize keys
alimd Feb 6, 2023
b811152
fix(soffit): localize keys
alimd Feb 6, 2023
6c81476
fix(soffit): localize keys
alimd Feb 6, 2023
fd9d485
fix(soffit): localization bug
alimd Feb 6, 2023
2134efb
fix(soffit): localization bug
alimd Feb 6, 2023
73a0d34
feat: debug all renders
alimd Feb 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/signal/src/command-trigger.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {requestCommand, requestCommandWithResponse} from './core.js';

import type {OmitFirstParam, Stringifyable} from '@alwatr/type';
import type {OmitFirstParam, Stringifyable, StringifyableRecord} from '@alwatr/type';

/**
* Command trigger/request interface.
Expand Down Expand Up @@ -39,7 +39,7 @@ export const commandTrigger = {
* const showDialog = commandTrigger.bind<ArgumentType, ReturnType>('show-dialog');
* ```
*/
bind: <TArgument extends Record<string, Stringifyable>, TReturn extends Stringifyable>(commandId: string) =>({
bind: <TArgument extends StringifyableRecord, TReturn extends Stringifyable>(commandId: string) =>({
/**
* Command signal Id.
*/
Expand Down
8 changes: 4 additions & 4 deletions core/signal/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {
SignalStorage,
ListenerSpec,
} from './type.js';
import type {Stringifyable} from '@alwatr/type';
import type {Stringifyable, StringifyableRecord} from '@alwatr/type';

globalAlwatr.registeredList.push({
name: '@alwatr/signal',
Expand Down Expand Up @@ -338,7 +338,7 @@ export const setContextProvider = <TContext extends Stringifyable, TRquest exten
* );
* ```
*/
export const defineCommand = <TArgument extends Record<string, Stringifyable>, TReturn extends Stringifyable>(
export const defineCommand = <TArgument extends StringifyableRecord, TReturn extends Stringifyable>(
signalId: string,
signalProvider: ProviderFunction<TArgument & {_callbackSignalId?: string}, TReturn>,
options: Partial<Pick<ProviderOptions, 'debounce'>> = {},
Expand Down Expand Up @@ -395,7 +395,7 @@ export const requestContext = <TRequest extends Stringifyable>(
* requestCommand<ArgumentType>('show-dialog', {foo: 'bar'});
* ```
*/
export const requestCommand = <TArgument extends Record<string, Stringifyable>>(
export const requestCommand = <TArgument extends StringifyableRecord>(
commandId: string,
commandArgument: TArgument,
): void => {
Expand All @@ -415,7 +415,7 @@ export const requestCommand = <TArgument extends Record<string, Stringifyable>>(
* ```
*/
export const requestCommandWithResponse = async <
TArgument extends Record<string, Stringifyable>,
TArgument extends StringifyableRecord,
TReturn extends Stringifyable
>(
commandId: string,
Expand Down
3 changes: 3 additions & 0 deletions core/type/src/type-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ export type Stringifyable =
| undefined
| { [x: string]: Stringifyable }
| Array<Stringifyable>;


export type StringifyableRecord = Record<string, Stringifyable>;
2 changes: 1 addition & 1 deletion ui/demo-pwa/src/page-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class AlwatrPageCard extends AlwatrSmartElement {
`;

override render(): unknown {
super.render();
this._logger.logMethod('render');
return html`
<alwatr-icon-box
.content=${{icon: 'gift-outline', headline: 'قرعه کشی', description: loremText}}
Expand Down
2 changes: 1 addition & 1 deletion ui/demo-pwa/src/page-chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class AlwatrPageHome extends AlwatrSmartElement {
`;

override render(): unknown {
super.render();
this._logger.logMethod('render');
return html`<alwatr-chat></alwatr-chat>`;
}
}
2 changes: 1 addition & 1 deletion ui/icon/src/icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class AlwatrIcon extends DirectionMixin(SignalMixin(AlwatrDummyElement))
protected _icon?: HTMLTemplateResult;

override render(): unknown {
super.render();
this._logger.logMethod('render');
return this._icon;
}

Expand Down
4 changes: 3 additions & 1 deletion ui/pwa-helper/esbuild.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ async function buildServiceWorker() {

const build = await generateSW({
swDest: `${outDir}/service-worker.js`,
globDirectory: `${outDir}`,
globDirectory: `${outDir}/`,
clientsClaim: true,
skipWaiting: true,
globPatterns: [
Expand Down Expand Up @@ -152,6 +152,8 @@ else {

/*
TODO:
- Input Config
- version
- Workbox and sw
- Res (all assets) hash
- PostCSS css file
Expand Down
2 changes: 1 addition & 1 deletion ui/pwa-helper/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alwatr/pwa-helper",
"version": "0.29.0-beta5",
"version": "0.29.0-beta7",
"description": "Alwatr PWA Helper",
"keywords": [
"element",
Expand Down
2 changes: 1 addition & 1 deletion ui/pwa-helper/src/pwa-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class AlwatrPwaElement extends AlwatrSmartElement {
}

override render(): unknown {
super.render();
this._logger.logMethod('render');
return html`<div class="page-container">${cache(routerOutlet(this._routesConfig))}</div>`;
}

Expand Down
1 change: 1 addition & 0 deletions ui/ui-kit/src/button/icon-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export class AlwatrStandardIconButton extends AlwatrSurface {
}

override render(): unknown {
this._logger.logMethod('render');
return html`<alwatr-icon
part="icon"
?flip-rtl=${this.flipRtl}
Expand Down
7 changes: 5 additions & 2 deletions ui/ui-kit/src/card/icon-box.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ import '@alwatr/icon';

import {AlwatrSurface} from './surface.js';

import type {StringifyableRecord} from '@alwatr/type';


declare global {
interface HTMLElementTagNameMap {
'alwatr-icon-box': AlwatrIconBox;
}
}

export type IconBoxContent = {
export interface IconBoxContent extends StringifyableRecord {
icon?: string;
headline: string;
description?: string;
Expand All @@ -21,7 +24,7 @@ export type IconBoxContent = {
stated?: boolean;
preLine?: boolean;
elevated?: number;
};
}

/**
* Alwatr standard icon button element.
Expand Down
2 changes: 1 addition & 1 deletion ui/ui-kit/src/chat/chat-avatar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class AlwatrChatAvatar extends AlwatrDummyElement {
user?: string;

override render(): unknown {
super.render();
this._logger.logMethod('render');
return html`<img src="https://i.pravatar.cc/40?u=${this.user}" alt="User ${this.user} profile image" />`;
}
}
2 changes: 1 addition & 1 deletion ui/ui-kit/src/chat/chat-bubble.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class AlwatrChatBubble extends DirectionMixin(SignalMixin(AlwatrDummyElem
text?: string;

override render(): unknown {
super.render();
this._logger.logMethod('render');
return html`${this.text ?? '...'}`;
}
}
1 change: 1 addition & 0 deletions ui/ui-kit/src/chat/chat-footer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export class AlwatrChatFooter extends AlwatrDummyElement {
`;

override render(): unknown {
this._logger.logMethod('render');
return html`
<alwatr-icon-button .icon=${'happy-outline'} @click=${this._changeLocale}></alwatr-icon-button>
<alwatr-chat-text-input></alwatr-chat-text-input>
Expand Down
2 changes: 1 addition & 1 deletion ui/ui-kit/src/chat/chat-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class AlwatrChatList extends AlwatrDummyElement {
currentUser?: string;

override render(): unknown {
super.render();
this._logger.logMethod('render');
if (this.storage == null) return nothing;
return html`${map(
this.storage.data,
Expand Down
2 changes: 1 addition & 1 deletion ui/ui-kit/src/chat/chat-message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class AlwatrChatMessage extends DirectionMixin(SignalMixin(AlwatrDummyEle
self = false;

override render(): unknown {
super.render();
this._logger.logMethod('render');
if (this.message == null || this.message.type !== 'text') return nothing;

const bubble = html`<alwatr-chat-bubble
Expand Down
1 change: 1 addition & 0 deletions ui/ui-kit/src/chat/chat-text-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export class AlwatrChatTextInput extends LocalizeMixin(SignalMixin(AlwatrDummyEl
sendButtonElement: AlwatrStandardIconButton | null = null;

override render(): unknown {
this._logger.logMethod('render');
return html`
<textarea
rows="1"
Expand Down
2 changes: 1 addition & 1 deletion ui/ui-kit/src/chat/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export class AlwatrChat extends AlwatrSmartElement {
`;

override render(): unknown {
super.render();
this._logger.logMethod('render');
return html`
<alwatr-chat-list .storage=${chatStorage} .currentUser=${currentUser}></alwatr-chat-list>
<alwatr-chat-footer></alwatr-chat-footer>
Expand Down
7 changes: 4 additions & 3 deletions ui/ui-kit/src/snackbar/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ export class AlwatrSnackbar extends AlwatrSurface {
padding: calc(0.5 * var(--sys-spacing-track));
gap: var(--sys-spacing-track);
position: fixed;
bottom: calc(4 * var(--sys-spacing-track));
left: calc(4 * var(--sys-spacing-track));
right: calc(4 * var(--sys-spacing-track));
bottom: calc(2 * var(--sys-spacing-track));
left: var(--sys-spacing-track);
right: var(--sys-spacing-track);
z-index: var(--sys-zindex-snackbar);
border-radius: var(--sys-radius-xsmall);

Expand Down Expand Up @@ -119,6 +119,7 @@ export class AlwatrSnackbar extends AlwatrSurface {
}

override render(): unknown {
this._logger.logMethod('render');
return html`<span class="message">${this.message}</span>${when(
this.actionLabel,
() => html`<alwatr-button @click=${this._actionButtonClick}>${this.actionLabel}</alwatr-button>`,
Expand Down
1 change: 1 addition & 0 deletions uniquely/flight-finder-pwa/src/component/job-add-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export class JobAddForm extends AlwatrSmartElement {
};

override render(): unknown {
this._logger.logMethod('render');
return html`
<ion-header>
<ion-toolbar color="secondary">
Expand Down
1 change: 1 addition & 0 deletions uniquely/flight-finder-pwa/src/component/job-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export class JobItem extends AlwatrSmartElement {
static jobDeleteEventTrigger = eventTrigger.bind('job-delete');

override render(): unknown {
this._logger.logMethod('render');
if (this.job == null || this.job.detail == null) return nothing;

return html`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export class PageFlightFinder extends AlwatrSmartElement {
setInterval(this.__updateTimer, 3_000);
}
override render(): unknown {
this._logger.logMethod('render');
return html`
<ion-header>
<ion-toolbar color="primary">
Expand Down
14 changes: 9 additions & 5 deletions uniquely/soffit-pwa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,21 @@
"directory": "ui/soffit-pwa"
},
"scripts": {
"b": "yarn build --debug",
"cb": "yarn build --debug --clean",
"b": "yarn build-dev",
"cb": "run-s clean build-dev",
"s": "yarn start",
"w": "yarn watch",
"start": "NODE_OPTIONS=--enable-source-maps run-s clean build serve",
"clean": "rm -rf dist build .tsbuildinfo",
"build": "./esbuild.mjs",
"build": "yarn build:es",
"build-dev": "run-s build:root build:tsc \"build:es --debug\"",
"build:es": "./esbuild.mjs",
"build:tsc": "tsc --build",
"build:root": "cd ../../ && yarn build:ts",
"serve": "wds",
"watch": "run-p watch:es serve",
"watch:es": "yarn build --clean --watch --debug"
"watch": "run-p watch:root watch:es serve",
"watch:es": "yarn build:es --clean --watch --debug",
"watch:root": "cd ../../ && yarn watch:ts"
},
"devDependencies": {
"@alwatr/element": "^0.28.0",
Expand Down
2 changes: 1 addition & 1 deletion uniquely/soffit-pwa/src/alwatr-pwa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import '@alwatr/ui-kit/style/theme/palette-270.css';
import '@alwatr/ui-kit/style/theme/color.css';
import '@alwatr/font/vazirmatn.css';

import './director.js';
import './director/index.js';
import './page-home.js';

import type {RoutesConfig} from '@alwatr/router';
Expand Down
Loading