@rindo/core 1.17.4 → 2.5.2

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.
Files changed (164) hide show
  1. package/LICENSE.md +27 -27
  2. package/bin/cli.ts +20 -0
  3. package/bin/rindo +51 -56
  4. package/cli/index.cjs +1263 -0
  5. package/cli/index.d.ts +1 -1
  6. package/cli/index.js +1232 -495
  7. package/cli/package.json +9 -4
  8. package/compiler/lib.d.ts +24 -0
  9. package/compiler/lib.dom.d.ts +20230 -0
  10. package/compiler/lib.dom.iterable.d.ts +351 -0
  11. package/compiler/lib.es2015.collection.d.ts +89 -0
  12. package/compiler/lib.es2015.core.d.ts +517 -0
  13. package/compiler/lib.es2015.d.ts +30 -0
  14. package/compiler/lib.es2015.generator.d.ts +79 -0
  15. package/compiler/lib.es2015.iterable.d.ts +505 -0
  16. package/compiler/lib.es2015.promise.d.ts +150 -0
  17. package/compiler/lib.es2015.proxy.d.ts +41 -0
  18. package/compiler/lib.es2015.reflect.d.ts +123 -0
  19. package/compiler/lib.es2015.symbol.d.ts +48 -0
  20. package/compiler/lib.es2015.symbol.wellknown.d.ts +324 -0
  21. package/compiler/lib.es2016.array.include.d.ts +118 -0
  22. package/compiler/lib.es2016.d.ts +22 -0
  23. package/compiler/lib.es2016.full.d.ts +25 -0
  24. package/compiler/lib.es2017.d.ts +26 -0
  25. package/compiler/lib.es2017.full.d.ts +25 -0
  26. package/compiler/lib.es2017.intl.d.ts +32 -0
  27. package/compiler/lib.es2017.object.d.ts +51 -0
  28. package/compiler/lib.es2017.sharedmemory.d.ts +137 -0
  29. package/compiler/lib.es2017.string.d.ts +47 -0
  30. package/compiler/lib.es2017.typedarrays.d.ts +55 -0
  31. package/compiler/lib.es2018.asyncgenerator.d.ts +79 -0
  32. package/compiler/lib.es2018.asynciterable.d.ts +45 -0
  33. package/compiler/lib.es2018.d.ts +26 -0
  34. package/compiler/lib.es2018.full.d.ts +25 -0
  35. package/compiler/lib.es2018.intl.d.ts +61 -0
  36. package/compiler/lib.es2018.promise.d.ts +32 -0
  37. package/compiler/lib.es2018.regexp.d.ts +39 -0
  38. package/compiler/lib.es2019.array.d.ts +85 -0
  39. package/compiler/lib.es2019.d.ts +25 -0
  40. package/compiler/lib.es2019.full.d.ts +25 -0
  41. package/compiler/lib.es2019.object.d.ts +35 -0
  42. package/compiler/lib.es2019.string.d.ts +33 -0
  43. package/compiler/lib.es2019.symbol.d.ts +26 -0
  44. package/compiler/lib.es2020.bigint.d.ts +728 -0
  45. package/compiler/lib.es2020.d.ts +27 -0
  46. package/compiler/lib.es2020.full.d.ts +25 -0
  47. package/compiler/lib.es2020.intl.d.ts +310 -0
  48. package/compiler/lib.es2020.promise.d.ts +50 -0
  49. package/compiler/lib.es2020.sharedmemory.d.ts +99 -0
  50. package/compiler/lib.es2020.string.d.ts +30 -0
  51. package/compiler/lib.es2020.symbol.wellknown.d.ts +39 -0
  52. package/compiler/lib.es5.d.ts +4435 -0
  53. package/compiler/lib.es6.d.ts +25 -0
  54. package/compiler/lib.esnext.d.ts +25 -0
  55. package/compiler/lib.esnext.full.d.ts +25 -0
  56. package/compiler/lib.esnext.intl.d.ts +32 -0
  57. package/compiler/lib.esnext.promise.d.ts +43 -0
  58. package/compiler/lib.esnext.string.d.ts +35 -0
  59. package/compiler/lib.esnext.weakref.d.ts +75 -0
  60. package/compiler/lib.scripthost.d.ts +327 -0
  61. package/compiler/lib.webworker.d.ts +6042 -0
  62. package/compiler/lib.webworker.importscripts.d.ts +26 -0
  63. package/compiler/lib.webworker.iterable.d.ts +166 -0
  64. package/compiler/package.json +3 -3
  65. package/compiler/rindo.d.ts +0 -16
  66. package/compiler/rindo.js +42738 -40541
  67. package/compiler/rindo.min.js +2 -15
  68. package/dependencies.json +73 -50
  69. package/dev-server/client/index.js +33 -10
  70. package/dev-server/client/package.json +3 -3
  71. package/dev-server/connector.html +3 -3
  72. package/dev-server/index.d.ts +3 -6
  73. package/dev-server/index.js +256 -252
  74. package/dev-server/package.json +3 -3
  75. package/dev-server/server-process.js +1738 -0
  76. package/dev-server/server-worker-thread.js +39 -0
  77. package/dev-server/templates/initial-load.html +160 -160
  78. package/dev-server/ws.js +1 -1
  79. package/internal/app-data/{index.cjs.js → index.cjs} +7 -5
  80. package/internal/app-data/index.d.ts +1 -0
  81. package/internal/app-data/index.js +7 -6
  82. package/internal/app-data/package.json +11 -5
  83. package/internal/client/css-shim.js +2 -2
  84. package/internal/client/dom.js +1 -1
  85. package/internal/client/index.js +193 -119
  86. package/internal/client/package.json +4 -3
  87. package/internal/client/{patch.js → patch-browser.js} +8 -24
  88. package/internal/client/patch-esm.js +23 -0
  89. package/internal/client/polyfills/css-shim.js +1 -1
  90. package/internal/client/polyfills/index.js +34 -34
  91. package/internal/client/shadow-css.js +9 -3
  92. package/internal/hydrate/index.js +305 -281
  93. package/internal/hydrate/package.json +2 -2
  94. package/internal/hydrate/runner.d.ts +24 -12
  95. package/internal/hydrate/runner.js +153 -124
  96. package/internal/hydrate/shadow-css.js +24 -24
  97. package/internal/package.json +5 -4
  98. package/internal/rindo-core/index.cjs +1 -0
  99. package/internal/rindo-core/index.d.ts +51 -2
  100. package/internal/rindo-core/index.js +15 -1
  101. package/internal/rindo-ext-modules.d.ts +41 -39
  102. package/internal/rindo-private.d.ts +93 -148
  103. package/internal/rindo-public-compiler.d.ts +231 -155
  104. package/internal/rindo-public-runtime.d.ts +42 -39
  105. package/internal/testing/index.js +144 -121
  106. package/internal/testing/package.json +2 -2
  107. package/internal/testing/shadow-css.js +24 -24
  108. package/mock-doc/index.cjs +4610 -0
  109. package/mock-doc/index.d.ts +12 -1
  110. package/mock-doc/index.js +177 -67
  111. package/mock-doc/package.json +11 -5
  112. package/package.json +132 -133
  113. package/readme.md +21 -95
  114. package/screenshot/compare/build/app.js +33 -33
  115. package/screenshot/compare/build/p-f4745c2f.entry.js +1 -1
  116. package/screenshot/connector-base.d.ts +1 -1
  117. package/screenshot/connector-local.d.ts +1 -1
  118. package/screenshot/index.js +63 -46
  119. package/screenshot/package.json +10 -3
  120. package/screenshot/pixel-match.js +54 -57
  121. package/screenshot/screenshot-compare.d.ts +1 -1
  122. package/screenshot/screenshot-fs.d.ts +1 -1
  123. package/sys/deno/index.js +1785 -0
  124. package/sys/deno/node-compat.js +2654 -0
  125. package/sys/deno/worker.js +44 -0
  126. package/sys/node/autoprefixer.js +8 -1
  127. package/sys/node/glob.js +1 -1
  128. package/sys/node/graceful-fs.js +1 -1
  129. package/sys/node/index.d.ts +1 -1
  130. package/sys/node/index.js +689 -705
  131. package/sys/node/node-fetch.js +1 -1
  132. package/sys/node/package.json +3 -3
  133. package/sys/node/prompts.js +1 -1
  134. package/sys/node/worker.js +38 -19
  135. package/testing/index.d.ts +3 -3
  136. package/testing/index.js +863 -749
  137. package/testing/jest/jest-config.d.ts +2 -89
  138. package/testing/jest/jest-environment.d.ts +1 -1
  139. package/testing/jest/jest-runner.d.ts +1 -1
  140. package/testing/jest/jest-screenshot.d.ts +1 -1
  141. package/testing/jest-preset.js +32 -32
  142. package/testing/matchers/events.d.ts +1 -1
  143. package/testing/matchers/screenshot.d.ts +1 -1
  144. package/testing/mock-fetch.d.ts +1 -1
  145. package/testing/mocks.d.ts +1 -1
  146. package/testing/package.json +3 -3
  147. package/testing/puppeteer/index.d.ts +1 -1
  148. package/testing/puppeteer/puppeteer-browser.d.ts +2 -2
  149. package/testing/puppeteer/puppeteer-declarations.d.ts +11 -11
  150. package/testing/puppeteer/puppeteer-element.d.ts +3 -3
  151. package/testing/puppeteer/puppeteer-emulate.d.ts +1 -1
  152. package/testing/puppeteer/puppeteer-events.d.ts +3 -3
  153. package/testing/puppeteer/puppeteer-page.d.ts +1 -1
  154. package/testing/puppeteer/puppeteer-screenshot.d.ts +2 -2
  155. package/testing/reset-build-conditionals.d.ts +1 -1
  156. package/testing/spec-page.d.ts +1 -1
  157. package/testing/test-transpile.d.ts +1 -1
  158. package/testing/testing-logger.d.ts +1 -1
  159. package/testing/testing-utils.d.ts +1 -1
  160. package/testing/testing.d.ts +1 -1
  161. package/cli/index.cjs.js +0 -524
  162. package/dev-server/content-type-db.json +0 -1
  163. package/dev-server/server-worker.js +0 -1570
  164. package/mock-doc/index.cjs.js +0 -4500
@@ -1,9 +1,15 @@
1
1
  {
2
2
  "name": "@rindo/core/mock-doc",
3
- "version": "0.0.0-dev.20221104122636",
3
+ "version": "2.5.2",
4
4
  "description": "Mock window, document and DOM outside of a browser environment.",
5
- "main": "index.cjs.js",
6
- "module": "index.js",
7
- "types": "index.d.ts",
8
- "private": true
5
+ "main": "./index.cjs",
6
+ "module": "./index.js",
7
+ "types": "./index.d.ts",
8
+ "exports": {
9
+ "import": "./index.js",
10
+ "require": "./index.cjs"
11
+ },
12
+ "type": "module",
13
+ "private": true,
14
+ "sideEffects": false
9
15
  }
package/package.json CHANGED
@@ -1,133 +1,132 @@
1
- {
2
- "name": "@rindo/core",
3
- "version": "1.17.4",
4
- "license": "MIT",
5
- "main": "internal/rindo-core/index.js",
6
- "types": "internal/rindo-core/index.d.ts",
7
- "bin": {
8
- "rindo": "bin/rindo"
9
- },
10
- "files": [
11
- "bin/",
12
- "cli/",
13
- "compiler/",
14
- "dependencies.json",
15
- "dev-server/",
16
- "internal/",
17
- "mock-doc/",
18
- "screenshot/",
19
- "sys/",
20
- "testing/"
21
- ],
22
- "scripts": {
23
- "start": "npm run watch",
24
- "changelog": "conventional-changelog -p angular -o -i CHANGELOG.md -s",
25
- "build": "node scripts && npm run tsc.prod && npm run rollup.prod.ci",
26
- "build.prod": "node scripts && npm run tsc.scripts && npm run tsc.prod && npm run rollup.prod.ci",
27
- "watch": "node scripts && npm run tsc && concurrently \"npm run rollup.watch\" \"npm run tsc.watch\"",
28
- "release": "node scripts --release --publish --any-branch",
29
- "release.prepare": "node scripts --release --prepare --any-branch",
30
- "tsc": "tsc --incremental",
31
- "tsc.prod": "tsc",
32
- "tsc.scripts": "tsc -p scripts/tsconfig.json",
33
- "tsc.watch": "tsc --incremental --watch",
34
- "rollup": "rollup --config",
35
- "rollup.prod": "rollup --config --config-prod",
36
- "rollup.prod.ci": "rollup --config --config-prod --config-ci",
37
- "rollup.watch": "rollup --watch --config",
38
- "license": "node scripts --license",
39
- "prettier": "prettier --write \"./src/**/*.{ts,tsx}\""
40
- },
41
- "dependencies": {
42
- "typescript": "3.9.7"
43
- },
44
- "devDependencies": {
45
- "@rollup/plugin-commonjs": "12.0.0",
46
- "@rollup/plugin-json": "4.1.0",
47
- "@rollup/plugin-node-resolve": "8.4.0",
48
- "@rollup/plugin-replace": "2.3.3",
49
- "@rollup/pluginutils": "3.1.0",
50
- "@types/autoprefixer": "^9.7.2",
51
- "@types/exit": "^0.1.31",
52
- "@types/fs-extra": "^9.0.1",
53
- "@types/glob": "^7.1.2",
54
- "@types/graceful-fs": "^4.1.3",
55
- "@types/inquirer": "7.3.0",
56
- "@types/is-glob": "^4.0.1",
57
- "@types/jest": "^26.0.7",
58
- "@types/listr": "^0.14.2",
59
- "@types/mime-types": "^2.1.0",
60
- "@types/node": "^14.0.26",
61
- "@types/node-fetch": "^2.5.7",
62
- "@types/parse5": "^5.0.3",
63
- "@types/pixelmatch": "^4.0.0",
64
- "@types/pngjs": "^3.4.2",
65
- "@types/prompts": "^2.0.8",
66
- "@types/puppeteer": "~3.0.1",
67
- "@types/semver": "^7.3.1",
68
- "@types/sizzle": "^2.3.2",
69
- "@types/webpack": "^4.41.21",
70
- "@types/ws": "^7.2.6",
71
- "ansi-colors": "4.1.1",
72
- "autoprefixer": "9.8.5",
73
- "concurrently": "^5.2.0",
74
- "conventional-changelog-cli": "^2.0.34",
75
- "core-js-builder": "~3.6.5",
76
- "css": "^3.0.0",
77
- "dts-bundle-generator": "~5.3.0",
78
- "execa": "4.0.3",
79
- "exit": "^0.1.2",
80
- "fast-deep-equal": "3.1.3",
81
- "fs-extra": "^9.0.1",
82
- "glob": "7.1.6",
83
- "graceful-fs": "~4.2.4",
84
- "hash.js": "^1.1.7",
85
- "inquirer": "^7.3.3",
86
- "jest": "^26.1.0",
87
- "jest-cli": "^26.1.0",
88
- "jest-environment-node": "^26.1.0",
89
- "listr": "^0.14.3",
90
- "magic-string": "^0.25.7",
91
- "mime-db": "^1.44.0",
92
- "minimatch": "3.0.4",
93
- "node-fetch": "2.6.0",
94
- "open": "7.1.0",
95
- "open-in-editor": "2.2.0",
96
- "parse5": "6.0.1",
97
- "path-browserify": "^1.0.1",
98
- "pixelmatch": "4.0.2",
99
- "postcss": "^7.0.32",
100
- "prettier": "^2.0.5",
101
- "prompts": "2.3.2",
102
- "puppeteer": "~5.2.1",
103
- "rollup": "2.23.0",
104
- "semiver": "^1.1.0",
105
- "semver": "7.3.2",
106
- "sizzle": "^2.3.5",
107
- "terser": "4.8.0",
108
- "tslib": "^2.0.0",
109
- "webpack": "^4.44.0",
110
- "ws": "7.3.1"
111
- },
112
- "engines": {
113
- "node": ">=10.13.0",
114
- "npm": ">=6.0.0"
115
- },
116
- "repository": {
117
- "type": "git",
118
- "url": "git+https://github.com/navify/rindo.git"
119
- },
120
- "author": "Navify Team",
121
- "homepage": "https://rindojs.web.app/",
122
- "description": "A Compiler for Web Components and Progressive Web Apps",
123
- "keywords": [
124
- "web components",
125
- "components",
126
- "rindo",
127
- "navify",
128
- "webapp",
129
- "custom elements",
130
- "pwa",
131
- "progressive web app"
132
- ]
133
- }
1
+ {
2
+ "name": "@rindo/core",
3
+ "version": "2.5.2",
4
+ "license": "MIT",
5
+ "main": "./internal/rindo-core/index.cjs",
6
+ "module": "./internal/rindo-core/index.js",
7
+ "types": "./internal/rindo-core/index.d.ts",
8
+ "bin": {
9
+ "rindo": "bin/rindo"
10
+ },
11
+ "files": [
12
+ "bin/",
13
+ "cli/",
14
+ "compiler/",
15
+ "dependencies.json",
16
+ "dev-server/",
17
+ "internal/",
18
+ "mock-doc/",
19
+ "screenshot/",
20
+ "sys/",
21
+ "testing/"
22
+ ],
23
+ "scripts": {
24
+ "start": "npm run watch",
25
+ "changelog": "conventional-changelog -p angular -o -i CHANGELOG.md -s",
26
+ "build": "node scripts && npm run tsc.prod && npm run rollup.prod.ci",
27
+ "build.prod": "node scripts && npm run tsc.scripts && npm run tsc.prod && npm run rollup.prod.ci",
28
+ "watch": "node scripts && npm run tsc && concurrently \"npm run rollup.watch\" \"npm run tsc.watch\"",
29
+ "release": "node scripts --release --publish --any-branch",
30
+ "release.prepare": "node scripts --release --prepare --any-branch",
31
+ "tsc": "tsc --incremental",
32
+ "tsc.prod": "tsc",
33
+ "tsc.scripts": "tsc -p scripts/tsconfig.json",
34
+ "tsc.watch": "tsc --incremental --watch",
35
+ "rollup": "rollup --config",
36
+ "rollup.prod": "rollup --config --config-prod",
37
+ "rollup.prod.ci": "rollup --config --config-prod --config-ci",
38
+ "rollup.watch": "rollup --watch --config",
39
+ "license": "node scripts --license",
40
+ "prettier": "prettier --write \"./src/**/*.{ts,tsx}\""
41
+ },
42
+ "devDependencies": {
43
+ "@rollup/plugin-commonjs": "15.1.0",
44
+ "@rollup/plugin-json": "4.1.0",
45
+ "@rollup/plugin-node-resolve": "9.0.0",
46
+ "@rollup/plugin-replace": "2.3.4",
47
+ "@rollup/pluginutils": "4.1.0",
48
+ "@types/autoprefixer": "^10.2.0",
49
+ "@types/exit": "^0.1.31",
50
+ "@types/fs-extra": "^9.0.8",
51
+ "@types/glob": "^7.1.2",
52
+ "@types/graceful-fs": "^4.1.5",
53
+ "@types/inquirer": "^7.3.1",
54
+ "@types/is-glob": "^4.0.1",
55
+ "@types/jest": "^26.0.21",
56
+ "@types/listr": "^0.14.2",
57
+ "@types/mime-types": "^2.1.0",
58
+ "@types/node": "^14.14.35",
59
+ "@types/node-fetch": "^2.5.8",
60
+ "@types/parse5": "^6.0.0",
61
+ "@types/pixelmatch": "^4.0.0",
62
+ "@types/pngjs": "^3.4.2",
63
+ "@types/prompts": "^2.0.9",
64
+ "@types/puppeteer": "^5.4.3",
65
+ "@types/semver": "^7.3.4",
66
+ "@types/sizzle": "^2.3.2",
67
+ "@types/webpack": "^4.41.26",
68
+ "@types/ws": "^7.4.0",
69
+ "ansi-colors": "4.1.1",
70
+ "autoprefixer": "10.2.5",
71
+ "concurrently": "^6.0.0",
72
+ "conventional-changelog-cli": "^2.1.1",
73
+ "core-js-builder": "~3.6.5",
74
+ "css": "^3.0.0",
75
+ "dts-bundle-generator": "~5.3.0",
76
+ "execa": "4.1.0",
77
+ "exit": "^0.1.2",
78
+ "fast-deep-equal": "3.1.3",
79
+ "fs-extra": "^9.1.0",
80
+ "glob": "7.1.6",
81
+ "graceful-fs": "~4.2.6",
82
+ "hash.js": "^1.1.7",
83
+ "inquirer": "^7.3.3",
84
+ "jest": "^26.6.3",
85
+ "jest-cli": "^26.6.3",
86
+ "jest-environment-node": "^26.6.2",
87
+ "listr": "^0.14.3",
88
+ "magic-string": "^0.25.7",
89
+ "mime-db": "^1.46.0",
90
+ "minimatch": "3.0.4",
91
+ "node-fetch": "2.6.1",
92
+ "open": "8.0.4",
93
+ "open-in-editor": "2.2.0",
94
+ "parse5": "6.0.1",
95
+ "path-browserify": "^1.0.1",
96
+ "pixelmatch": "4.0.2",
97
+ "postcss": "^8.2.8",
98
+ "prettier": "^2.2.1",
99
+ "prompts": "2.4.0",
100
+ "puppeteer": "~5.5.0",
101
+ "rollup": "2.42.3",
102
+ "semiver": "^1.1.0",
103
+ "semver": "7.3.4",
104
+ "sizzle": "^2.3.6",
105
+ "terser": "5.6.1",
106
+ "tslib": "^2.1.0",
107
+ "typescript": "4.2.3",
108
+ "webpack": "^4.46.0",
109
+ "ws": "7.4.4"
110
+ },
111
+ "engines": {
112
+ "node": ">=12.10.0",
113
+ "npm": ">=6.0.0"
114
+ },
115
+ "repository": {
116
+ "type": "git",
117
+ "url": "git+https://github.com/familyjs/rindo.git"
118
+ },
119
+ "author": "Family Team",
120
+ "homepage": "https://rindojs.web.app/",
121
+ "description": "A Compiler for Web Components and Progressive Web Apps",
122
+ "keywords": [
123
+ "web components",
124
+ "components",
125
+ "rindo",
126
+ "family",
127
+ "webapp",
128
+ "custom elements",
129
+ "pwa",
130
+ "progressive web app"
131
+ ]
132
+ }
package/readme.md CHANGED
@@ -1,95 +1,21 @@
1
- # Rindo
2
-
3
- A Compiler for Web Components and PWAs
4
-
5
- ```bash
6
- npm init rindo
7
- ```
8
-
9
- [Rindo](https://rindojs.web.app/) is a simple compiler for generating Web Components and progressive web apps (PWA). Rindo was built by the [Navify Framework](http://navifyframework.web.app/) team for its next generation of performant mobile and desktop Web Components.
10
-
11
- Rindo combines the best concepts of the most popular frontend frameworks into a compile-time rather than run-time tool. It takes TypeScript, JSX, a tiny virtual DOM layer, efficient one-way data binding, an asynchronous rendering pipeline (similar to React Fiber), and lazy-loading out of the box, and generates 100% standards-based Web Components that run on both [modern browsers and legacy browsers](#browser-support) back to Internet Explorer 11.
12
-
13
- Rindo components are just Web Components, so they work in any major framework or with no framework at all. In many cases, Rindo can be used as a drop in replacement for traditional frontend frameworks given the capabilities now available in the browser, though using it as such is certainly not required.
14
-
15
- Rindo also enables a number of key capabilities on top of Web Components, in particular Server Side Rendering (SSR) without the need to run a headless browser, pre-rendering, and objects-as-properties (instead of just strings).
16
-
17
- *Note: Rindo and [Navify](https://navifyframework.web.app/) are completely independent projects. Rindo does not prescribe any specific UI framework, but Navify is the largest user of Rindo (today!)*
18
-
19
-
20
- ## Getting Started
21
-
22
- To create a new project using an interactive cli, run:
23
-
24
- ```bash
25
- npm init rindo
26
- ```
27
-
28
- To start developing your new Rindo project, run:
29
-
30
- ```bash
31
- npm start
32
- ```
33
-
34
-
35
- ## Creating components
36
-
37
- Rindo components are TypeScript classes with decorator metadata. The decorators themselves are purely build-time annotations so the compiler can read metadata about each component, and removed entirely for smaller efficient components.
38
-
39
- Create new components by creating files with a `.tsx` extension, such as `my-component.tsx`, and place them in `src/components`.
40
-
41
- ```tsx
42
- import { Component, Prop, h } from '@rindo/core';
43
-
44
- @Component({
45
- tag: 'my-component',
46
- styleUrl: 'my-component.css'
47
- })
48
- export class MyComponent {
49
-
50
- @Prop() first: string;
51
-
52
- @Prop() last: string;
53
-
54
- render() {
55
- return (
56
- <div>
57
- Hello, my name is {this.first} {this.last}
58
- </div>
59
- );
60
- }
61
- }
62
- ```
63
-
64
- Note: the `.tsx` extension is required, as this is the standard for TypeScript classes that use JSX.
65
-
66
- To use this component, just use it like any other HTML element:
67
-
68
- ```html
69
- <my-component first="Rindo" last="JS"></my-component>
70
- ```
71
-
72
-
73
- ## API
74
-
75
- The API for rindo closely mirrors the API for Custom Elements v1.
76
-
77
- ### Components
78
-
79
- | Decorator | Description |
80
- | -------------- | --- |
81
- | `@Component()` | Indicate a class is a Rindo component. |
82
- | | |
83
- | `@Prop()` | Creates a property that will exist on the element and be data-bound to this component. |
84
- | `@State()` | Creates a local state variable that will not be placed on the element. |
85
- | `@Method()` | Expose specific methods to be publicly accessible. |
86
-
87
- ### All browsers
88
-
89
- Some modern browsers like Edge do not include native support for Web Components. In that case, we conditionally load the [Custom Elements v1](https://github.com/webcomponents/polyfills/tree/master/packages/custom-elements) polyfill.
90
-
91
-
92
- ## License
93
-
94
- - [MIT](./LICENSE.md)
95
-
1
+ # Rindo: A Compiler for Web Components and PWAs
2
+
3
+ [RindoJS documentation](https://rindojs.web.app/)
4
+
5
+ ## Getting Started
6
+
7
+ To create a new project using an interactive cli, run:
8
+
9
+ ```bash
10
+ npm init rindo
11
+ ```
12
+
13
+ To start developing your new Rindo project, run:
14
+
15
+ ```bash
16
+ npm start
17
+ ```
18
+
19
+ ## License
20
+
21
+ - [MIT](./LICENSE.md)
@@ -1,33 +1,33 @@
1
-
2
- (function() {
3
- function checkSupport() {
4
- if (!document.body) {
5
- setTimeout(checkSupport);
6
- return;
7
- }
8
- function supportsDynamicImports() {
9
- try {
10
- new Function('import("")');
11
- return true;
12
- } catch (e) {}
13
- return false;
14
- }
15
- var supportsEsModules = !!('noModule' in document.createElement('script'));
16
-
17
- if (!supportsEsModules) {
18
- document.body.innerHTML = '\n \n<style>\nbody {\n display: block !important;\n font-family: sans-serif;\n padding: 20px;\n line-height:22px;\n}\nh1 {\n font-size: 18px;\n}\nh2 {\n font-size: 14px;\n margin-top: 40px;\n}\n</style>\n\n\n <h1>This Rindo app is disabled for this browser.</h1>\n\n <h2>Developers:</h2>\n <ul>\n <li>ES5 builds are disabled <strong>during development</strong> to take advantage of 2x faster build times.</li>\n <li>Please see the example below or our <a href="https://rindojs.com/docs/rindo-config" target="_blank" rel="noopener noreferrer">config docs</a> if you would like to develop on a browser that does not fully support ES2017 and custom elements.</li>\n <li>Note that by default, ES5 builds and polyfills are enabled during production builds.</li>\n <li>When testing browsers it is recommended to always test in production mode, and ES5 builds should always be enabled during production builds.</li>\n <li><em>This is only an experiment and if it slows down app development then we will revert this and enable ES5 builds during dev.</em></li>\n </ul>\n\n\n <h2>Enabling ES5 builds during development:</h2>\n <pre>\n <code>npm run dev --es5</code>\n </pre>\n <p>For rindo-component-starter, use:</p>\n <pre>\n <code>npm start --es5</code>\n </pre>\n\n\n <h2>Enabling full production builds during development:</h2>\n <pre>\n <code>npm run dev --prod</code>\n </pre>\n <p>For rindo-component-starter, use:</p>\n <pre>\n <code>npm start --prod</code>\n </pre>\n\n <h2>Current Browser\'s Support:</h2>\n <ul>\n <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import">ES Module Imports</a>: <span id="es-modules-test"></span></li>\n <li><a href="http://2ality.com/2017/01/import-operator.html">ES Dynamic Imports</a>: <span id="es-dynamic-modules-test"></span></li>\n <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/customElements">Custom Elements</a>: <span id="custom-elements-test"></span></li>\n <li><a href="https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM">Shadow DOM</a>: <span id="shadow-dom-test"></span></li>\n <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API">fetch</a>: <span id="fetch-test"></span></li>\n <li><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables">CSS Variables</a>: <span id="css-variables-test"></span></li>\n </ul>\n\n <h2>Current Browser:</h2>\n <pre>\n <code id="current-browser-output"></code>\n </pre>\n';
19
-
20
- document.getElementById('current-browser-output').textContent = window.navigator.userAgent;
21
- document.getElementById('es-modules-test').textContent = supportsEsModules;
22
- document.getElementById('es-dynamic-modules-test').textContent = supportsDynamicImports();
23
- document.getElementById('shadow-dom-test').textContent = !!(document.head.attachShadow);
24
- document.getElementById('custom-elements-test').textContent = !!(window.customElements);
25
- document.getElementById('css-variables-test').textContent = !!(window.CSS && window.CSS.supports && window.CSS.supports('color', 'var(--c)'));
26
- document.getElementById('fetch-test').textContent = !!(window.fetch);
27
- } else {
28
- document.body.innerHTML = '\n \n<style>\nbody {\n display: block !important;\n font-family: sans-serif;\n padding: 20px;\n line-height:22px;\n}\nh1 {\n font-size: 18px;\n}\nh2 {\n font-size: 14px;\n margin-top: 40px;\n}\n</style>\n\n\n <h1>Update src/index.html</h1>\n\n <p>Rindo recently changed how scripts are loaded in order to improve performance.</p>\n\n <h2>BEFORE:</h2>\n <p>Previously, a single script was included that handled loading the correct JavaScript based on browser support.</p>\n <pre>\n <code>&lt;script src=&quot;/build/app.js&quot;&gt;&lt;/script&gt;\n</code>\n </pre>\n\n <h2 style="margin-top:0">AFTER:</h2>\n <p>The index.html should now include two scripts using the modern ES Module script pattern.\n Note that only one file will actually be requested and loaded based on the browser\'s native support for ES Modules.\n For more info, please see <a href="https://developers.google.com/web/fundamentals/primers/modules#browser" target="_blank" rel="noopener noreferrer">Using JavaScript modules on the web</a>.\n </p>\n <pre>\n <code>&lt;script <span style="background:yellow">type="module"</span> src="/build/app<span style="background:yellow">.esm</span>.js"&gt;&lt;/script&gt;\n &lt;script <span style="background:yellow">nomodule</span> src=&quot;/build/app.js&quot;&gt;&lt;/script&gt;</code>\n </pre>\n';
29
- }
30
- }
31
-
32
- setTimeout(checkSupport);
33
- })();
1
+
2
+ (function() {
3
+ function checkSupport() {
4
+ if (!document.body) {
5
+ setTimeout(checkSupport);
6
+ return;
7
+ }
8
+ function supportsDynamicImports() {
9
+ try {
10
+ new Function('import("")');
11
+ return true;
12
+ } catch (e) {}
13
+ return false;
14
+ }
15
+ var supportsEsModules = !!('noModule' in document.createElement('script'));
16
+
17
+ if (!supportsEsModules) {
18
+ document.body.innerHTML = '\n \n<style>\nbody {\n display: block !important;\n font-family: sans-serif;\n padding: 20px;\n line-height:22px;\n}\nh1 {\n font-size: 18px;\n}\nh2 {\n font-size: 14px;\n margin-top: 40px;\n}\n</style>\n\n\n <h1>This Rindo app is disabled for this browser.</h1>\n\n <h2>Developers:</h2>\n <ul>\n <li>ES5 builds are disabled <strong>during development</strong> to take advantage of 2x faster build times.</li>\n <li>Please see the example below or our <a href="https://rindojs.web.app/docs/rindo-config" target="_blank" rel="noopener noreferrer">config docs</a> if you would like to develop on a browser that does not fully support ES2017 and custom elements.</li>\n <li>Note that by default, ES5 builds and polyfills are enabled during production builds.</li>\n <li>When testing browsers it is recommended to always test in production mode, and ES5 builds should always be enabled during production builds.</li>\n <li><em>This is only an experiment and if it slows down app development then we will revert this and enable ES5 builds during dev.</em></li>\n </ul>\n\n\n <h2>Enabling ES5 builds during development:</h2>\n <pre>\n <code>npm run dev --es5</code>\n </pre>\n <p>For rindo-component-starter, use:</p>\n <pre>\n <code>npm start --es5</code>\n </pre>\n\n\n <h2>Enabling full production builds during development:</h2>\n <pre>\n <code>npm run dev --prod</code>\n </pre>\n <p>For rindo-component-starter, use:</p>\n <pre>\n <code>npm start --prod</code>\n </pre>\n\n <h2>Current Browser\'s Support:</h2>\n <ul>\n <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import">ES Module Imports</a>: <span id="es-modules-test"></span></li>\n <li><a href="http://2ality.com/2017/01/import-operator.html">ES Dynamic Imports</a>: <span id="es-dynamic-modules-test"></span></li>\n <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/customElements">Custom Elements</a>: <span id="custom-elements-test"></span></li>\n <li><a href="https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM">Shadow DOM</a>: <span id="shadow-dom-test"></span></li>\n <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API">fetch</a>: <span id="fetch-test"></span></li>\n <li><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables">CSS Variables</a>: <span id="css-variables-test"></span></li>\n </ul>\n\n <h2>Current Browser:</h2>\n <pre>\n <code id="current-browser-output"></code>\n </pre>\n';
19
+
20
+ document.getElementById('current-browser-output').textContent = window.navigator.userAgent;
21
+ document.getElementById('es-modules-test').textContent = supportsEsModules;
22
+ document.getElementById('es-dynamic-modules-test').textContent = supportsDynamicImports();
23
+ document.getElementById('shadow-dom-test').textContent = !!(document.head.attachShadow);
24
+ document.getElementById('custom-elements-test').textContent = !!(window.customElements);
25
+ document.getElementById('css-variables-test').textContent = !!(window.CSS && window.CSS.supports && window.CSS.supports('color', 'var(--c)'));
26
+ document.getElementById('fetch-test').textContent = !!(window.fetch);
27
+ } else {
28
+ document.body.innerHTML = '\n \n<style>\nbody {\n display: block !important;\n font-family: sans-serif;\n padding: 20px;\n line-height:22px;\n}\nh1 {\n font-size: 18px;\n}\nh2 {\n font-size: 14px;\n margin-top: 40px;\n}\n</style>\n\n\n <h1>Update src/index.html</h1>\n\n <p>Rindo recently changed how scripts are loaded in order to improve performance.</p>\n\n <h2>BEFORE:</h2>\n <p>Previously, a single script was included that handled loading the correct JavaScript based on browser support.</p>\n <pre>\n <code>&lt;script src=&quot;/build/app.js&quot;&gt;&lt;/script&gt;\n</code>\n </pre>\n\n <h2 style="margin-top:0">AFTER:</h2>\n <p>The index.html should now include two scripts using the modern ES Module script pattern.\n Note that only one file will actually be requested and loaded based on the browser\'s native support for ES Modules.\n For more info, please see <a href="https://developers.google.com/web/fundamentals/primers/modules#browser" target="_blank" rel="noopener noreferrer">Using JavaScript modules on the web</a>.\n </p>\n <pre>\n <code>&lt;script <span style="background:yellow">type="module"</span> src="/build/app<span style="background:yellow">.esm</span>.js"&gt;&lt;/script&gt;\n &lt;script <span style="background:yellow">nomodule</span> src=&quot;/build/app.js&quot;&gt;&lt;/script&gt;</code>\n </pre>\n';
29
+ }
30
+ }
31
+
32
+ setTimeout(checkSupport);
33
+ })();
@@ -1 +1 @@
1
- import{r as t,d as s,h as i,g as e}from"./p-fbbae598.js";import{s as n}from"./p-081b0641.js";const h={threshold:.1,includeAA:!1,alpha:.1,aaColor:[255,255,0],diffColor:[255,0,0],diffColorAlt:null,diffMask:!1};function o(t){return ArrayBuffer.isView(t)&&1===t.constructor.BYTES_PER_ELEMENT}function r(t,s,i,e,n,h){const o=Math.max(s-1,0),r=Math.max(i-1,0),c=Math.min(s+1,e-1),d=Math.min(i+1,n-1),f=4*(i*e+s);let u,p,m,g,w=s===o||s===c||i===r||i===d?1:0,y=0,v=0;for(let n=o;n<=c;n++)for(let h=r;h<=d;h++){if(n===s&&h===i)continue;const o=l(t,t,f,4*(h*e+n),!0);if(0===o){if(w++,w>2)return!1}else o<y?(y=o,u=n,p=h):o>v&&(v=o,m=n,g=h)}return 0!==y&&0!==v&&(a(t,u,p,e,n)&&a(h,u,p,e,n)||a(t,m,g,e,n)&&a(h,m,g,e,n))}function a(t,s,i,e,n){const h=Math.max(s-1,0),o=Math.max(i-1,0),r=Math.min(s+1,e-1),a=Math.min(i+1,n-1),l=4*(i*e+s);let c=s===h||s===r||i===o||i===a?1:0;for(let n=h;n<=r;n++)for(let h=o;h<=a;h++){if(n===s&&h===i)continue;const o=4*(h*e+n);if(t[l]===t[o]&&t[l+1]===t[o+1]&&t[l+2]===t[o+2]&&t[l+3]===t[o+3]&&c++,c>2)return!0}return!1}function l(t,s,i,e,n){let h=t[i+0],o=t[i+1],r=t[i+2],a=t[i+3],l=s[e+0],p=s[e+1],m=s[e+2],g=s[e+3];if(a===g&&h===l&&o===p&&r===m)return 0;a<255&&(a/=255,h=u(h,a),o=u(o,a),r=u(r,a)),g<255&&(g/=255,l=u(l,g),p=u(p,g),m=u(m,g));const w=c(h,o,r),y=c(l,p,m),v=w-y;if(n)return v;const b=d(h,o,r)-d(l,p,m),x=f(h,o,r)-f(l,p,m),M=.5053*v*v+.299*b*b+.1957*x*x;return w>y?-M:M}function c(t,s,i){return.29889531*t+.58662247*s+.11448223*i}function d(t,s,i){return.59597799*t-.2741761*s-.32180189*i}function f(t,s,i){return.21147017*t-.52261711*s+.31114694*i}function u(t,s){return 255+(t-255)*s}function p(t,s,i,e,n){t[s+0]=i,t[s+1]=e,t[s+2]=n,t[s+3]=255}function m(t,s,i,e){const n=u(c(t[s+0],t[s+1],t[s+2]),i*t[s+3]/255);p(e,s,n,n,n)}function g(t,s,i){if(y.has(s))return void i(y.get(s));if(w.has(s))return void w.get(s).push(i);w.set(s,[i]);const e=document.createElement("script");e.src=`${t}screenshot_${s}.js`,document.head.appendChild(e)}window.loadScreenshot=(t,s)=>{const i=w.get(t);i&&(i.forEach(t=>t(s)),w.delete(t)),y.set(t,s)};const w=new Map,y=new Map;class v{constructor(i){t(this,i),this.imageASrc=null,this.imageBSrc=null,this.imageAClass="is-loading",this.imageBClass="is-loading",this.canvasClass="is-loading",this.imagesLoaded=new Set,this.isImageALoaded=!1,this.isImageBLoaded=!1,this.isMismatchInitialized=!1,this.hasCalculatedMismatch=!1,this.compareLoaded=s(this,"compareLoaded",7)}componentWillLoad(){this.loadScreenshots()}componentWillUpdate(){this.loadScreenshots()}loadScreenshots(){if(this.show&&this.diff.hasIntersected)return this.diff.identical?(this.imageASrc=this.imagesUrl+this.diff.imageA,this.isImageALoaded=!0,this.imageAClass="has-loaded",this.imageBSrc=this.imagesUrl+this.diff.imageB,this.isImageBLoaded=!0,void(this.imageBClass="has-loaded")):void(this.isMismatchInitialized||(this.isMismatchInitialized=!0,null!=this.jsonpUrl?(null!=this.diff.imageA&&g(this.jsonpUrl,this.diff.imageA,t=>{this.imageASrc=t}),null!=this.diff.imageB&&g(this.jsonpUrl,this.diff.imageB,t=>{this.imageBSrc=t})):(this.imageASrc=this.imagesUrl+this.diff.imageA,this.imageBSrc=this.imagesUrl+this.diff.imageB)))}async compareImages(){const t=this.diff;this.isImageALoaded&&this.isImageBLoaded&&!this.hasCalculatedMismatch&&t.comparable&&(this.hasCalculatedMismatch=!0,t.mismatchedPixels=await function(t,s,i,e,n,a){let c=-1;try{const d=document.createElement("canvas");d.width=e,d.height=n;const f=document.createElement("canvas");f.width=e,f.height=n;const u=d.getContext("2d");u.drawImage(t,0,0);const g=f.getContext("2d");g.drawImage(s,0,0);const w=document.createElement("canvas").getContext("2d");w.drawImage(t,0,0),w.getImageData(0,0,e,n);const y=u.getImageData(0,0,e,n).data,v=g.getImageData(0,0,e,n).data,b=i.getContext("2d"),x=b.createImageData(e,d.height);c=function(t,s,i,e,n,a){if(!o(t)||!o(s)||i&&!o(i))throw new Error("Image data: Uint8Array, Uint8ClampedArray or Buffer expected.");if(t.length!==s.length||i&&i.length!==t.length)throw new Error("Image sizes do not match.");if(t.length!==e*n*4)throw new Error("Image data size does not match width/height.");a=Object.assign({},h,a);const c=e*n,d=new Uint32Array(t.buffer,t.byteOffset,c),f=new Uint32Array(s.buffer,s.byteOffset,c);let u=!0;for(let t=0;t<c;t++)if(d[t]!==f[t]){u=!1;break}if(u){if(i&&!a.diffMask)for(let s=0;s<c;s++)m(t,4*s,a.alpha,i);return 0}const g=35215*a.threshold*a.threshold;let w=0;for(let h=0;h<n;h++)for(let o=0;o<e;o++){const c=4*(h*e+o),d=l(t,s,c,c);Math.abs(d)>g?a.includeAA||!r(t,o,h,e,n,s)&&!r(s,o,h,e,n,t)?(i&&p(i,c,...d<0&&a.diffColorAlt||a.diffColor),w++):i&&!a.diffMask&&p(i,c,...a.aaColor):i&&(a.diffMask||m(t,c,a.alpha,i))}return w}(y,v,x.data,e,n,{threshold:a}),b.putImageData(x,0,0)}catch(t){console.error(t)}return c}(this.imageA,this.imageB,this.canvas,Math.round(t.width*t.deviceScaleFactor),Math.round(t.height*t.deviceScaleFactor),t.threshold),this.canvasClass="has-loaded",n(t.imageA,t.imageB,t.mismatchedPixels,t.threshold),this.compareLoaded.emit(t))}render(){const t=this.diff,s={width:t.width+"px",height:t.height+"px"};return[i("compare-cell",null,null!=t.imageA?i("a",{href:this.imagesUrl+t.imageA,target:"_blank"},i("img",{src:this.imageASrc,class:this.imageAClass,style:s,onLoad:this.diff.identical?null:()=>{this.isImageALoaded=!0,this.imageAClass="has-loaded",this.compareImages()},ref:t=>this.imageA=t})):i("img",{style:s,class:"is-loading"})),i("compare-cell",null,null!=t.imageB?i("a",{href:this.imagesUrl+t.imageB,target:"_blank"},i("img",{src:this.imageBSrc,class:this.imageBClass,style:s,onLoad:this.diff.identical?null:()=>{this.isImageBLoaded=!0,this.imageBClass="has-loaded",this.compareImages()},ref:t=>this.imageB=t})):i("img",{style:s,class:"is-loading"})),i("compare-cell",null,this.diff.identical?i("img",{style:s,src:this.imageASrc}):i("canvas",{width:Math.round(t.width*t.deviceScaleFactor),height:Math.round(t.height*t.deviceScaleFactor),class:this.canvasClass,style:s,hidden:!t.comparable,ref:t=>this.canvas=t})),i("compare-cell",null,i("compare-analysis",{aId:this.aId,bId:this.bId,mismatchedPixels:this.diff.mismatchedPixels,diff:this.diff}))]}get elm(){return e(this)}}v.style="compare-row img,compare-row canvas{display:block;box-shadow:var(--screenshot-box-shadow);border-radius:var(--screenshot-border-radius)}compare-row a{display:block}.is-loading{visibility:hidden}";class b{constructor(s){t(this,s)}render(){if(!this.a||!this.b||!this.diffs)return;let t=0;this.diffs.forEach(s=>{s.width>t&&(t=s.width)}),t-=6;const s={width:t+"px"};return[i("th-cell",null,i("div",{style:s},i("a",{href:this.a.url,target:"_blank"},this.a.message))),i("th-cell",null,i("div",{style:s},i("a",{href:this.b.url,target:"_blank"},this.b.message))),i("th-cell",null,i("div",{style:s},i("a",{href:`https://github.com/navify/navify/compare/${this.a.id}...${this.b.id}`,target:"_blank"},"Compare: ",this.a.id," - ",this.b.id))),i("th-cell",{class:"analysis"},i("div",null,"Analysis"))]}}b.style=":host{display:flex}th-cell{display:block;flex:1;font-weight:500;font-size:12px}th-cell div{padding-left:12px;padding-right:12px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}th-cell a{color:var(--font-color);text-decoration:none}th-cell a:hover{color:var(--analysis-data-color);text-decoration:underline}.analysis div{width:262px}";export{v as compare_row,b as compare_thead}
1
+ import{r as t,d as s,h as i,g as e}from"./p-fbbae598.js";import{s as n}from"./p-081b0641.js";const h={threshold:.1,includeAA:!1,alpha:.1,aaColor:[255,255,0],diffColor:[255,0,0],diffColorAlt:null,diffMask:!1};function o(t){return ArrayBuffer.isView(t)&&1===t.constructor.BYTES_PER_ELEMENT}function r(t,s,i,e,n,h){const o=Math.max(s-1,0),r=Math.max(i-1,0),c=Math.min(s+1,e-1),d=Math.min(i+1,n-1),f=4*(i*e+s);let u,p,m,g,w=s===o||s===c||i===r||i===d?1:0,y=0,v=0;for(let n=o;n<=c;n++)for(let h=r;h<=d;h++){if(n===s&&h===i)continue;const o=l(t,t,f,4*(h*e+n),!0);if(0===o){if(w++,w>2)return!1}else o<y?(y=o,u=n,p=h):o>v&&(v=o,m=n,g=h)}return 0!==y&&0!==v&&(a(t,u,p,e,n)&&a(h,u,p,e,n)||a(t,m,g,e,n)&&a(h,m,g,e,n))}function a(t,s,i,e,n){const h=Math.max(s-1,0),o=Math.max(i-1,0),r=Math.min(s+1,e-1),a=Math.min(i+1,n-1),l=4*(i*e+s);let c=s===h||s===r||i===o||i===a?1:0;for(let n=h;n<=r;n++)for(let h=o;h<=a;h++){if(n===s&&h===i)continue;const o=4*(h*e+n);if(t[l]===t[o]&&t[l+1]===t[o+1]&&t[l+2]===t[o+2]&&t[l+3]===t[o+3]&&c++,c>2)return!0}return!1}function l(t,s,i,e,n){let h=t[i+0],o=t[i+1],r=t[i+2],a=t[i+3],l=s[e+0],p=s[e+1],m=s[e+2],g=s[e+3];if(a===g&&h===l&&o===p&&r===m)return 0;a<255&&(a/=255,h=u(h,a),o=u(o,a),r=u(r,a)),g<255&&(g/=255,l=u(l,g),p=u(p,g),m=u(m,g));const w=c(h,o,r),y=c(l,p,m),v=w-y;if(n)return v;const b=d(h,o,r)-d(l,p,m),x=f(h,o,r)-f(l,p,m),M=.5053*v*v+.299*b*b+.1957*x*x;return w>y?-M:M}function c(t,s,i){return.29889531*t+.58662247*s+.11448223*i}function d(t,s,i){return.59597799*t-.2741761*s-.32180189*i}function f(t,s,i){return.21147017*t-.52261711*s+.31114694*i}function u(t,s){return 255+(t-255)*s}function p(t,s,i,e,n){t[s+0]=i,t[s+1]=e,t[s+2]=n,t[s+3]=255}function m(t,s,i,e){const n=u(c(t[s+0],t[s+1],t[s+2]),i*t[s+3]/255);p(e,s,n,n,n)}function g(t,s,i){if(y.has(s))return void i(y.get(s));if(w.has(s))return void w.get(s).push(i);w.set(s,[i]);const e=document.createElement("script");e.src=`${t}screenshot_${s}.js`,document.head.appendChild(e)}window.loadScreenshot=(t,s)=>{const i=w.get(t);i&&(i.forEach(t=>t(s)),w.delete(t)),y.set(t,s)};const w=new Map,y=new Map;class v{constructor(i){t(this,i),this.imageASrc=null,this.imageBSrc=null,this.imageAClass="is-loading",this.imageBClass="is-loading",this.canvasClass="is-loading",this.imagesLoaded=new Set,this.isImageALoaded=!1,this.isImageBLoaded=!1,this.isMismatchInitialized=!1,this.hasCalculatedMismatch=!1,this.compareLoaded=s(this,"compareLoaded",7)}componentWillLoad(){this.loadScreenshots()}componentWillUpdate(){this.loadScreenshots()}loadScreenshots(){if(this.show&&this.diff.hasIntersected)return this.diff.identical?(this.imageASrc=this.imagesUrl+this.diff.imageA,this.isImageALoaded=!0,this.imageAClass="has-loaded",this.imageBSrc=this.imagesUrl+this.diff.imageB,this.isImageBLoaded=!0,void(this.imageBClass="has-loaded")):void(this.isMismatchInitialized||(this.isMismatchInitialized=!0,null!=this.jsonpUrl?(null!=this.diff.imageA&&g(this.jsonpUrl,this.diff.imageA,t=>{this.imageASrc=t}),null!=this.diff.imageB&&g(this.jsonpUrl,this.diff.imageB,t=>{this.imageBSrc=t})):(this.imageASrc=this.imagesUrl+this.diff.imageA,this.imageBSrc=this.imagesUrl+this.diff.imageB)))}async compareImages(){const t=this.diff;this.isImageALoaded&&this.isImageBLoaded&&!this.hasCalculatedMismatch&&t.comparable&&(this.hasCalculatedMismatch=!0,t.mismatchedPixels=await function(t,s,i,e,n,a){let c=-1;try{const d=document.createElement("canvas");d.width=e,d.height=n;const f=document.createElement("canvas");f.width=e,f.height=n;const u=d.getContext("2d");u.drawImage(t,0,0);const g=f.getContext("2d");g.drawImage(s,0,0);const w=document.createElement("canvas").getContext("2d");w.drawImage(t,0,0),w.getImageData(0,0,e,n);const y=u.getImageData(0,0,e,n).data,v=g.getImageData(0,0,e,n).data,b=i.getContext("2d"),x=b.createImageData(e,d.height);c=function(t,s,i,e,n,a){if(!o(t)||!o(s)||i&&!o(i))throw new Error("Image data: Uint8Array, Uint8ClampedArray or Buffer expected.");if(t.length!==s.length||i&&i.length!==t.length)throw new Error("Image sizes do not match.");if(t.length!==e*n*4)throw new Error("Image data size does not match width/height.");a=Object.assign({},h,a);const c=e*n,d=new Uint32Array(t.buffer,t.byteOffset,c),f=new Uint32Array(s.buffer,s.byteOffset,c);let u=!0;for(let t=0;t<c;t++)if(d[t]!==f[t]){u=!1;break}if(u){if(i&&!a.diffMask)for(let s=0;s<c;s++)m(t,4*s,a.alpha,i);return 0}const g=35215*a.threshold*a.threshold;let w=0;for(let h=0;h<n;h++)for(let o=0;o<e;o++){const c=4*(h*e+o),d=l(t,s,c,c);Math.abs(d)>g?a.includeAA||!r(t,o,h,e,n,s)&&!r(s,o,h,e,n,t)?(i&&p(i,c,...d<0&&a.diffColorAlt||a.diffColor),w++):i&&!a.diffMask&&p(i,c,...a.aaColor):i&&(a.diffMask||m(t,c,a.alpha,i))}return w}(y,v,x.data,e,n,{threshold:a}),b.putImageData(x,0,0)}catch(t){console.error(t)}return c}(this.imageA,this.imageB,this.canvas,Math.round(t.width*t.deviceScaleFactor),Math.round(t.height*t.deviceScaleFactor),t.threshold),this.canvasClass="has-loaded",n(t.imageA,t.imageB,t.mismatchedPixels,t.threshold),this.compareLoaded.emit(t))}render(){const t=this.diff,s={width:t.width+"px",height:t.height+"px"};return[i("compare-cell",null,null!=t.imageA?i("a",{href:this.imagesUrl+t.imageA,target:"_blank"},i("img",{src:this.imageASrc,class:this.imageAClass,style:s,onLoad:this.diff.identical?null:()=>{this.isImageALoaded=!0,this.imageAClass="has-loaded",this.compareImages()},ref:t=>this.imageA=t})):i("img",{style:s,class:"is-loading"})),i("compare-cell",null,null!=t.imageB?i("a",{href:this.imagesUrl+t.imageB,target:"_blank"},i("img",{src:this.imageBSrc,class:this.imageBClass,style:s,onLoad:this.diff.identical?null:()=>{this.isImageBLoaded=!0,this.imageBClass="has-loaded",this.compareImages()},ref:t=>this.imageB=t})):i("img",{style:s,class:"is-loading"})),i("compare-cell",null,this.diff.identical?i("img",{style:s,src:this.imageASrc}):i("canvas",{width:Math.round(t.width*t.deviceScaleFactor),height:Math.round(t.height*t.deviceScaleFactor),class:this.canvasClass,style:s,hidden:!t.comparable,ref:t=>this.canvas=t})),i("compare-cell",null,i("compare-analysis",{aId:this.aId,bId:this.bId,mismatchedPixels:this.diff.mismatchedPixels,diff:this.diff}))]}get elm(){return e(this)}}v.style="compare-row img,compare-row canvas{display:block;box-shadow:var(--screenshot-box-shadow);border-radius:var(--screenshot-border-radius)}compare-row a{display:block}.is-loading{visibility:hidden}";class b{constructor(s){t(this,s)}render(){if(!this.a||!this.b||!this.diffs)return;let t=0;this.diffs.forEach(s=>{s.width>t&&(t=s.width)}),t-=6;const s={width:t+"px"};return[i("th-cell",null,i("div",{style:s},i("a",{href:this.a.url,target:"_blank"},this.a.message))),i("th-cell",null,i("div",{style:s},i("a",{href:this.b.url,target:"_blank"},this.b.message))),i("th-cell",null,i("div",{style:s},i("a",{href:`https://github.com/familyjs/rindo/compare/${this.a.id}...${this.b.id}`,target:"_blank"},"Compare: ",this.a.id," - ",this.b.id))),i("th-cell",{class:"analysis"},i("div",null,"Analysis"))]}}b.style=":host{display:flex}th-cell{display:block;flex:1;font-weight:500;font-size:12px}th-cell div{padding-left:12px;padding-right:12px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}th-cell a{color:var(--font-color);text-decoration:none}th-cell a:hover{color:var(--analysis-data-color);text-decoration:underline}.analysis div{width:262px}";export{v as compare_row,b as compare_thead}
@@ -1,4 +1,4 @@
1
- import * as d from '@rindo/core/internal';
1
+ import type * as d from '@rindo/core/internal';
2
2
  export declare class ScreenshotConnector implements d.ScreenshotConnector {
3
3
  rootDir: string;
4
4
  cacheDir: string;
@@ -1,4 +1,4 @@
1
- import * as d from '@rindo/core/internal';
1
+ import type * as d from '@rindo/core/internal';
2
2
  import { ScreenshotConnector } from './connector-base';
3
3
  export declare class ScreenshotLocalConnector extends ScreenshotConnector {
4
4
  publishBuild(results: d.ScreenshotBuildResults): Promise<d.ScreenshotBuildResults>;