-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
another attempts at module packaging
- Loading branch information
Showing
11 changed files
with
4,059 additions
and
1,394 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,12 +1,24 @@ | ||
htmx.defineExtension('morph', { | ||
isInlineSwap: function(swapStyle) { | ||
return swapStyle === 'morph'; | ||
}, | ||
handleSwap: function (swapStyle, target, fragment) { | ||
(function(){ | ||
function createMorphConfig(swapStyle) { | ||
if (swapStyle === 'morph' || swapStyle === 'morph:outerHTML') { | ||
return Idiomorph.morph(target, fragment.children); | ||
return {morphStyle: 'outerHTML'} | ||
} else if (swapStyle === 'morph:innerHTML') { | ||
return Idiomorph.morph(target, fragment.children, {morphStyle:'innerHTML'}); | ||
return {morphStyle: 'innerHTML'} | ||
} else if (swapStyle.startsWith("morph:")) { | ||
return Function("return (" + swapStyle.slice(6) + ")")(); | ||
} | ||
} | ||
}); | ||
|
||
htmx.defineExtension('morph', { | ||
isInlineSwap: function(swapStyle) { | ||
let config = createMorphConfig(swapStyle); | ||
return config.swapStyle === "outerHTML" || config.swapStyle == null; | ||
}, | ||
handleSwap: function (swapStyle, target, fragment) { | ||
let config = createMorphConfig(swapStyle); | ||
if (config) { | ||
return Idiomorph.morph(target, fragment.children, config); | ||
} | ||
} | ||
}); | ||
})() |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
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