Add supporting themes required for Lotusdocs
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
import Alpine from './../src/index'
|
||||
|
||||
window.Alpine = Alpine
|
||||
|
||||
queueMicrotask(() => {
|
||||
Alpine.start()
|
||||
})
|
||||
@@ -0,0 +1,5 @@
|
||||
import Alpine from './../src/index'
|
||||
|
||||
export default Alpine
|
||||
|
||||
export { Alpine }
|
||||
3401
themes/hugo-mod-jslibs-dist/alpinejs/packages/csp/dist/cdn.js
vendored
Normal file
3401
themes/hugo-mod-jslibs-dist/alpinejs/packages/csp/dist/cdn.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
11
themes/hugo-mod-jslibs-dist/alpinejs/packages/csp/dist/cdn.min.js
vendored
Normal file
11
themes/hugo-mod-jslibs-dist/alpinejs/packages/csp/dist/cdn.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4109
themes/hugo-mod-jslibs-dist/alpinejs/packages/csp/dist/module.cjs.js
vendored
Normal file
4109
themes/hugo-mod-jslibs-dist/alpinejs/packages/csp/dist/module.cjs.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3400
themes/hugo-mod-jslibs-dist/alpinejs/packages/csp/dist/module.esm.js
vendored
Normal file
3400
themes/hugo-mod-jslibs-dist/alpinejs/packages/csp/dist/module.esm.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "@alpinejs/csp",
|
||||
"version": "3.13.8",
|
||||
"description": "A CSP-friendly build of AlpineJS",
|
||||
"author": "Caleb Porzio",
|
||||
"license": "MIT",
|
||||
"main": "dist/module.cjs.js",
|
||||
"module": "dist/module.esm.js",
|
||||
"dependencies": {
|
||||
"@vue/reactivity": "~3.1.1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
import { generateEvaluatorFromFunction, runIfTypeOfFunction } from 'alpinejs/src/evaluator'
|
||||
import { closestDataStack, mergeProxies } from 'alpinejs/src/scope'
|
||||
import { tryCatch } from 'alpinejs/src/utils/error'
|
||||
import { injectMagics } from 'alpinejs/src/magics'
|
||||
|
||||
export function cspEvaluator(el, expression) {
|
||||
let dataStack = generateDataStack(el)
|
||||
|
||||
// Return if the provided expression is already a function...
|
||||
if (typeof expression === 'function') {
|
||||
return generateEvaluatorFromFunction(dataStack, expression)
|
||||
}
|
||||
|
||||
let evaluator = generateEvaluator(el, expression, dataStack)
|
||||
|
||||
return tryCatch.bind(null, el, expression, evaluator)
|
||||
}
|
||||
|
||||
function generateDataStack(el) {
|
||||
let overriddenMagics = {}
|
||||
|
||||
injectMagics(overriddenMagics, el)
|
||||
|
||||
return [overriddenMagics, ...closestDataStack(el)]
|
||||
}
|
||||
|
||||
function generateEvaluator(el, expression, dataStack) {
|
||||
return (receiver = () => {}, { scope = {}, params = [] } = {}) => {
|
||||
let completeScope = mergeProxies([scope, ...dataStack])
|
||||
|
||||
if (completeScope[expression] === undefined) {
|
||||
throwExpressionError(el, expression)
|
||||
}
|
||||
|
||||
runIfTypeOfFunction(receiver, completeScope[expression], completeScope, params)
|
||||
}
|
||||
}
|
||||
|
||||
function throwExpressionError(el, expression) {
|
||||
console.warn(
|
||||
`Alpine Error: Alpine is unable to interpret the following expression using the CSP-friendly build:
|
||||
|
||||
"${expression}"
|
||||
|
||||
Read more about the Alpine's CSP-friendly build restrictions here: https://alpinejs.dev/advanced/csp
|
||||
|
||||
`,
|
||||
el
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Alpine CSP Build.
|
||||
*
|
||||
* Alpine allows you to use JavaScript directly inside your HTML. This is an
|
||||
* incredibly powerful features. However, it violates the "unsafe-eval"
|
||||
* Content Security Policy. This alternate Alpine build provides a
|
||||
* more constrained API for Alpine that is also CSP-friendly...
|
||||
*/
|
||||
import Alpine from 'alpinejs/src/alpine'
|
||||
|
||||
/**
|
||||
* _______________________________________________________
|
||||
* The Evaluator
|
||||
* -------------------------------------------------------
|
||||
*
|
||||
* By default, Alpine's evaluator "eval"-like utilties to
|
||||
* interpret strings as runtime JS. We're going to use
|
||||
* a more CSP-friendly evaluator for this instead.
|
||||
*/
|
||||
import { cspEvaluator } from './evaluator'
|
||||
|
||||
Alpine.setEvaluator(cspEvaluator)
|
||||
|
||||
/**
|
||||
* The rest of this file bootstraps Alpine the way it is
|
||||
* normally bootstrapped in the default build. We will
|
||||
* set and define it's directives, magics, etc...
|
||||
*/
|
||||
import { reactive, effect, stop, toRaw } from '@vue/reactivity'
|
||||
|
||||
Alpine.setReactivityEngine({ reactive, effect, release: stop, raw: toRaw })
|
||||
|
||||
import 'alpinejs/src/magics/index'
|
||||
|
||||
import 'alpinejs/src/directives/index'
|
||||
|
||||
export default Alpine
|
||||
Reference in New Issue
Block a user