Skip to content

Commit

Permalink
feat: add blank app example
Browse files Browse the repository at this point in the history
  • Loading branch information
julcasans committed Jun 5, 2024
1 parent 26dfe10 commit 27c0099
Show file tree
Hide file tree
Showing 39 changed files with 857 additions and 30 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ server
/playwright/.cache/
/packages/example/*
!/packages/example/recipes-app/
/packages/example/recipes-app/types/
!/packages/example/blank-app/
/packages/example/blank-app/types/
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"beta:off": "changeset pre exit",
"rc:on": "changeset pre enter rc",
"rc:off": "changeset pre exit",
"version": "npm run changeset version"
"version": "npm run changeset version && npm run create-app:update",
"create-app:update": "npm --prefix ./packages/create-app run update"
},
"keywords": [],
"devDependencies": {
Expand Down
16 changes: 16 additions & 0 deletions packages/core/types/bridge.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2024 Bilbao Vizcaya Argentaria, S.A.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { NavigationWithParams } from './navigation-stack';
import { Navigation } from './navigation-stack';

Expand Down
24 changes: 22 additions & 2 deletions packages/core/types/component-connector.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
import { Binding } from './state/subscriptor';
/*
* Copyright 2024 Bilbao Vizcaya Argentaria, S.A.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export { ComponentConnector } from "../src/component-connector";
import { Binding } from './state/subscriptor';

export type Component = {
spec: {
render: string;
};
};

export interface ComponentConnector {
connect: (component: WCNode, connections: Connection[]) => void;
disconnect: (component: WCNode) => void;
update: (component: WCNode, connections: Connection[]) => void;
}

export interface IndexableHTMLElement extends HTMLElement {
[index: string]: any;
}
Expand Down
16 changes: 16 additions & 0 deletions packages/core/types/event-emitter.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2024 Bilbao Vizcaya Argentaria, S.A.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export declare class EventEmitter {
on(event: string, listener: Function): void;
once(event: string, listener: Function): void;
Expand Down
16 changes: 16 additions & 0 deletions packages/core/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2024 Bilbao Vizcaya Argentaria, S.A.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export type {
Component,
ComponentConnector,
Expand Down
Empty file.
16 changes: 16 additions & 0 deletions packages/core/types/manager/events.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2024 Bilbao Vizcaya Argentaria, S.A.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export interface IWCEvent extends Event {
detail?: any;
}
Expand Down
16 changes: 16 additions & 0 deletions packages/core/types/manager/post-message.ts
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
/*
* Copyright 2024 Bilbao Vizcaya Argentaria, S.A.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export type PostMessageEvent = CustomEvent & { event: string };
15 changes: 15 additions & 0 deletions packages/core/types/manager/storage.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
/*
* Copyright 2024 Bilbao Vizcaya Argentaria, S.A.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export type Dictionary = { [key: string]: string|null };
66 changes: 65 additions & 1 deletion packages/core/types/manager/template.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2024 Bilbao Vizcaya Argentaria, S.A.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { WCNode } from '../component-connector';

export type TemplateManagerConfig = {
Expand All @@ -20,4 +36,52 @@ export type TemplateSpec = {

export type TemplateNode = WCNode;

export { TemplateManager } from '../../src/manager/template';
export interface TemplateManager {

cache: { [key: string]: Template };

templates: { [key: string]: TemplateNode };

selected: string;

locations: string[];

size: number;

constructor(config?: TemplateManagerConfig): TemplateManager;

createTemplate(name: string, spec: TemplateSpec): Template;

get(name: string): Template | undefined;

getNode(name: string): TemplateNode | undefined;

select(name: string): void;

removeTemplate(templateName: string): void;

removeTemplates(initialTemplate: string, crossContainerId: string): void;

removeTemplateChildrens(templateName: string): void;

}

export interface Template {

type: string;

constructor(spec: TemplateSpec): Template;

getZone(zoneId: string): TemplateNode;

cache(): void;

activate(): void;

deactivate(): void;

config(config: TemplateConfig): void;
}



50 changes: 50 additions & 0 deletions packages/core/types/navigation-stack.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2024 Bilbao Vizcaya Argentaria, S.A.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export type Navigation = {
from?: string;
to?: string;
Expand All @@ -16,3 +32,37 @@ export type NavigationWithParams = {
to?: RoutePage;
};


export interface NavigationStack {

readonly length: number;

addSkipNavigation(nav: Navigation): void;

isSkipNavigation(nav: Navigation): boolean;

lastNavigation(): Navigation;

createRoute(page: string, params?: QueryParams): RoutePage;

createNavigation(routeFrom?: RoutePage, routeTo?: RoutePage): Navigation;

push(route: RoutePage): void;

replace(route: RoutePage): void;

pop(): RoutePage | undefined;

top(): RoutePage | undefined;

isBackwardNavigation(newNav: Navigation): boolean;

update(routeFrom?: RoutePage, routeTo?: RoutePage): RoutePage | undefined;

clear(): void;

replaceRoute(route: RoutePage): void;

clearUntil(targetPage: string): void
}

24 changes: 23 additions & 1 deletion packages/core/types/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
/*
* Copyright 2024 Bilbao Vizcaya Argentaria, S.A.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { QueryParams } from './navigation-stack';

export { Route } from '../src/route';
export interface Route {
name: string;
params: QueryParams;
query: any;
subroute: string|undefined;
hashPath: string;
}

export type RouteData = {
name: string;
Expand Down
Loading

0 comments on commit 27c0099

Please sign in to comment.