how to using Google Lit v2 elements in Google Polymer 3 app? - polymer-3.x

I have converted a Polymer 2 app to Polymer 3 instead of LIT v2, because of the size of the project. I am using Lit v1 elements inside Polymer 3 without any problem. Even Lit v2 elements are working fine when I define Reactive properties as
// similar to Lit v1
static get properties() {
return {
propertyName: options
};
}
when I change those to Lit v2
static properties = {
propertyName: {type: String}
};
'polymer serve -o' throws the following error: Uncaught TypeError: Failed to resolve module specifier "lit". Relative references must start with either "/", "./", or "../".
I have tried to change the Polymer 3 app shell component into Lit v2, and used 'polymer serve' above-mentioned reference error occurs. When I tried to use 'wds --watch' it throws the following error: Uncaught TypeError: Failed to resolve module specifier "#polymer/app-layout/app-drawer/app-drawer.js". Relative references must start with either "/", "./", or "../". I have added all the dependencies properly.
I am writing new components in Lit v1 only instead of Lit v2 because of this issue.
Can anyone please tell me where I'm going wrong in my thinking?

Related

SSR compile fails with TailwindCSS "Cannot read properties of undefined (reading '5')

I am making a Github pages site with SvelteKit and Tailwind CSS as a learning project.
I am using Adaptor static to render the site for hosting on github pages so everything ends up getting Server side pre rendered.
Error:
[postcss] Cannot read properties of undefined (reading '5')
21:35:57 [vite-plugin-svelte] ssr compile in progress ...
TypeError: Cannot read properties of undefined (reading '5')
at Parser.parentheses (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\parser.js:859:65)
at Parser.parse (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\parser.js:1062:14)
at Parser.loop (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\parser.js:1043:12)
at new Parser (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\parser.js:164:10)
at Processor._root (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\processor.js:53:18)
at Processor._runSync (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\processor.js:100:21)
at Processor.astSync (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\processor.js:145:17)
at finalizeSelector (D:\Repositories\myrepo\node_modules\tailwindcss\lib\util\formatVariantSelector.js:125:59)
at D:\Repositories\myrepo\node_modules\tailwindcss\lib\lib\generateRules.js:732:81
at D:\Repositories\myrepo\node_modules\postcss\lib\container.js:96:18
TypeError: Cannot read properties of undefined (reading '5')
at Parser.parentheses (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\parser.js:859:65)
at Parser.parse (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\parser.js:1062:14)
at Parser.loop (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\parser.js:1043:12)
at new Parser (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\parser.js:164:10)
at Processor._root (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\processor.js:53:18)
at Processor._runSync (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\processor.js:100:21)
at Processor.astSync (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\processor.js:145:17)
at finalizeSelector (D:\Repositories\myrepo\node_modules\tailwindcss\lib\util\formatVariantSelector.js:125:59)
at D:\Repositories\myrepo\node_modules\tailwindcss\lib\lib\generateRules.js:732:81
at D:\Repositories\myrepo\node_modules\postcss\lib\container.js:96:18
Error: Not found: /favicon.ico
at resolve (/node_modules/#sveltejs/kit/src/runtime/server/respond.js:395:13)
at resolve (/node_modules/#sveltejs/kit/src/runtime/server/respond.js:236:5)
at Object.#options.hooks.handle (/#fs/D:/Repositories/myrepo/node_modules/#sveltejs/kit/src/runtime/server/index.js:41:55)
at Module.respond (/node_modules/#sveltejs/kit/src/runtime/server/respond.js:233:40)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
TypeError: Cannot read properties of undefined (reading '5')
at Parser.parentheses (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\parser.js:859:65)
at Parser.parse (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\parser.js:1062:14)
at Parser.loop (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\parser.js:1043:12)
at new Parser (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\parser.js:164:10)
at Processor._root (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\processor.js:53:18)
at Processor._runSync (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\processor.js:100:21)
at Processor.astSync (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\processor.js:145:17)
at finalizeSelector (D:\Repositories\myrepo\node_modules\tailwindcss\lib\util\formatVariantSelector.js:125:59)
at D:\Repositories\myrepo\node_modules\tailwindcss\lib\lib\generateRules.js:732:81
at D:\Repositories\myrepo\node_modules\postcss\lib\container.js:96:18
I have a Svelte component that has a named tailwind group so that i can do some conditional highlighting.
The basics of the component are like this:
<script>
export let id;
export let title;
const setting= `group/${id}`
</script>
<div class="{setting}">
<div
class="{`group-hover/${id}:bg-blue-500`}"
>
{title}
</div>
<slot/>
</div>
This works in this REPL that uses tailwind strangely! is this issue just to do with SSR?
https://svelteboard.com/repl
When i made this component I had inline declarations of the class with a prenamed group/name like this:
<div class="group/name">
<div
class="group-hover/name:bg-blue"
>
{title}
</div>
<slot/>
</div>
that worked fine (but highlighted all instances of the component on hover.)
but when i changed to the newer implementation it breaks with the above error & even when i roll back to a previous check in the error persists.
Am i implementing something wrong,
my tailwind config is unmodified from the svelte + tailwind setup, and svelte config has vitePreprocess and adapterstatic only.
I Tried updating dependencies to latest versions
downgrading postcss to 8.2 (suggested by another question)
reverting to previous revision, (does fix eventually but still cant implement this feature)
According to docs you cannot define dynamic CSS like group-hover/${id}:bg-blue-500 (Read here). All classes should be defined during build time.
You don't need to use nested groups if there is only one group in the component. Take a look at this REPL.
(If this is not the effect you're looking for please add a REPL with a minimum reproducible example)
#notnavindu's answer is correct
I think you can also refer to this

hashicorp waypoint cannot add variables in project name

Someone can tell me if I can add var on project name please ?
project = "${var.env}"
error output when using waypoint init
[xxxx#xxxx finess-api]$ waypoint init
❌ Error loading configuration!
! /home/xxxx/waypoint.hcl:2,25-28: Unknown
variable; There is no variable named "var"., and 1 other diagnostic(s)
! Project had errors during initialization.
Waypoint experienced some errors during project initialization. The output
above should contain the failure messages. Please correct these errors and
run 'waypoint init' again.
variable env {
type = string
default = ""
}
Thx
It's not possible to template the project name; however instead of templating the project name, I recommend using workspace-scoped operations, with one workspace for each "env" you're using.
https://developer.hashicorp.com/waypoint/docs/lifecycle/scope

GlideApp symbol not found in Android Studio 4.1

I have been using Glide 4.11.0 and Realm 6.0.2 for some time now, and recently upgraded Android Studio 4.0.x to 4.1. All has been going fine. Today I ran the lint checker, and started doing some "clean up", nothing out of the ordinary (it would seem). One of the things I did a lot of was to replace switch statements that were testing against R.id. with if-else statements per the lint warning about what's gonna happen in Gradle 5.0.
When I did this, I did use a number of int variables I named 'id' that were to replace the value to compare - i.e. instead of a switch statement that would be:
switch (menuOpt.getId()) {
case R.id.xxx:
...
}
I would do:
int id = menuOpt.getId();
if ( id == R.id.XXX) {
} else if....
per the new guidelines.
Suddenly, on a full build AS complains that it no longer recognizes GlideApp, and I am also getting a very weird message about Realm not being able to process correctly:
C:\BLD\AndroidStudioProjects\InTouch\app\src\main\java\com\reddragon\intouch\ui\MediaPlayerActivity.java:61: error: cannot find symbol
import com.reddragon.intouch.utils.GlideApp;
^
symbol: class GlideApp
location: package com.reddragon.intouch.utils
C:\BLD\AndroidStudioProjects\InTouch\app\src\main\java\com\reddragon\intouch\ui\MediaDialogActivity.java:92: error: cannot find symbol
import com.reddragon.intouch.utils.GlideApp;
^
symbol: class GlideApp
location: package com.reddragon.intouch.utils
C:\BLD\AndroidStudioProjects\InTouch\app\src\main\java\com\reddragon\intouch\ui\MediaListActivity.java:48: error: cannot find symbol
import com.reddragon.intouch.utils.GlideApp;
^
symbol: class GlideApp
location: package com.reddragon.intouch.utils
Note: Version 10.0.0 of Realm is now available: https://static.realm.io/downloads/java/latest
Note: Processing class Album
error: Class "Album" contains illegal final field "id".
Note: [1] Wrote GeneratedAppGlideModule with: []
Class "Album" contains illegal final field "id".
4 errors
I have had the field 'id' in my Album class for about 2 years with no issues!
No manner of rebuild, invalidating cache and restarting, syncing gradle files or "reload all from disk" seems to help.
Actually, if I invalidate and restart, I don't get the red squiggle in the offending classes that are referencing GlideApp, but as soon as I start to run the app and it goes through a build process it errors out.
I Googled a bit and found one post where there seemed to be some conflict between Realm and Glide (RequestOptions), but the strange thing to me is why would this suddenly start occurring?
I have validated that the GlideAppjava class is in fact getting built - I am using the debug build variant, and I can see in the file system GlideApp.java that is in the ap_generated_sources/debug directory in the proper package where I have my class that extends AppGlideModule with the #GlideModule annotation.
So GlideApp is getting generated. It just isn't getting recognized.
One of the other new things is that I've recently created a Dynamic Feature module. This module does depend on a class that is in the base module (where GlideApp is referenced). Not sure if this is relevant (I had many, many successful builds before I started doing lint clean-up).
So frustrating! Any help appreciated.
It turns out that the answer was staring right at me, although somewhat hidden: part of the lint check that I did was accept some suggestions about making variables 'final' - including those that are used in Realm classes to define Realm objects. Realm doesn't like that - above build error output includes as a last line the statement 'Class "Album" contains illegal final field "id".'
"Album" extends RealmObject, and the "auto accept" of the lint's suggestion to make some of the fields final was the culprit.
I think this issue with Realm caused a ripple effect somehow with the other annotation processing - when I went back to all the RealmObject classes and removed the "final" declaration, build now completes smoothly.

Could not set unknown property 'configFile' for object of type net.corda.plugins.Node

Follow the sample build.gradle codes in this documentation page, I added one "configFile" into node's definition here, but after refreshed the gradle project, when build the app there is an error:
Could not set unknown property 'configFile' for object of type net.corda.plugins.Node.
Did I miss adding anything in the build.gradle?
Set the configFile without '=' sign.
For Eg:
configFile "/Users/mac_user/Documents/resources/nodea.conf" in node of the build.gradle file.

Breeze and the EdmBuilder for OData v4

I was able to create an OData (v3) service with WebApiOdata and EntityFramework at server side and Breeze at client side thanks to this document.
Now I'd like to do the same with the version 4 of OData spec. but there is a problem. The EdmBuilder class provided by Breeze depends on the 'Microsoft.Data.Edm' which is related to the version 3.
In the EdmBuilder these 2 lines prevent the project from building:
using Microsoft.Data.Edm.Csdl;
using Microsoft.Data.Edm.Validation;
which is normal, because my project has a reference to 'Microsoft.OData.Edm'(for v4) instead of 'Microsoft.Data.Edm'(for v3).
So I replaced the 2 using statements, by this:
using Microsoft.OData.Edm;
using Microsoft.OData.Edm.Csdl;
using Microsoft.OData.Edm.Validation;
Now the project can build, but at runtime it throws this exception
"Encountered the following errors when parsing the EDMX document:
UnexpectedXmlElement : The element 'Edmx' was unexpected for the root
element. The root element should be Edmx. : (1, 40)"
from the EdmBuilder class at this point:
using (var reader = XmlReader.Create(stream))
{
return EdmxReader.Parse(reader);
}
Is there any way to solve this problem ??? like a new EdmBuilder class that I can download somewhere?
P.S.: I'm using code first migration and this code to configure OData route in the 'WebApiConfig' :
config.MapODataServiceRoute(
routeName: "ODataRoute",
routePrefix: "OData",
model: EdmBuilder.GetEdm<MyDbContext>(),
batchHandler: new DefaultODataBatchHandler(GlobalConfiguration.DefaultServer));
We are currently working on a breeze release that works with OData v 4.0. I will post back here when it is released, which should be in the fairly near future.

Resources