Skip to content
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

feat(custom-elemen): ce support child component style tags and attribute settings #7942

Closed
wants to merge 94 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
6d1d290
feat(custom-element): Custom elements support child component style tags
baiwusanyu-c Mar 22, 2023
b249bbb
feat(custom-element): added code comments
baiwusanyu-c Mar 22, 2023
ce361ee
feat(custom-element): update code
baiwusanyu-c Mar 22, 2023
c097498
feat(custom-element): updated unit test
baiwusanyu-c Mar 22, 2023
5b41420
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Mar 23, 2023
2a66522
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Mar 24, 2023
a303bce
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Mar 24, 2023
610f31b
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Mar 24, 2023
d8c83c4
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Mar 26, 2023
6ddb15a
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Mar 27, 2023
4979893
Merge remote-tracking branch 'origin/main' into bwsy/fix/vOnceAndvIf
baiwusanyu-c Apr 5, 2023
cf7de4b
Merge remote-tracking branch 'origin/main' into bwsy/feat/CEChildStyle
baiwusanyu-c Apr 5, 2023
30a7438
Merge remote-tracking branch 'origin/main' into bwsy/feat/CEChildStyle
baiwusanyu-c Apr 5, 2023
00a683e
Merge branch 'vuejs:main' into bwsy/feat/CEChildStyle
baiwusanyu-c Apr 5, 2023
9dbf8fc
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Apr 6, 2023
642c048
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Apr 6, 2023
51924bf
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Apr 10, 2023
7abb1b8
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Apr 10, 2023
5546d04
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Apr 11, 2023
b1e2f8b
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Apr 14, 2023
4f6ac8b
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Apr 17, 2023
f84b699
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Apr 19, 2023
f5c6692
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Apr 20, 2023
bf12ded
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Apr 24, 2023
3935fa1
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Apr 25, 2023
d0fe5e7
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c May 4, 2023
7917650
feat(runtime-dom): updated code
baiwusanyu-c May 5, 2023
b3704bf
fix(runtime-dom): temp commit
baiwusanyu-c May 5, 2023
ffa6167
feat(runtime-dom): properly handle v-if
baiwusanyu-c May 6, 2023
1864521
feat(runtime-dom): updated unit test
baiwusanyu-c May 6, 2023
eedf48f
feat(runtime-dom): remove hash sum
baiwusanyu-c May 6, 2023
996a762
feat(runtime-dom): rollback pnpm lock
baiwusanyu-c May 6, 2023
53ccce1
feat(custom-element): fix style order problem
baiwusanyu-c May 8, 2023
35c20af
feat(runtime-dom): use uid as cecStyleId
baiwusanyu-c May 11, 2023
8f91b4a
feat(runtime-dom): fix childStylesAnchor error
baiwusanyu-c May 11, 2023
794a446
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c May 12, 2023
1630c38
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c May 12, 2023
88f2f05
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c May 16, 2023
ee5030f
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c May 17, 2023
a879ab9
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c May 22, 2023
21f69af
feat(runtime-dom): Components are used multiple times without adding …
baiwusanyu-c May 31, 2023
0c5c475
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Jun 16, 2023
6f371a4
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Jul 6, 2023
379776a
chore: updated code
baiwusanyu-c Jul 23, 2023
cd68776
feat(custom-element): updated code to handle edge case
baiwusanyu-c Aug 9, 2023
d5a518a
feat(custom-element): Async component styles are lost for descendants
baiwusanyu-c Aug 10, 2023
75abdb8
feat(custom-element): Async component styles are lost for nested
baiwusanyu-c Aug 11, 2023
9e551c8
Merge branch 'main' into bwsy/feat/CEChildStyle
sxzz Aug 11, 2023
02b31c1
Merge branch 'vuejs:main' into bwsy/feat/CEChildStyle
baiwusanyu-c Aug 16, 2023
77acae7
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Aug 27, 2023
7ac6041
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Sep 12, 2023
651281a
Merge remote-tracking branch 'origin/main' into bwsy/feat/CEChildStyle
baiwusanyu-c Sep 27, 2023
bd2db96
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Oct 18, 2023
82ed3b5
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Oct 20, 2023
5743819
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Oct 21, 2023
be90bd0
chore: The order of style tags remains consistent with the playground
baiwusanyu-c Oct 23, 2023
abf0eec
chore: Remove code about style tag removal
baiwusanyu-c Oct 24, 2023
6928811
[autofix.ci] apply automated fixes
autofix-ci[bot] Oct 24, 2023
ea819a8
refactor: refactor code
baiwusanyu-c Oct 24, 2023
cbca305
Merge remote-tracking branch 'origin/bwsy/feat/CEChildStyle' into bws…
baiwusanyu-c Oct 24, 2023
ab2d81a
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Oct 24, 2023
bdb0f42
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Oct 26, 2023
5fad967
tempcommit
baiwusanyu-c Oct 26, 2023
c985113
chore: temp commit
baiwusanyu-c Oct 26, 2023
05c1891
chore: refactor code
baiwusanyu-c Oct 26, 2023
b134e13
chore: refactor code and format code
baiwusanyu-c Oct 26, 2023
2097807
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Oct 26, 2023
f3c09e7
fix: format code and fix typo
baiwusanyu-c Oct 27, 2023
f52b6ad
test: added ceStylesAttrs unit test
baiwusanyu-c Oct 27, 2023
d09dd00
chore: remove todo
baiwusanyu-c Oct 27, 2023
ce8e60d
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Oct 31, 2023
3b06ec6
feat(compiler): style attr compiler
baiwusanyu-c Nov 2, 2023
47d3900
feat(compiler): Optimization logic
baiwusanyu-c Nov 2, 2023
6ecb49c
chore(compiler): support normalScript
baiwusanyu-c Nov 2, 2023
c03e8b4
chore(custom-element): complate useCEStyleAttrs
baiwusanyu-c Nov 3, 2023
a449e22
chore(custom-element): useCEStyleAttrs unit test
baiwusanyu-c Nov 3, 2023
b697233
chore(custom-element): updated useCEStyleAttrs unit test
baiwusanyu-c Nov 6, 2023
6f7547f
chore(custom-element): compile useCEStyleAttrs unit test
baiwusanyu-c Nov 6, 2023
7532f97
chore(custom-element): updated useCEStyleAttrs unit test
baiwusanyu-c Nov 6, 2023
e39db13
Merge remote-tracking branch 'origin/main' into bwsy/feat/CEChildStyle
baiwusanyu-c Nov 6, 2023
00cc259
Merge remote-tracking branch 'origin/main' into bwsy/feat/CEChildStyle
baiwusanyu-c Nov 6, 2023
b82c7ee
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Nov 24, 2023
7a79b5e
chore: Only hmr will uninstall styles
baiwusanyu-c Nov 27, 2023
8c90a40
Merge remote-tracking branch 'origin/main' into bwsy/feat/CEChildStyle
baiwusanyu-c Dec 6, 2023
9877720
test: updated unit test snap
baiwusanyu-c Dec 6, 2023
1dfa2ab
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Dec 15, 2023
8b4a7f0
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Dec 15, 2023
1a97321
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Dec 19, 2023
40fbf73
Merge remote-tracking branch 'origin/main' into bwsy/feat/CEChildStyle
baiwusanyu-c Jan 3, 2024
b805943
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 3, 2024
9ff30fd
chore: updated unit test snap
baiwusanyu-c Jan 3, 2024
5cda20a
chore: updated unit test snap
baiwusanyu-c Jan 3, 2024
a6bb241
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Jun 5, 2024
1881ef1
Merge branch 'main' into bwsy/feat/CEChildStyle
baiwusanyu-c Aug 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`CE style attrs injection > codegen > <script> w/ default export 1`] = `
"const __default__ = { setup() {} }
import { useCEStyleAttrs as _useCEStyleAttrs } from 'vue'
const __injectCSSVars__ = () => {

_useCEStyleAttrs(_ctx => ([
{
"id": { id: _ctx.msg3, 'other-attr': _ctx.msg },
"src": _ctx.msg,
[_ctx.msg]: _ctx.msg,
"xlink:special": _ctx.msg,
},
]))}
const __setup__ = __default__.setup
__default__.setup = __setup__
? (props, ctx) => { __injectCSSVars__();return __setup__(props, ctx) }
: __injectCSSVars__

export default __default__"
`;

exports[`CE style attrs injection > codegen > <script> w/ default export in strings/comments 1`] = `
"
// export default {}
const __default__ = {}

import { useCEStyleAttrs as _useCEStyleAttrs } from 'vue'
const __injectCSSVars__ = () => {

_useCEStyleAttrs(_ctx => ([
{
"id": { id: _ctx.msg3, 'other-attr': _ctx.msg },
"src": _ctx.msg,
[_ctx.msg]: _ctx.msg,
"xlink:special": _ctx.msg,
},
]))}
const __setup__ = __default__.setup
__default__.setup = __setup__
? (props, ctx) => { __injectCSSVars__();return __setup__(props, ctx) }
: __injectCSSVars__

export default __default__"
`;

exports[`CE style attrs injection > codegen > <script> w/ no default export 1`] = `
"const msg = 1
const __default__ = {}
import { useCEStyleAttrs as _useCEStyleAttrs } from 'vue'
const __injectCSSVars__ = () => {

_useCEStyleAttrs(_ctx => ([
{
"id": { id: _ctx.msg3, 'other-attr': _ctx.msg },
"src": _ctx.msg,
[_ctx.msg]: _ctx.msg,
"xlink:special": _ctx.msg,
},
]))}
const __setup__ = __default__.setup
__default__.setup = __setup__
? (props, ctx) => { __injectCSSVars__();return __setup__(props, ctx) }
: __injectCSSVars__

export default __default__"
`;

exports[`CE style attrs injection > codegen > w/ <script setup> 1`] = `
"import { useCEStyleAttrs as _useCEStyleAttrs, unref as _unref } from 'vue'
const msg = 'red'
export default {
setup(__props, { expose: __expose }) {
__expose();

_useCEStyleAttrs(_ctx => ([
{
"id": { id: _ctx.msg3, 'other-attr': msg },
"src": msg,
[msg]: msg,
"xlink:special": msg,
},
]))

return { msg }
}

}"
`;

exports[`CE style attrs injection > codegen > w/ <script setup> using the same var multiple times 1`] = `
"import { useCEStyleAttrs as _useCEStyleAttrs, unref as _unref } from 'vue'
const msg = 'red'

export default {
setup(__props, { expose: __expose }) {
__expose();

_useCEStyleAttrs(_ctx => ([
{
"id": { id: _ctx.msg3, 'other-attr': msg },
},
]))


return { msg }
}

}"
`;

exports[`CE style attrs injection > generating correct code for nested paths 1`] = `
"const a = 1
const __default__ = {}
import { useCEStyleAttrs as _useCEStyleAttrs } from 'vue'
const __injectCSSVars__ = () => {

_useCEStyleAttrs(_ctx => ([
{
"id": { id: _ctx.msg3, 'other-attr': _ctx.msg },
"src": _ctx.msg,
[_ctx.msg]: _ctx.msg,
"xlink:special": _ctx.msg,
},
]))}
const __setup__ = __default__.setup
__default__.setup = __setup__
? (props, ctx) => { __injectCSSVars__();return __setup__(props, ctx) }
: __injectCSSVars__

export default __default__"
`;

exports[`CE style attrs injection > w/ <script setup> binding analysis 1`] = `
"import { useCEStyleAttrs as _useCEStyleAttrs, unref as _unref } from 'vue'
import { ref } from 'vue'
const msg = 'red'

export default {
props: {
msg3: String
},
setup(__props, { expose: __expose }) {
__expose();

_useCEStyleAttrs(_ctx => ([
{
"id": { id: __props.msg3, 'other-attr': msg },
"src": msg2.value,
[msg]: msg,
"xlink:special": __props.msg3,
},
]))

const msg2 = ref('10px')


return { msg, msg2, ref }
}

}"
`;

exports[`CE style attrs injection > w/ normal <script> binding analysis 1`] = `
"
const __default__ = {
setup() {
return {
msg: ref('100px')
}
}
}

import { useCEStyleAttrs as _useCEStyleAttrs } from 'vue'
const __injectCSSVars__ = () => {

_useCEStyleAttrs(_ctx => ([
{
"id": { id: _ctx.msg3, 'other-attr': _ctx.msg },
"src": _ctx.msg,
[_ctx.msg]: _ctx.msg,
"xlink:special": _ctx.msg,
},
]))}
const __setup__ = __default__.setup
__default__.setup = __setup__
? (props, ctx) => { __injectCSSVars__();return __setup__(props, ctx) }
: __injectCSSVars__

export default __default__"
`;
Loading