-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Future of this addon #1
Comments
@jembezmamy if you were able to get a sample app setup with embroider and some styles, I'll get it working for you by next week. |
Wow, thanks, that would be great! I'll prepare the sample app and let you know. |
thank you both, have enjoyed using ember-component-css and would like to migrate to this once it's ready so I can update my app, let me know if you need help testing or anything |
oh gosh. I just opened this up and my latest changes were not pushed. |
I pushed those, but it seems that the tests are not running. They were running before. I'll look into this and see what's happening.. It seems something screwy is going on.. (this is what happens when you come back after a year of not looking at it 😂 ) |
Ok. I pushed everything and the tests for "ember-cli-styles-namespace" are passing. So should be able to look there how to use this. I haven't published beta versions of these packages yet as an FYI |
@webark Ha ha, great, thanks. 😄 I'm going to work on the embroider demo next week, currently I'm on a short vacation. |
haha!! I'm on vacation too.. First "two night" vacation i've had with my wife since our daughter was born 6 YEARS ago!! I'm sorry that i've dragged this out.. I'm really interested in this working with embroider, and have some time in the next couple of months to spend on it. If someone can get an embroider app setup with this, i'll be able to make sure it's working. |
I might take a stab at upgrading soon.. I'm on 3.20 still. Big thanks to you both for working on this. Random question: how hard would it be to add option to minimize all classes e.g. "__3824j__my-class--foo-123" -> "xy123" |
there's that option in the current iteration, I forget if I carried that over to this "namespace" method. |
@webark - in addition to adding Embroider support (which would be nice, of course) I believe a couple of more things are more important - namely Ember 4.0 support, tagless/template-only/Glimmer components support and co-location. Embroider, even if released soon, won't replace Tagless components support would also be nice but there is a workaround for that right now - using Co-location also would be very nice but that could also wait. If you need example apps for any/all of these issues, just tell me and I'll prepare them immediately. :) Thank you for taking the time to work on this! We love |
This rewrite handles these cases the best way I have found to satisfy tagless components. Currently it wraps each temple with a Co-location (as I understand it) is also supported. Single file components are not supported, but those are experimental, and support could be added later. I have not attempted to use it in an embroider setup, but the new mechanism should carry over. The main thing I need to work on to get this released, is the legacy support (which i'd be open to releasing these addons without that) and some real wold flexing and vetting of this solution. (which I have not done as I am no longer working on ember apps, or much in front end apps in general and am, sadly 😩 in react world when I do now). If a subset of you all are open to helping me vet this new approach, I will commit to offering assistance and continued development as I can in my spare time. And if people start to contribute, give privileges of shared ownership of). Does that answer your questions? If people are open to a zoom sometime, I'd be open to that as well. |
Thanks for the comment! I believe that wrapping each template in a As for legacy support - I think that could be skipped entirely given that you don't have all the time in the world. You can always release a new major version and tell people they should change this and that in order to continue to use the addon. It's totally fine to break backwards-compatibility (even greatly) in order to be able to support a package. The other way means we don't get anywhere because you're trying to implement/support features that you don't have the time for. So if you think the current state of affairs works - you can try releasing a beta, explain what is changed for users of the plugin, and wait for bug reports. :) It's easier for people to change a few things here and there on how they use the addon than a maintainer to support a million old things. I didn't understand about Ember 4 support - are the deprecated things fixed and is Ember 4 supported? |
Yes to ember 4 support. It should be fully supported with this addon as long as the breaking changes are addressed. |
And ok. That's a good point about legacy support. I will tie up some loose ends and get a beta release out of these. |
@webark I've pulled the newest version of this repo and I still have hard time installing this locally (yarn install fails because of missing ember-cli-styles-colocation package, I suppose it's a git submodule but I can't pull this cause it's missing url or something). So maybe I'll wait for the beta release with further experiments. :D |
I recently fixed that. You should be able to just yarn link it. |
wait what? You are right.. I thought I just pushed that. |
OOOKKK... Now there we go. Sorry about that @jembezmamy |
What would be the best way to help/test this add-on? I don't have any practical experience with developing Ember addons, but sure could give it a try if that helps. What is the best way to test-drive this? Pull the Lerna repository and individually link all different packages into a project? |
@boris-petrov "Tagless components support would also be nice but there is a workaround for that right now - using stylesNamespace. So that could wait." Could you elaborate? The only reason I haven't moved to glimmer components is lack of support for tagless components. |
@burritoIand - well, you're missing on the best parts of Ember! 😄
import Helper from '@ember/component/helper';
import podNames from 'ember-component-css/pod-names';
export default class StyleNamespace extends Helper {
public compute([componentName]: [string]): string {
return podNames[componentName];
}
} Use in any template-only/Glimmer component:
<div class={{style-namespace "foo-bar"}}>
</div> Note that the argument to |
@boris-petrov very nice! thank you, I'm going to try this out :D |
@boris-petrov only wish Glimmer components had the component name available by default so you could just do something like thanks again! |
Ok. I just rewrote the git history of this cause it was in a messed upstate. And cleaned up some loose edges. I have a couple of style things to get the lint passed for the tests, then I will release a v1 beta. I'll also add some basic usage so people can see how things have changed. The next parts after that would be adding a migration plan (which will be minimal) and then finishing the addon for the legacy support (won't be terrible). I know this is all way too late.. But better late than never. Sorry for the burden having an outdated package has been :/ |
Absolutely no problem! Thank you for still taking the time to work on this! Also, Ember 4 is still not out so it’s definitely not too late. :) I’ll await the beta release and will try it out as I want to get rid of the deprecation warnings (and soon update to Ember 4).
|
So it looks like embroider doesn't support normal pods, and only supports colocation. So I'm going to update the tests to that, then I should be able to release the beta. |
OK. Just pushed a change to switch from modifiers to helpers based on feedback from @SergeAstapov in which fastboot doesn't work with modifiers. (was brought up in webark/ember-component-css#335) The last things to do are...
|
I also have never released something with lerna.. so if someone knows the command to trigger an alpha release, I will run that. |
@boris-petrov for # 2 yes, this is a "compile" as in it is run during the preprocess step, rather than a "filter" which is just run during the postprocess step. for # 1 .... 😔 The thing is.. manners by which this can be done "automatically" from my knowledge have all closed. I can look back and see if for an 🤔 |
maybe you can inject a computed property into components that would be able to do it.. 🤔 |
@webark - so for issue number 2 - is there a way to also add a For number 1 - the thing you do in that code is to set the correct style file to the component? If there is no "automatic" way - why don't you revert to "manual"? That works totally fine right now (even though it's verbose to pass a string with the same component path as an argument). Also, you could make it accept both a string and a "real" style like in the example you gave. In any case that's much better as the way it is right now is unusable. 😢 |
@boris-petrov yea. I think i will add another addon, something like "ember-component-auto-namespace" that will handle this legacy behavior, and then the standard behavior will be the manual process of the helper, or importing the namespace and adding it the the component class. |
You mean the |
no, that would handle the old way of adding the |
Oh, I understand, you mean that the current way of automatically finding all components will be gone and only a manual way will be available (plus this new addon that could automate things for classic components)? |
and even though "Ember Components" are not going away in 4.0... it looks like both injections are off the table https://deprecations.emberjs.com/v3.x/#toc_implicit-injections and reopening https://deprecations.emberjs.com/v3.x/#toc_ember-built-in-components-reopen are off the table (like I had thought). So there is no way to handle this, as the way of looking up all classic components is not viable.. :( At least there is no way that I can see to accomplish this. |
Correct. And anyone migrating an application will need to go through and add the import and assignment to each and every component class in their application and addons. :( |
Well.. I'll remove that bit of functionality sometime in the next couple of days, and release a new package. |
Well, for me at least that's totally fine because anyway I'm doing the same right now for Glimmer components (which are the majority of components I have) with Thanks! After the release I'll try it out and let you know how it goes. :) |
back before i had landed on the lookup behavior, i was planning on just issuing a code mod. I had written up the babel ast. Maybe If i have the time I could dust that off and put it in a proper ember code mod... Big emphasis on "IF" i have the time. |
That would be nice but it's not a blocker for users - just more painful. :) I would prefer for all the blockers to be fixed first and then the nice-to-have things to (eventually) follow so that we can upgrade. |
@webark - any luck removing the auto-discovery functionality and enabling the "manual" version? :) |
@webark - I just remembered that because there won't be an auto-discovery mechanism for old classic components as in import { classNames } from '@ember-decorators/component';
import Component from '@ember/component';
import podNames from 'ember-component-css/pod-names';
@classNames(podNames['some-component'])
class SomeComponent extends Component { |
@boris-petrov I pushed the removal of the auto-discovery and also added an example in my example repo for your above example import { classNames } from '@ember-decorators/component';
import Component from '@ember/component';
import { styleNamespace } from './test-two.scss';
@classNames(styleNamespace)
export default class SomeComponent extends Component {
} |
@webark - thank you again! I tried out the newest versions and all seems to work great! I think we're almost to the point where I could use this instead of
import Component from '@glimmer/component';
import { styleNamespace } from './test-two.scss';
class Foo extends Component {
foo = styleNamespace;
} <div class={{style-namespace runClass=this.foo}}></div> And this works fine. However, I would like to be able to directly do: <div class={{style-namespace runClass="test-two"}}></div> Or something similar. Because, as I said, the parameter to I tried argsClass and buildClass too, not sure what they are for, but it doesn't seem to work. Am I missing something or is this not possible right now?
|
@boris-petrov you would just have to import the namespace from wherever you want to use it. The CSS get scoped (as it does with ecc) during build time. So passing in a random string won't effect the CSS that has already been generated. Do you have an example of how you are currently doing this with ecc and I can try to replicate that example? |
@webark - sure, here you go. Only look at the third commit. This is the relevant code: <Input @value={{this.foobar}} />
<div class={{style-namespace this.foobar}}>
<a>Text</a>
</div> If you write |
@boris-petrov https://github.com/boris-petrov/ember-component-css-example/pull/1 Basically, you just have to import the styleNamespace from the style file you want to use the namespace of and apply it where you want to apply it. |
@webark - sorry, I shouldn't have used You've misunderstood my intention. The idea is that I want to apply Run the app, type |
hmm.. I'll look at it another time. You'll either need to grab the list by generating it yourself through an import manifest of options, or you can look at the "hack" I did for route styles ember-cli-styles/packages/namespace/addon/utils/process-style-type.js Lines 16 to 25 in 4ead8b0
|
there can be no concept of the You can generate one yourself through a self-managed import manifest, or you have to use the |
@webark - any luck figuring out how to do what I requested above? To help a bit - do you have any ideas how ember-css-modules works? It does something similar to |
@boris-petrov from my understanding at least, packages need to be static, and can not/should not be dynamically modified by other packages. I am not familiar with how ECM works. Do you have a coded link that you could provide? From my understanding, all your concerns have been addressed, and you will need to maintain your own import manifest of possible components from which you want to dynamically generate and pull class names from. basically, import all |
I'm going to close this issue as its primary purpose has been resolved. If you want to open a new issue specifically around a generated manifest that the addon provides, we can pursue that in a new issue. If you have any documentation or code references for that in ECM, that would be appreciated. Thanks for working through all the issues we did on this one! @boris-petrov your beta testing has been extremely appreciated. |
Hey @webark, I've landed here from webark/ember-component-css#355 so you probably know what I'm going to say. :)
I'm trying to migrate my app to Embroider and ember-component-css is currently the biggest obstacle. So it would be great if we could make this addon work and publish at least a basic version of it.
So my question is: how can I help? :) What needs to be done here to make this addon work with Glimmer and Embroider?
Also, I tried to install the most recent version and there are some issues with
ember-cli-styles-colocation@*
dependency, could you please fix that? I'm not sure what was the intention here. :) I tried symlinking https://github.com/webark/ember-cli-styles-collocation but without any luck.The text was updated successfully, but these errors were encountered: