Skip to content

Commit

Permalink
remove augment-vir dep, upgrade to @augment-vir packages
Browse files Browse the repository at this point in the history
  • Loading branch information
electrovir committed Dec 8, 2022
1 parent 8ad70cf commit 775efad
Show file tree
Hide file tree
Showing 22 changed files with 1,238 additions and 651 deletions.
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
*.tgz
*.tsbuildinfo
.DS_Store
/*.tgz
/Icon?
coverage/
dist/
graphics/
node_modules/
node_modules/

/*.tgz
6 changes: 4 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
**/*/readme-examples/
**/*/test/
*.d.ts.map
*.test-helper.*
*.test.*
*.tgz
*.tsbuildinfo
.*
/*.tgz
/Icon?
/configs/
/coverage/
/cspell.config.js
/graphics/
/public/
/src/
bash-scripts/
test-files/
tsconfig*.json

/public/
index.html
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
18
1,760 changes: 1,182 additions & 578 deletions package-lock.json

Large diffs are not rendered by default.

34 changes: 18 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "element-vir",
"version": "6.3.1",
"version": "6.3.3",
"keywords": [
"custom",
"web",
Expand Down Expand Up @@ -29,8 +29,8 @@
"compile": "rm -rf dist && tsc --project tsconfig.json",
"docs:update": "virmator code-in-markdown",
"format": "virmator format",
"prepublishOnly": "npm run compile && npm run test:all",
"preview": "virmator frontend preview",
"publish": "npm run compile && npm run test:all && virmator publish",
"spellcheck": "virmator spellcheck",
"start": "npm install && virmator frontend",
"test": "npm run test:types && virmator test-web",
Expand All @@ -41,35 +41,37 @@
"test:web": "virmator test-web"
},
"dependencies": {
"augment-vir": "^3.1.0",
"@augment-vir/browser": "^6.1.5",
"@augment-vir/common": "^6.1.5",
"lit": "2.4.1"
},
"devDependencies": {
"@augment-vir/browser-testing": "^6.1.5",
"@istanbuljs/nyc-config-typescript": "^1.0.2",
"@open-wc/testing": "^3.1.6",
"@types/chai": "^4.3.3",
"@types/mocha": "^10.0.0",
"@open-wc/testing": "^3.1.7",
"@types/chai": "^4.3.4",
"@types/mocha": "^10.0.1",
"@web/dev-server-esbuild": "^0.3.3",
"@web/test-runner": "^0.15.0",
"@web/test-runner-commands": "^0.6.5",
"@web/test-runner-playwright": "^0.9.0",
"ansi-colors": "^4.1.3",
"chai": "^4.3.6",
"cspell": "^6.14.0",
"istanbul-smart-text-reporter": "^0.0.1",
"markdown-code-example-inserter": "^0.1.11",
"chai": "^4.3.7",
"cspell": "^6.17.0",
"istanbul-smart-text-reporter": "^1.0.1",
"markdown-code-example-inserter": "^0.1.12",
"mocha": "^10.1.0",
"mocha-spec-reporter-with-file-names": "^0.0.0",
"mocha-spec-reporter-with-file-names": "^0.0.2",
"nyc": "^15.1.0",
"prettier": "^2.7.1",
"prettier": "^2.8.1",
"prettier-plugin-jsdoc": "^0.4.2",
"prettier-plugin-multiline-arrays": "^1.1.1",
"prettier-plugin-organize-imports": "^3.1.1",
"prettier-plugin-multiline-arrays": "^1.1.2",
"prettier-plugin-organize-imports": "^3.2.1",
"prettier-plugin-packagejson": "^2.3.0",
"prettier-plugin-sort-json": "^0.0.3",
"prettier-plugin-toml": "^0.3.1",
"ts-node": "^10.9.1",
"virmator": "^4.2.15",
"vite": "^3.2.2"
"virmator": "^5.0.3",
"vite": "^3.2.5"
}
}
11 changes: 0 additions & 11 deletions src/augments/testing.test-helper.test.ts

This file was deleted.

25 changes: 5 additions & 20 deletions src/augments/testing.test-helper.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,22 @@
import {typedAssertInstanceOf} from '@augment-vir/browser-testing';
import {assert} from '@open-wc/testing';
import {sendMouse} from '@web/test-runner-commands';
import {DeclarativeElementDefinition} from '../declarative-element/declarative-element';

/**
* Wrapper for assert.instanceOf that also works with TypeScript in setting the proper types.
*
* Do not use this in production code! It should only be used in testing code.
*/
export function assertInstanceOf<T>(
value: unknown,
constructor: new (...args: any) => T,
message?: string,
): asserts value is T {
assert.instanceOf(value, constructor, message);
}

export function isInstanceOf<T>(value: unknown, constructor: new (...args: any) => T): value is T {
return value instanceof constructor;
}

export function getAssertedDeclarativeElement<
DeclarativeElementGeneric extends DeclarativeElementDefinition,
>(
searchFor: DeclarativeElementGeneric,
searchIn: Element,
): DeclarativeElementGeneric['instanceType'] {
if (searchIn.tagName.toLowerCase() === searchFor.tagName.toLowerCase()) {
assertInstanceOf(searchIn, searchFor);
typedAssertInstanceOf(searchIn, searchFor);
return searchIn as DeclarativeElementGeneric['instanceType'];
}

const result = queryTree(searchIn, [searchFor.tagName]);
assertInstanceOf(result, searchFor);
typedAssertInstanceOf(result, searchFor);
result;
assert.strictEqual(result!.tagName, searchFor.tagName);

return result as DeclarativeElementGeneric['instanceType'];
Expand Down Expand Up @@ -65,7 +50,7 @@ export function queryWithAssert<T extends Element>(
query = [query];
}
const result = queryTree(searchIn, query);
assertInstanceOf(result, constructor);
typedAssertInstanceOf(result, constructor);

return result;
}
Expand Down
2 changes: 1 addition & 1 deletion src/declarative-element/css-vars.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {mapObjectValues} from 'augment-vir';
import {mapObjectValues} from '@augment-vir/common';
import {CSSResult, unsafeCSS} from 'lit';
import {toHtmlSafeWithTagName} from './tag-name';

Expand Down
2 changes: 1 addition & 1 deletion src/declarative-element/declarative-element.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {RequiredAndNotNullBy, RequiredBy} from 'augment-vir';
import {RequiredAndNotNullBy, RequiredBy} from '@augment-vir/common';
import {CSSResult, LitElement, TemplateResult} from 'lit';
import {CssVarNameOrValueMap} from './css-vars';
import {DeclarativeElementInit} from './declarative-element-init';
Expand Down
2 changes: 1 addition & 1 deletion src/declarative-element/define-element-no-inputs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {getObjectTypedKeys, kebabCaseToCamelCase} from 'augment-vir';
import {getObjectTypedKeys, kebabCaseToCamelCase} from '@augment-vir/common';
import {css, TemplateResult} from 'lit';
import {property} from 'lit/decorators.js';
import {DeclarativeElementMarkerSymbol} from '../declarative-element-marker-symbol';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {randomString} from '@augment-vir/browser';
import {assert, fixture} from '@open-wc/testing';
import {randomString} from 'augment-vir';
import {defineElementNoInputs, html, listen} from '../..';
import {
assertRejects,
Expand Down
2 changes: 1 addition & 1 deletion src/declarative-element/directives/awaiting.directive.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {extractErrorMessage, isPromiseLike, typedHasProperty} from 'augment-vir';
import {extractErrorMessage, isPromiseLike, typedHasProperty} from '@augment-vir/common';

export type MaybePromise<T> =
| (T extends Promise<infer ValueType> ? T | ValueType : Promise<T> | T)
Expand Down
2 changes: 1 addition & 1 deletion src/declarative-element/host-classes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {mapObjectValues} from 'augment-vir';
import {mapObjectValues} from '@augment-vir/common';
import {PropertyInitMapBase} from './element-properties';
import {toHtmlSafeWithTagName, WithTagName} from './tag-name';

Expand Down
2 changes: 1 addition & 1 deletion src/declarative-element/render-callback.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {getObjectTypedKeys, RequiredAndNotNullBy} from 'augment-vir';
import {getObjectTypedKeys, RequiredAndNotNullBy} from '@augment-vir/common';
import {TemplateResult} from 'lit';
import {TypedEvent} from '../typed-event/typed-event';
import {DeclarativeElement, HostInstanceType} from './declarative-element';
Expand Down
2 changes: 1 addition & 1 deletion src/declarative-element/styles.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {getObjectTypedKeys, mapObjectValues} from 'augment-vir';
import {getObjectTypedKeys, mapObjectValues} from '@augment-vir/common';
import {CSSResult, unsafeCSS} from 'lit';
import {CssVarNameOrValueMap} from './css-vars';
import {PropertyInitMapBase} from './element-properties';
Expand Down
2 changes: 1 addition & 1 deletion src/declarative-element/tag-name.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {camelCaseToKebabCase} from 'augment-vir';
import {camelCaseToKebabCase} from '@augment-vir/common';

export type WithTagName<TagName extends string, Suffix extends string> = `${TagName}-${Suffix}`;

Expand Down
2 changes: 1 addition & 1 deletion src/template-transforms/nested-mapped-templates.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {typedHasProperties} from 'augment-vir';
import {typedHasProperties} from '@augment-vir/common';
import {DeclarativeElementMarkerSymbol} from '../declarative-element-marker-symbol';
import {TemplateTransform} from './transform-template';

Expand Down
2 changes: 1 addition & 1 deletion src/template-transforms/transform-template.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {typedHasProperties} from 'augment-vir';
import {typedHasProperties} from '@augment-vir/common';
import {filterOutArrayIndexes} from '../augments/array';
import {DeclarativeElementMarkerSymbol} from '../declarative-element-marker-symbol';
import {getAlreadyMappedTemplate, setMappedTemplate} from './nested-mapped-templates';
Expand Down
2 changes: 1 addition & 1 deletion src/template-transforms/vir-html/html-transform.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {collapseWhiteSpace, safeMatch} from 'augment-vir';
import {collapseWhiteSpace, safeMatch} from '@augment-vir/common';
import {HTMLTemplateResult} from 'lit';
import {declarativeElementRequired} from '../../require-declarative-element';
import {ConstructorWithTagName, hasStaticTagName} from '../has-static-tag-name';
Expand Down
3 changes: 2 additions & 1 deletion src/test/element.type.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {getObjectTypedKeys, randomString} from 'augment-vir';
import {randomString} from '@augment-vir/browser';
import {getObjectTypedKeys} from '@augment-vir/common';
import {css, TemplateResult} from 'lit';
import {
assign,
Expand Down
15 changes: 8 additions & 7 deletions src/test/elements/app.element.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {typedAssertInstanceOf} from '@augment-vir/browser-testing';
import {RequiredAndNotNullBy} from '@augment-vir/common';
import {assert, expect, fixture, waitUntil} from '@open-wc/testing';
import {RequiredAndNotNullBy} from 'augment-vir';
import {html} from '../..';
import {assertInstanceOf, clickElement} from '../../augments/testing.test-helper';
import {clickElement} from '../../augments/testing.test-helper';
import {AppElement} from './app.element';
import {TestChildElement} from './child.element';

Expand Down Expand Up @@ -56,7 +57,7 @@ describe(AppElement.tagName, () => {
return context;
}
const appElement = context.querySelector(AppElement.tagName);
assertInstanceOf(appElement, AppElement);
typedAssertInstanceOf(appElement, AppElement);
assertHasShadowRoot(appElement);
return appElement;
}
Expand All @@ -67,19 +68,19 @@ describe(AppElement.tagName, () => {
TestChildElement.tagName,
'span:nth-of-type(3)',
]);
assertInstanceOf(inputNumberSpan, HTMLSpanElement);
typedAssertInstanceOf(inputNumberSpan, HTMLSpanElement);
expect(inputNumberSpan.innerText).to.contain('input number');
assert.strictEqual(inputNumberSpan.childNodes.length, 3);
const lastNode = inputNumberSpan.childNodes[2];
assertInstanceOf(lastNode, Text);
typedAssertInstanceOf(lastNode, Text);
const inputNumber = Number(lastNode.nodeValue);
assert.isNotNaN(inputNumber);
return inputNumber;
}

async function clickAssignNewNumberButton(context: HTMLElement) {
const assignNewNumberButton = queryTree(context, ['button']);
assertInstanceOf(assignNewNumberButton, HTMLButtonElement);
typedAssertInstanceOf(assignNewNumberButton, HTMLButtonElement);
expect(assignNewNumberButton.innerText).to.contain('assign NEW number to child');

await clickElement(assignNewNumberButton);
Expand All @@ -104,7 +105,7 @@ describe(AppElement.tagName, () => {
TestChildElement.tagName,
]);

assertInstanceOf(childElement, TestChildElement);
typedAssertInstanceOf(childElement, TestChildElement);
assert('speak' in childElement.definition.events);
const currentInputs = {...childElement.instanceInputs};
assert.deepStrictEqual(currentInputs, {
Expand Down
2 changes: 1 addition & 1 deletion src/test/elements/child.element.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {randomString} from 'augment-vir';
import {randomString} from '@augment-vir/browser';
import {css} from 'lit';
import {defineElement, defineElementEvent, html, listen, onDomCreated} from '../..';
import {MyCustomEvent} from '../customEvent';
Expand Down

0 comments on commit 775efad

Please sign in to comment.