This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 219
Update directives prefix to data-woo-
#8316
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5067e7a
Update Interactivity API
DAreRodz 92d0d9d
Change `wp` prefixes to `woo`
DAreRodz 0199ade
Use `woo` prefix for the directives runtime bundle
DAreRodz ceedc72
Merge branch 'trunk' into update/interactivity-api-prefixes
DAreRodz 259d885
Merge branch 'trunk' into update/interactivity-api-prefixes
DAreRodz 35d8f75
Merge branch 'trunk' into update/interactivity-api-prefixes
DAreRodz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,26 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { useMemo, useContext } from 'preact/hooks'; | ||
import { deepSignal } from 'deepsignal'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { component } from './hooks'; | ||
|
||
export default () => { | ||
const WpContext = ( { children, data, context: { Provider } } ) => { | ||
// <wp-context> | ||
const Context = ( { children, data, context: { Provider } } ) => { | ||
const signals = useMemo( | ||
() => deepSignal( JSON.parse( data ) ), | ||
[ data ] | ||
); | ||
return <Provider value={ signals }>{ children }</Provider>; | ||
}; | ||
component( 'wp-context', WpContext ); | ||
component( 'context', Context ); | ||
|
||
const WpShow = ( { children, when, evaluate, context } ) => { | ||
// <wp-show> | ||
const Show = ( { children, when, evaluate, context } ) => { | ||
const contextValue = useContext( context ); | ||
if ( evaluate( when, { context: contextValue } ) ) { | ||
return children; | ||
} else { | ||
return <template>{ children }</template>; | ||
} | ||
return <template>{ children }</template>; | ||
}; | ||
component( 'wp-show', WpShow ); | ||
component( 'show', Show ); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const cstMetaTagItemprop = 'woo-client-side-transitions'; | ||
export const componentPrefix = 'woo-'; | ||
export const directivePrefix = 'data-woo-'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { deepSignal } from 'deepsignal'; | ||
|
||
const isObject = ( item ) => | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if we will remove it later once we switch to Product block-only navigation, but to match the upstream this should now be called
woo-client-side-navigation
.The export was also renamed to
csnMetaTagItemprop
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I think I've already included those changes in #8447, so I'm going to merge this PR and continue the development there.