Skip to content

Commit

Permalink
chore: merge develop into master (#221)
Browse files Browse the repository at this point in the history
* build: bump componentsjs & n3 (#202)

Signed-off-by: Wouter Termont <[email protected]>

* feat: add resourceShapeFromQuads to discovery (#201)

* feat: add resourceShapeFromQuads to discovery

* test: remove redundant casts

Signed-off-by: Wouter Termont <[email protected]>

Co-authored-by: Wouter Termont <[email protected]>

* docs: complete-ts-docs (#194)

* docs: complete ts docs WIP

* docs: complete ts docs WIP

* docs: semcom docs update

* chore: apply suggestions from code review

Co-authored-by: Wouter Termont <[email protected]>

* docs: fixed typo in tsdocs

Co-authored-by: Wouter Termont <[email protected]>

* chore: release v0.9.7

* build: release component package (#206)

Signed-off-by: Wouter Termont <[email protected]>

* chore: release v0.9.8

* chore: import semcom components from dgt-compontens (#209)

* chore: added DS_Store to gitignore

* build: added dgt shared dependencies

* feat: added semcom components from dgt-components

* chore: replaced components WIP

* fix: fix node modules build error

* chore: restrucute components into folders

* chore: exported and defined imported semcom components

* chore: added imported semcom components to rollup options

* feat: added metadata json files

* feat: document-component (#210)

* feat: added document component WIP

* chore: added typing

* feat: added json metadata file

* chore: defined, exported document component + added to rollup options

* fix: fixed using custom port

* chore: added components to demo

* chore: added test data

* fix: fixed typo

* fix: incorrect path fix

* chore: added intial data to document component

* fix: fixed non loading css

* test: move demo data

Signed-off-by: Wouter Termont <[email protected]>

Co-authored-by: Wouter Termont <[email protected]>

* chore: release v0.10.0

* chore: change metadata folder structure (#215)

* chore: changed folder structure for components metadata

* fix: fixed incorrect  paths

* fix: fix correct paths index.ts

* chore: release v0.10.1

* fix: component-shape corrections (#216)

* fix: component shape corrections

* build: publish upload component

* build: clean

* chore: release v0.10.2

* fix: start default in memory without sync (#185)

* fix: start default in memory without sync

Signed-off-by: Wouter Termont <[email protected]>

* fix: remove local env var

Signed-off-by: Wouter Termont <[email protected]>

* chore: merge from develop

* fix: restore demo files in lib

* fix: start default in mem

* chore: remove last old handler syntax (#217)

* chore: remove intermediate response (WIP)

* test: fix old rxjs syntax

* chore: release v0.11.0

* build: add licenses (#220)

---------

Signed-off-by: Wouter Termont <[email protected]>
Co-authored-by: Arne Vandoorslaer <[email protected]>
Co-authored-by: Jasper Vandenberghen <[email protected]>
  • Loading branch information
3 people authored Jan 31, 2023
1 parent 461d11d commit d2d9d19
Show file tree
Hide file tree
Showing 114 changed files with 5,856 additions and 1,149 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

- run: npm publish packages/semcom-components
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

- run: npm publish packages/semcom-upload-component
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

publish-docker:
name: Publish Docker image
needs: publish-npm
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,7 @@ dist
#*.npmrc

coverage-summary.json
rundata/
rundata/

# OS file
.DS_store
56 changes: 56 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,62 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.11.0](https://github.com/digita-ai/semcom/compare/v0.10.2...v0.11.0) (2022-01-28)


### **Bug Fixes**

* start default in memory without sync ([#185](https://github.com/digita-ai/semcom/issues/185)) ([9c6688c](https://github.com/digita-ai/semcom/commit/9c6688c10dd74da05b3dc6669862b960abbe0085))



### [0.10.2](https://github.com/digita-ai/semcom/compare/v0.10.1...v0.10.2) (2022-01-22)


### **Bug Fixes**

* component-shape corrections ([#216](https://github.com/digita-ai/semcom/issues/216)) ([8dff959](https://github.com/digita-ai/semcom/commit/8dff959751e5c67a67903dbec92512a16f2ae7d6))



### [0.10.1](https://github.com/digita-ai/semcom/compare/v0.10.0...v0.10.1) (2022-01-14)

**Note:** Version bump only for package root





## [0.10.0](https://github.com/digita-ai/semcom/compare/v0.9.8...v0.10.0) (2022-01-14)

**Note:** Version bump only for package root





### [0.9.8](https://github.com/digita-ai/semcom/compare/v0.9.7...v0.9.8) (2021-12-15)

**Note:** Version bump only for package root





### [0.9.7](https://github.com/digita-ai/semcom/compare/v0.9.6...v0.9.7) (2021-12-09)


### **Features**

* add resourceShapeFromQuads to discovery ([#201](https://github.com/digita-ai/semcom/issues/201)) ([e6b863d](https://github.com/digita-ai/semcom/commit/e6b863dcde92e2950d5a516b5e898a8fe6bf68c4))


### **Documentation**

* complete-ts-docs ([#194](https://github.com/digita-ai/semcom/issues/194)) ([17a8415](https://github.com/digita-ai/semcom/commit/17a84154a5feaf960b70534a45c98c3bd048b95b))



### [0.9.6](https://github.com/digita-ai/semcom/compare/v0.9.5...v0.9.6) (2021-12-07)


Expand Down
2 changes: 1 addition & 1 deletion docs/antora.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: semcom
title: Semantic Components
version: master
version: main
nav:
- modules/ROOT/nav.adoc
- modules/sdk/nav.adoc
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@
}
}
},
"version": "0.9.6"
"version": "0.11.0"
}
5 changes: 2 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
"name": "root",
"description": "",
"main": "index.js",
"license": "agpl-3.0",
"scripts": {
"clean": "rimraf ./dist && rimraf ./package-lock.json && rimraf ./node_modules",
"clean": "npm run clean:locks && npm run clean:modules",
"clean:locks": "npm i --package-locks-only && lerna exec 'npm i --package-locks-only'",
"clean:modules": "lerna clean && shx rm -rf ./node_modules/",
"release": "lerna version",
"release:docs": "echo \"$(yaml set docs/antora.yml version $(dot-json lerna.json version))\" > docs/antora.yml",
"postinstall": "husky install",
Expand All @@ -30,7 +33,6 @@
"url": "git+https://github.com/digita-ai/semcom.git"
},
"author": "Wouter Janssens",
"license": "ISC",
"bugs": {
"url": "https://github.com/digita-ai/semcom/issues"
},
Expand Down
51 changes: 51 additions & 0 deletions packages/semcom-components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,57 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.11.0](https://github.com/digita-ai/semcom/compare/v0.10.2...v0.11.0) (2022-01-28)


### **Bug Fixes**

* start default in memory without sync ([#185](https://github.com/digita-ai/semcom/issues/185)) ([9c6688c](https://github.com/digita-ai/semcom/commit/9c6688c10dd74da05b3dc6669862b960abbe0085))



### [0.10.2](https://github.com/digita-ai/semcom/compare/v0.10.1...v0.10.2) (2022-01-22)


### **Bug Fixes**

* component-shape corrections ([#216](https://github.com/digita-ai/semcom/issues/216)) ([8dff959](https://github.com/digita-ai/semcom/commit/8dff959751e5c67a67903dbec92512a16f2ae7d6))



### [0.10.1](https://github.com/digita-ai/semcom/compare/v0.10.0...v0.10.1) (2022-01-14)

**Note:** Version bump only for package @digita-ai/semcom-components





## [0.10.0](https://github.com/digita-ai/semcom/compare/v0.9.8...v0.10.0) (2022-01-14)

**Note:** Version bump only for package @digita-ai/semcom-components





### [0.9.8](https://github.com/digita-ai/semcom/compare/v0.9.7...v0.9.8) (2021-12-15)

**Note:** Version bump only for package @digita-ai/semcom-components





### [0.9.7](https://github.com/digita-ai/semcom/compare/v0.9.6...v0.9.7) (2021-12-09)


### **Documentation**

* complete-ts-docs ([#194](https://github.com/digita-ai/semcom/issues/194)) ([17a8415](https://github.com/digita-ai/semcom/commit/17a84154a5feaf960b70534a45c98c3bd048b95b))



### [0.9.6](https://github.com/digita-ai/semcom/compare/v0.9.5...v0.9.6) (2021-12-07)

**Note:** Version bump only for package @digita-ai/semcom-components
Expand Down
16 changes: 16 additions & 0 deletions packages/semcom-components/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
This program is offered under a commercial and under the AGPL license.
For commercial licensing, contact Digita at https://digita.ai. For AGPL licensing, see below.

AGPL licensing:
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
133 changes: 133 additions & 0 deletions packages/semcom-components/lib/components/barcode.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
/* eslint-disable no-console -- is a web component */
import { Store } from 'n3';
import { css, CSSResult, html, state, property, PropertyValues, query, TemplateResult, unsafeCSS } from 'lit-element';
import { ComponentResponseEvent } from '@digita-ai/semcom-sdk';
import { Theme, QR, Open } from '@digita-ai/dgt-theme';
import JsBarcode from 'jsbarcode';
import { unsafeSVG } from 'lit-html/directives/unsafe-svg';
import { ComponentDataTypes } from '@digita-ai/semcom-core';
import { BaseComponent } from './base.component';

export class BarcodeComponent extends BaseComponent {

@state() cardNumber?: string;
@state() program?: string;
@state() hostingOrganization?: string;
@property({ type: Boolean }) hideProgram = false;

@query('#barcode') barcodeSvg?: HTMLOrSVGElement;

/**
* Handles a response event.
* Expects an event containing a detail object that contains a data object containing quads. Will take the first quad containing a membershipNumber it finds.
* Make sure to filter the quads you send it if you want a specific barcode.
*
* @param event The response event to handle.
*/
handleResponse<D extends keyof ComponentDataTypes>(event: ComponentResponseEvent<D>): void {

console.log('handleResponse');

if (!event || !event.detail || !event.detail.data) {

throw new Error('Arguments event, event.detail, and event.detail.data should be set.');

}

const store = new Store(event.detail.data);

const quad = store.getQuads(null, 'http://schema.org/membershipNumber', null, null)[0];

const program = store.getQuads(quad.subject, 'http://schema.org/programName', null, null)[0];
const hostingOrganization = store.getQuads(quad.subject, 'http://schema.org/hostingOrganization', null, null)[0];

this.cardNumber = quad.object.value;
this.program = program.object.value;
this.hostingOrganization = hostingOrganization?.object?.value;

}

updated(changed: PropertyValues): void {

if (changed.has('entry') && this.entry) this.readData(this.entry, 'quads');

if (this.barcodeSvg && this.cardNumber) {

JsBarcode(this.barcodeSvg, this.cardNumber, {
background: 'none',
});

}

super.updated(changed);

}

render(): TemplateResult {

return html`
${this.program && !this.hideProgram ? html`
<nde-card ?hideImage="${ true }">
<div slot="title">${this.program}</div>
<div slot="subtitle">This is your barcode</div>
<div slot="icon">
${unsafeSVG(QR)}
</div>
<div slot="content">
<div class="barcode-container">
<svg id="barcode"></svg>
</div>
${this.hostingOrganization ? html`<a target="_blank" .href="${this.hostingOrganization}" class="btn primary">${unsafeSVG(Open)} <div>More information</div></a>` : ``}
</div>
</nde-card>
` : ''}
`;

}

static get styles(): CSSResult[] {

return [
unsafeCSS(Theme),
css`
div[slot="icon"] svg {
fill: var(--colors-foreground-normal);
}
div[slot="content"] {
display: flex;
align-items: stretch;
flex-direction: column;
}
a.btn {
display: flex;
align-items: center;
flex-direction: row;
margin-top: var(--gap-large);
justify-content: center;
}
a.btn svg {
fill: var(--colors-foreground-inverse);
margin-right: var(--gap-normal);
}
.barcode-container {
display: flex;
align-items: center;
flex-direction: column;
}
.barcode-container #barcode {
width: 200px;
height: 110px;
}
`,
];

}

}

export default BarcodeComponent;
Loading

0 comments on commit d2d9d19

Please sign in to comment.