Commit Graph

305 Commits

Author SHA1 Message Date
RMidhunSuresh 7046fcc7c7 Find list of resolved colors from result
and also throw only if secondary color was provided
2022-04-07 11:53:11 +05:30
RMidhunSuresh 8c6400ab2c utf-8 --> utf8 2022-04-07 11:53:11 +05:30
RMidhunSuresh 5d5eb93baa Implement plugin 2022-04-07 11:53:11 +05:30
RMidhunSuresh bfd73ae52a Pass derive function as argument 2022-04-07 11:37:20 +05:30
RMidhunSuresh 6d724e27e7 No need to check if icons are already written 2022-04-07 11:35:24 +05:30
RMidhunSuresh 2dd655cd9a Check if icon is in shared var 2022-04-07 11:35:24 +05:30
RMidhunSuresh 9a96112146 Rename function name 2022-04-07 11:35:24 +05:30
RMidhunSuresh 545ff2ec32 Add explaining comment 2022-04-07 11:35:24 +05:30
RMidhunSuresh 5e702171ce Remove console.log 2022-04-07 11:35:24 +05:30
RMidhunSuresh cd4fce0c6f Populate shared map with collected icons 2022-04-07 11:35:24 +05:30
RMidhunSuresh 1a50effd86 Only extract into variables if file is svg 2022-04-07 11:35:24 +05:30
RMidhunSuresh b7a47ae901 Give function better name 2022-04-07 11:35:24 +05:30
RMidhunSuresh 0a186dd11b Fix css logic 2022-04-07 11:35:24 +05:30
RMidhunSuresh f07a3ea5b5 Remove css specific syntax from map 2022-04-07 11:35:24 +05:30
RMidhunSuresh 2d4ec5380e Initialize variables later 2022-04-07 11:35:24 +05:30
RMidhunSuresh 6b4bb762aa Remove unused variable 2022-04-07 11:35:24 +05:30
RMidhunSuresh 97ade0659c Add explaining comment 2022-04-07 11:35:24 +05:30
RMidhunSuresh b59d6970fc Fix code duplication in tests 2022-04-07 11:35:21 +05:30
RMidhunSuresh cbff912476 Improve code quality 2022-04-07 11:34:11 +05:30
RMidhunSuresh 3ae2b4dab4 Use two url() in test 2022-04-07 11:34:11 +05:30
RMidhunSuresh f897e5132c Implement url to variables plugin 2022-04-07 11:34:11 +05:30
RMidhunSuresh f75ee86c0e Change comment 2022-04-06 12:30:26 +05:30
RMidhunSuresh 7f9af5b5fa Add icon to manifest 2022-04-06 12:30:26 +05:30
RMidhunSuresh b0f082e81f Add derived variables to source section 2022-04-06 12:30:26 +05:30
RMidhunSuresh d5b5e10230 Produce manifest.jsom 2022-04-06 12:30:26 +05:30
RMidhunSuresh 86c45b5b99 Emit runtime bundle 2022-04-06 12:30:26 +05:30
RMidhunSuresh 32eb95734a Add default themes to index html 2022-04-06 12:30:26 +05:30
RMidhunSuresh 1f6efb4db3 Write plugin code 2022-04-06 12:30:26 +05:30
RMidhunSuresh 48d0242c80 Also derive variables in URLs 2022-04-06 12:23:55 +05:30
Eric Eastwood 2401b7f453 Add way to test whether SDK works in ESM and CommonJS 2022-04-05 19:24:27 -05:00
Eric Eastwood dd06d78a72 Avoid ERR_REQUIRE_ESM errors when requiring SDK 2022-04-05 18:17:14 -05:00
Eric Eastwood d247bc4e28 Merge branch 'master' into madlittlemods/686-682-local-friendly-development-and-commonjs
Conflicts:
	package.json
	scripts/sdk/base-manifest.json
2022-04-05 17:15:30 -05:00
RMidhunSuresh 454345c9b2 Always set map 2022-04-05 15:08:35 +05:30
RMidhunSuresh 76789eacf1 Use array instead of Set 2022-04-01 20:43:42 +05:30
RMidhunSuresh 859449ed60 Write test for map population 2022-04-01 16:41:00 +05:30
RMidhunSuresh 918a3e42b1 Populate compiled variables map 2022-04-01 16:23:33 +05:30
RMidhunSuresh 4350d2f264 Don't derive variables for runtime theme 2022-04-01 16:20:58 +05:30
RMidhunSuresh e8bd1f3390 Pass result as message 2022-03-27 20:06:26 +05:30
RMidhunSuresh 72785e7c3e Remove -- from everywhere 2022-03-23 20:39:24 +05:30
RMidhunSuresh 59ca8e6309 Add explanation of plugin 2022-03-23 17:25:12 +05:30
RMidhunSuresh 5d4323cd1d Remove stray "--" from code 2022-03-23 17:12:14 +05:30
RMidhunSuresh 19a6d669a9 Extract base variables from css 2022-03-14 23:26:37 +05:30
RMidhunSuresh bca1648df6 Move plugin to /scripts and create eslintrc 2022-03-14 11:35:10 +05:30
Bruno Windels 42141c7063 bump SDK version 2022-03-01 15:45:24 +01:00
Eric Eastwood 8fb2b2755a Fix typos pointing to wrong files 2022-02-26 03:08:16 -06:00
Eric Eastwood cd007b40e1 Make the SDK friendly to locally link and develop on
Fix https://github.com/vector-im/hydrogen-web/issues/686
Fix https://github.com/vector-im/hydrogen-web/issues/682

Instead of deleting the whole `target/` directory, leave it alone so the symlink
driving the `npm link`/`yarn link` stays in tact.

Leave Vite builds in their build directories (`/lib-build`/`/asset-build`)
so you can `vite build --watch` to build on local changes and still have a
consisent place to reference in the `package.json` `exports`. Previously,
everything relied on `build.sh` which does a bunch of moving and renaming
and made it hard to rebuild on changes.

Add back support for CommonJS (adding the `package.json` `exports`).

The last piece is making sure the `?url` imports (`import workerPath from 'hydrogen-view-sdk/main.js?url';`)
work still. It looks like this may have just been solved via
https://github.com/vitejs/vite/issues/6725 -> https://github.com/vitejs/vite/pull/7073
(literally 2 days ago) and we just need to wait for the next Vite release 🎉
2022-02-26 01:12:00 -06:00
Bruno Windels ac48a5a4df bump SDK version to 0.0.8 2022-02-17 10:10:23 +01:00
Bruno Windels 61b264be3b bump sdk version to 0.0.7 2022-02-16 10:20:53 +01:00
Bruno Windels dea1e7eaf3 bump sdk version 2022-02-15 11:31:50 +01:00
Bruno Windels b868734378 change sdk version 2022-02-07 11:05:28 +01:00
Bruno Windels 1ed8d48ced release SDK 0.0.4 2022-01-12 18:39:13 +01:00
Bruno Windels 93eca757d3 dont add paths/vite to sdk output, as it does not work 2022-01-12 18:31:55 +01:00
Bruno Windels 3f60ef8da7 release sdk version 0.0.3 2022-01-12 17:51:48 +01:00
Bruno Windels f526098293 also remove ts types, as we get errors for the untyped files
that don't exist
2022-01-12 17:41:00 +01:00
Bruno Windels d7290bf750 remove exports field to try and prevent vite bug resolving asset url
downside is that we can't export cjs version anymore
2022-01-12 17:14:52 +01:00
RMidhunSuresh 205de7e5c5 Add hash-bang to fix build error 2021-12-27 15:51:25 +05:30
Bruno Windels 908f9a7ce3 try to export stylesheet 2021-12-22 18:04:30 +01:00
Bruno Windels 5f389e654a add description 2021-12-22 16:37:53 +01:00
Bruno Windels c3ff571af7 update SDK doc, use it as sdk package readme 2021-12-22 16:31:19 +01:00
Bruno Windels 441fa13bfd change sdk package name to hydrogen-view-sdk
as we might want to also have a lower level sdk later on
2021-12-22 16:31:19 +01:00
Bruno Windels b48280905e include path/vite in sdk bundle 2021-12-22 16:31:19 +01:00
Bruno Windels 163dae647b move output of both lib and asset build around for coherent package 2021-12-22 16:31:19 +01:00
Bruno Windels c921091957 run two vite builds for the sdk build, assets & js separately 2021-12-22 16:31:19 +01:00
Bruno Windels ceb0b5793b somewhat works, but not everything we need
it's missing still:
 - non-css assets like the download sandbox and the olm worker aren't written for some reason
 - the es and cjs lib.js entry points end up in assets with a hash for some reason
 - in these entry files, apart from our exports, something is adding an import statement for every import that was found in the tree
 - all assets are hashed even though the config tries to disable that
 - tests are included
2021-12-22 16:31:18 +01:00
Bruno Windels 5c5193ef48 remove old build system and unused dependencies
some of these are for the ie11 legacy build, which has been
postponed. They will be brougth back when we bring back the legacy build
2021-12-09 18:04:11 +01:00
Bruno Windels 62827b92b7 implement placeholder replacement so it still works with minification 2021-12-09 16:37:31 +01:00
Bruno Windels 9a82f88e1f log swSource as build fails in CI 2021-12-09 15:13:19 +01:00
Bruno Windels 23e0d3f2ff get notification badge icon url through import now we transpile the sw 2021-12-09 15:13:05 +01:00
Bruno Windels a4fac68393 use same method for setting version and build hash placeholder in sw
also better naming in service worker plugin
2021-12-09 14:36:12 +01:00
Bruno Windels 14dffa4ad4 remove leftover logging 2021-12-09 12:21:34 +01:00
Bruno Windels 8e4da396ea replace global hash in given chunks 2021-12-09 12:15:17 +01:00
Bruno Windels c344032c0a transpile service worker and cleanup build plugin 2021-12-09 11:39:28 +01:00
Bruno Windels fb8149b6cf add base to manifest path, just for completeness 2021-12-08 18:29:07 +01:00
Bruno Windels 0e2a22f509 also look in chunks for cacheable assets for service worker 2021-12-06 15:34:39 +01:00
Bruno Windels 91e69a2bd0 fix icons in manifest not being found 2021-12-06 15:25:44 +01:00
Bruno Windels 7148f6fd41 wip to not babel deps 2021-11-10 19:10:23 +01:00
Bruno Windels e83781b26a make ie11 compatible 2021-11-10 19:10:06 +01:00
Bruno Windels 36a982f7e2 WIP to run rollup twice, first with vite and babel, then to inline deps 2021-11-09 18:10:12 +01:00
Bruno Windels 122528f9a9 also transpile typescript files
note that these have already been converted to javascript by vite
2021-11-09 17:59:58 +01:00
Bruno Windels da7f66a531 setup babel for legacy build as input transform plugin 2021-11-09 14:52:03 +01:00
Bruno Windels fcde507183 WIP 2021-11-08 11:13:02 +01:00
Bruno Windels 3b72157e64 apparently, package-overrides should use esm
otherwise they don't get transpiled for some reason
2021-11-08 11:12:19 +01:00
Bruno Windels 7dce579ac3 make babel plugin run after commonjs one added by vite 2021-11-08 11:12:19 +01:00
Bruno Windels 16918ddb7d ie11 build wip 2021-11-08 11:12:13 +01:00
Bruno Windels eb60f6717a add comment for improvements 2021-11-08 11:10:34 +01:00
Bruno Windels 923a1a2057 use vite define option to inject version number everywhere 2021-11-08 11:10:34 +01:00
Bruno Windels 216afd45cc vite/rollup plugin to inject and transform manifest & service worker 2021-11-08 11:10:34 +01:00
Bruno Windels e2b20f466d remove unneeded package override 2021-11-08 11:10:34 +01:00
Bruno Windels b6fda8865f make all dependencies use vite and remove post-install script / lib dir 2021-11-08 11:10:34 +01:00
Bruno Windels 54ac5a96ca rename service-worker.js back to sw.js to unbreak updating 2021-08-23 20:23:38 +02:00
Danila Fedorin 5d764a9f0e Add comment for srcPath 2021-08-17 14:24:10 -07:00
Danila Fedorin e8dff6d16b Move web-specific files to platform/web 2021-08-17 14:13:27 -07:00
Bruno Windels b6d0d54241 explicitly name snowpack build ouput dir, and remove it after build 2021-08-17 17:20:48 +02:00
Danila Fedorin b8e32a03f8 Invoke snowpack from build script 2021-08-09 13:30:25 -07:00
Danila Fedorin b8c8325292 Copy olm and remove dompurify symlink 2021-08-06 12:46:41 -07:00
Danila Fedorin f6b2d2cca8 Move index.html to a different place 2021-08-06 12:34:20 -07:00
Danila Fedorin 4022c6121b Switch to DOMPurify in platform layer for sanitization. 2021-07-12 15:00:16 -07:00
Danila Fedorin 1435c2c9a2 Add HTML sanitization to domain layer. 2021-07-09 13:06:24 -07:00
Danila Fedorin eca5308742 Move deserialization into domain and fix tests. 2021-07-07 12:21:10 -07:00
Bruno Windels 0685fa2622 update olm to 3.2.3 2021-06-08 17:23:39 +02:00
Bruno Windels 711b5be07f show number of matches in logviewer and don't hide expanded sibling
fixes https://github.com/vector-im/hydrogen-web/issues/378
2021-06-02 21:25:46 +02:00
Bruno Windels 88a45470ba add highlight and filter support to logviewer 2021-06-02 17:10:56 +02:00
Bruno Windels d5e8481e22 allow side-effects at module level in src/ dir
otherwise things like src/observable/index.js break
2021-06-02 13:12:12 +02:00
Bruno Windels 6a5679a338 create mock storage using fake-indexeddb 2021-06-02 12:32:03 +02:00
Bruno Windels f8f1d49c56 polyfill String.matchAll for IE11
See https://github.com/babel/babel/issues/10816
Don't really understand how or why this works, but it did
2021-05-31 13:04:03 +02:00
Johannes Marbach 452a0e7bda Merge branch 'master' into feature/librejs 2021-04-28 20:22:20 +02:00
Bruno Windels 25e0211ca1
Merge pull request #279 from Johennes/feature/safari-viewport
Manually adapt UI when keyboard shows or hides on mobile Safari
2021-04-28 11:04:43 +02:00
Bruno Windels d8d97c40f7 show start time milliseconds in log viewer 2021-04-08 18:35:30 +02:00
Johannes Marbach 37bb078547 Add license comments to make GNU LibreJS accept Hydrogen's JS
This adds proper license comments to all _internal_ JS scripts in the /target
build. This way the code self-identifies as Apache-2.0 which prevents LibreJS
from blocking it.

Closes: #209

Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2021-03-27 14:19:58 +01:00
Johannes Marbach 14ed5fd1e8 Manually adapt UI when keyboard shows or hides on mobile Safari
Mobile Safari seems to be the only browser that does *not* resize the
viewport when the keyboard shows and hides. Instead the window is moved
to make room for the keyboard which moves content at the top off screen.

This uses the VisualViewport API to manually resize the `SessionView`
in response to keyboard display events. Additionally, if a DOM element
exists that has the `bottom-aligned-scroll` CSS class, its scroll
position is retained. Currently this only applies to the `Timeline`.

Note that the VisualViewport API was only introduced with iOS 13.
According to [statista.com], versions below 13 made up for 19% of
all iOS users in summer 2020, with the share continuing to fall off.
As a result, this seems like an acceptable workaround.

Fixes: #181

[statista.com]: https://www.statista.com/statistics/565270/apple-devices-ios-version-share-worldwide/

Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2021-03-26 08:29:33 +01:00
Bruno Windels 2a0045bed7 support override main css file 2021-03-25 18:54:10 +01:00
Bruno Windels cd615265f8 support overriding imports for customizations 2021-03-25 18:08:47 +01:00
Bruno Windels 165532be30 add badge icon to notifs 2021-03-25 00:12:57 +01:00
Bruno Windels 178790d816 symlink service worker for local dev, so its scope captures whole app
also rename service worker (as it is not a template anymore)
2021-03-23 18:20:23 +01:00
Bruno Windels a8ca82ca4d support running the service worker during local development 2021-03-23 18:20:23 +01:00
Bruno Windels f92f3b2c21 copy push config in build script 2021-03-23 18:20:23 +01:00
Bruno Windels 0052a11a1e convert post-install script to CJS so we can use require.resolve
this allows us to find where npm/yarn has installed deps, as we can't
assume our own node_modules directory when hydrogen is installed as a
dependency
2021-03-08 14:40:21 +01:00
Bruno Windels 5b14d14286 better time formatting and overlap logging in log viewer 2021-02-24 20:56:36 +01:00
Bruno Windels ee8886f7c2 serialize child items with parent start offset subtracted
for compactness
2021-02-24 10:37:20 +01:00
Bruno Windels 113b47540a render refs in log viewer 2021-02-23 22:11:01 +01:00
Bruno Windels 851c469727 show forced finished
this means the item was forcefully finished when the app closed down,
and the underlying operation was still running
2021-02-23 21:10:16 +01:00
Bruno Windels ba4fa1ee3e sort by start time 2021-02-23 21:10:03 +01:00
Bruno Windels 61adca3b10 show object properties in the details of the log viewer 2021-02-23 21:00:15 +01:00
Bruno Windels 204cc25304 more colors in log viewer 2021-02-19 11:57:57 +01:00
Bruno Windels cfc17ad176 stringify values in log viewer, other number 0 does not get rendered 2021-02-18 15:38:56 +01:00
Bruno Windels 499efb5ce0 add error and status to caption in logviewer 2021-02-18 13:07:12 +01:00
Bruno Windels 69feb40075 add copyright headers 2021-02-18 12:28:57 +01:00
Bruno Windels 560918e373 format times between root items better 2021-02-18 12:25:41 +01:00
Bruno Windels 19df43ca3c more compact layout, a few more detail fields and expand recursively but 2021-02-18 12:25:41 +01:00
Bruno Windels be1650defc add expand button to log items 2021-02-18 12:25:41 +01:00
Bruno Windels 17c2fad4b4 finish log viewer details panel 2021-02-18 12:25:40 +01:00
Bruno Windels 6b527cef65 basic log viewer 2021-02-18 12:25:40 +01:00
Bruno Windels 4477073d6d add platform method to offer saving a buffer handle 2020-11-10 17:24:30 +01:00
Bruno Windels 22a88d06b4 fix build 2020-10-26 15:56:06 +01:00
Bruno Windels 03351d2e1f extract platform class to put all platform specific code in 2020-10-26 15:44:11 +01:00
Bruno Windels 101c7015f2 move service worker code in bundle, and support closing sessions 2020-10-16 12:49:42 +02:00
Bruno Windels 3aa1992a3f WIP of messaging to sw 2020-10-15 19:12:16 +02:00
Bruno Windels a94b099819 cache legacy js on request 2020-10-15 16:18:09 +02:00
Bruno Windels 0f71564d65 also make changes in index.html and sw.js trigger an update 2020-10-15 15:58:29 +02:00
Bruno Windels eaaf18fb82 set icon on iOS 2020-10-15 11:17:33 +02:00
Bruno Windels 47a43869e6 fix grid layout in IE 11
this brings back index addressing rather than x y in the grid vm,
as we need to have a css class for every position for IE 11,
as we can't use css variables and autoprefixer can
translate grid-areas
2020-10-08 14:17:43 +02:00
Bruno Windels 423a463cd6 disable css variables transformation as it breaks the grid layout f/ now 2020-10-07 18:00:26 +02:00
Bruno Windels e70f0d3e89 fix regeneratorRuntime being loaded too late 2020-10-06 12:56:20 +02:00
Bruno Windels c8fd9d423d log requests to dev server 2020-10-05 15:10:15 +02:00
Bruno Windels 8dc2816d6e keep hashed files in cache as long as they don't change 2020-10-02 19:54:24 +02:00
Bruno Windels dff8ddb532 remove logging 2020-10-02 09:34:12 +02:00
Bruno Windels 38a30bcc49 targetDir doesn't need to be global anymore 2020-10-02 09:33:57 +02:00
Bruno Windels 441bfa4890 also write unhashed assets from asset map 2020-10-02 09:33:48 +02:00
Bruno Windels 4a19c8d575 move asset writing into AssetMap as well 2020-10-02 09:33:07 +02:00
Bruno Windels 07b6458f19 track assets centrally in build script 2020-10-01 19:21:27 +02:00