fix: prevent asset conflicts between React and Grid.js versions

Add coexistence checks to all enqueue methods to prevent loading
both React and Grid.js assets simultaneously.

Changes:
- ReactAdmin.php: Only enqueue React assets when ?react=1
- Init.php: Skip Grid.js when React active on admin pages
- Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0
- Customer.php, Product.php, License.php: Add coexistence checks

Now the toggle between Classic and React versions works correctly.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
dwindown
2026-04-18 17:02:14 +07:00
parent bd9cdac02e
commit e8fbfb14c1
74973 changed files with 6658406 additions and 71 deletions

9
node_modules/http-link-header/AUTHORS generated vendored Normal file
View File

@@ -0,0 +1,9 @@
Jonas Hermsmeier <jhermsmeier@gmail.com>
Dale Hui <dhui@users.noreply.github.com>
Jayden Seric <me@jaydenseric.com>
Adam Raine <ad.st.raine@gmail.com>
Angelo Veltens <angelo.veltens@codecentric.de>
Mark S. Everitt <mark.s.everitt@gmail.com>
Matteo Brancaleoni <mbrancaleoni@gmail.com>
Sarven Capadisli <info@csarven.ca>
Yamagishi Kazutoshi <ykzts@desire.sh>

20
node_modules/http-link-header/LICENSE.md generated vendored Normal file
View File

@@ -0,0 +1,20 @@
# The MIT License (MIT)
Copyright (c) 2016-2023 Jonas Hermsmeier, and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.

174
node_modules/http-link-header/README.md generated vendored Normal file
View File

@@ -0,0 +1,174 @@
# HTTP Link Header
[![npm](https://img.shields.io/npm/v/http-link-header.svg?style=flat-square)](https://npmjs.com/http-link-header)
[![npm license](https://img.shields.io/npm/l/http-link-header.svg?style=flat-square)](https://npmjs.com/http-link-header)
[![npm downloads](https://img.shields.io/npm/dm/http-link-header.svg?style=flat-square)](https://npmjs.com/http-link-header)
Parse & format HTTP link headers according to [RFC 8288]
[RFC 8288]: https://tools.ietf.org/html/rfc8288
## Install via [npm](https://npmjs.com)
```sh
$ npm install --save http-link-header
```
## Deviations from the RFC
### Link Target
While [RFC 8288, Section 3.1](https://tools.ietf.org/html/rfc8288#section-3.1) states that relative URI-References
MUST be resolved by the parsers this library DOES NOT.
This is due to the parser not having an input for the absolute or canonical URI of the related document.
Currently there are no plans to add this, and it is left to the user whether or not to resolve relative URIs.
## Usage
```js
var LinkHeader = require( 'http-link-header' )
```
### Parsing a HTTP link header
```js
var link = LinkHeader.parse(
'<example.com>; rel="example"; title="Example Website", ' +
'<example-01.com>; rel="alternate"; title="Alternate Example Domain"'
)
> Link {
refs: [
{ uri: 'example.com', rel: 'example', title: 'Example Website' },
{ uri: 'example-01.com', rel: 'alternate', title: 'Alternate Example Domain' },
]
}
```
### Checking whether it has a reference with a given attribute & value
```js
link.has( 'rel', 'alternate' )
> true
```
### Retrieving a reference with a given attribute & value
```js
link.get( 'rel', 'alternate' )
> [
{ uri: 'example-01.com', rel: 'alternate', title: 'Alternate Example Domain' }
]
```
```js
// Shorthand for `rel` attributes
link.rel( 'alternate' )
> [
{ uri: 'example-01.com', rel: 'alternate', title: 'Alternate Example Domain' }
]
```
### Setting references
```js
link.set({ uri: 'https://example.com/next', rel: 'next' })
> Link {
refs: [
{ uri: 'example.com', rel: 'example', title: 'Example Website' },
{ uri: 'example-01.com', rel: 'alternate', title: 'Alternate Example Domain' },
{ rel: 'next', uri: 'https://example.com/next' }
]
}
```
### Setting a unique reference
```js
link.setUnique({
uri: 'https://example.com/image.png',
rel: 'preload',
as: 'image',
type: 'image/png'
})
> Link {
refs: [
{ uri: 'https://example.com/image.png', rel: 'preload', as: 'image', type: 'image/png' }
]
}
link.setUnique({
uri: 'https://example.com/image.png',
rel: 'preload',
as: 'image',
type: 'image/png'
})
> Link {
refs: [
{ uri: 'https://example.com/image.png', rel: 'preload', as: 'image', type: 'image/png' }
]
}
```
### Parsing multiple headers
```js
var link = new LinkHeader()
link.parse( '<example.com>; rel="example"; title="Example Website"' )
> Link {
refs: [
{ uri: 'example.com', rel: 'example', title: 'Example Website' },
]
}
link.parse( '<example-01.com>; rel="alternate"; title="Alternate Example Domain"' )
> Link {
refs: [
{ uri: 'example.com', rel: 'example', title: 'Example Website' },
{ uri: 'example-01.com', rel: 'alternate', title: 'Alternate Example Domain' },
]
}
link.parse( '<example-02.com>; rel="alternate"; title="Second Alternate Example Domain"' )
> Link {
refs: [
{ uri: 'example.com', rel: 'example', title: 'Example Website' },
{ uri: 'example-01.com', rel: 'alternate', title: 'Alternate Example Domain' },
{ uri: 'example-02.com', rel: 'alternate', title: 'Second Alternate Example Domain' },
]
}
```
### Handling extended attributes
```js
link.parse( '</extended-attr-example>; rel=start; title*=UTF-8\'en\'%E2%91%A0%E2%93%AB%E2%85%93%E3%8F%A8%E2%99%B3%F0%9D%84%9E%CE%BB' )
```
```js
> Link {
refs: [
{ uri: '/extended-attr-example', rel: 'start', 'title*': { language: 'en', encoding: null, value: '①⓫⅓㏨♳𝄞λ' } }
]
}
```
### Stringifying to HTTP header format
```js
link.toString()
> '<example.com>; rel=example; title="Example Website", <example-01.com>; rel=alternate; title="Alternate Example Domain"'
```
## Speed
```
$ npm run benchmark
```
```
# http-link-header .parse() ⨉ 1000000
ok ~1.29 s (1 s + 289696759 ns)
# http-link-header #toString() ⨉ 1000000
ok ~554 ms (0 s + 553782657 ns)
```

410
node_modules/http-link-header/lib/link.js generated vendored Normal file
View File

@@ -0,0 +1,410 @@
'use strict'
var COMPATIBLE_ENCODING_PATTERN = /^utf-?8|ascii|utf-?16-?le|ucs-?2|base-?64|latin-?1$/i
var WS_TRIM_PATTERN = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g
var WS_CHAR_PATTERN = /\s|\uFEFF|\xA0/
var WS_FOLD_PATTERN = /\r?\n[\x20\x09]+/g
var DELIMITER_PATTERN = /[;,"]/
var WS_DELIMITER_PATTERN = /[;,"]|\s/
/**
* Token character pattern
* @type {RegExp}
* @see https://tools.ietf.org/html/rfc7230#section-3.2.6
*/
var TOKEN_PATTERN = /^[!#$%&'*+\-\.^_`|~\da-zA-Z]+$/
var STATE = {
IDLE: 1 << 0,
URI: 1 << 1,
ATTR: 1 << 2,
}
function trim( value ) {
return value.replace( WS_TRIM_PATTERN, '' )
}
function hasWhitespace( value ) {
return WS_CHAR_PATTERN.test( value )
}
function skipWhitespace( value, offset ) {
while( hasWhitespace( value[offset] ) ) {
offset++
}
return offset
}
function needsQuotes( value ) {
return WS_DELIMITER_PATTERN.test( value ) ||
!TOKEN_PATTERN.test( value )
}
/**
* Shallow compares two objects to check if their properties match.
* @param {object} object1 First object to compare.
* @param {object} object2 Second object to compare.
* @returns {boolean} Do the objects have matching properties.
*/
function shallowCompareObjects( object1, object2 ) {
return (
Object.keys( object1 ).length === Object.keys( object2 ).length &&
Object.keys( object1 ).every(
( key ) => key in object2 && object1[ key ] === object2[ key ]
)
);
}
class Link {
/**
* Link
* @constructor
* @param {String} [value]
* @returns {Link}
*/
constructor( value ) {
/** @type {Array} URI references */
this.refs = []
if( value ) {
this.parse( value )
}
}
/**
* Get refs with given relation type
* @param {String} value
* @returns {Array<Object>}
*/
rel( value ) {
var links = []
var type = value.toLowerCase()
for( var i = 0; i < this.refs.length; i++ ) {
if( typeof this.refs[ i ].rel === 'string' && this.refs[ i ].rel.toLowerCase() === type ) {
links.push( this.refs[ i ] )
}
}
return links
}
/**
* Get refs where given attribute has a given value
* @param {String} attr
* @param {String} value
* @returns {Array<Object>}
*/
get( attr, value ) {
attr = attr.toLowerCase()
value = value.toLowerCase()
var links = []
for( var i = 0; i < this.refs.length; i++ ) {
if( typeof this.refs[ i ][ attr ] === 'string' && this.refs[ i ][ attr ].toLowerCase() === value ) {
links.push( this.refs[ i ] )
}
}
return links
}
/** Sets a reference. */
set( link ) {
this.refs.push( link )
return this
}
/**
* Sets a reference if a reference with similar properties isnt already set.
*/
setUnique( link ) {
if( !this.refs.some(( ref ) => shallowCompareObjects( ref, link )) ) {
this.refs.push( link )
}
return this
}
has( attr, value ) {
attr = attr.toLowerCase()
value = value.toLowerCase()
for( var i = 0; i < this.refs.length; i++ ) {
if( typeof this.refs[ i ][ attr ] === 'string' && this.refs[ i ][ attr ].toLowerCase() === value ) {
return true
}
}
return false
}
parse( value, offset ) {
offset = offset || 0
value = offset ? value.slice( offset ) : value
// Trim & unfold folded lines
value = trim( value ).replace( WS_FOLD_PATTERN, '' )
var state = STATE.IDLE
var length = value.length
var offset = 0
var ref = null
while( offset < length ) {
if( state === STATE.IDLE ) {
if( hasWhitespace( value[offset] ) ) {
offset++
continue
} else if( value[offset] === '<' ) {
if( ref != null ) {
ref.rel != null ?
this.refs.push( ...Link.expandRelations( ref ) ) :
this.refs.push( ref )
}
var end = value.indexOf( '>', offset )
if( end === -1 ) throw new Error( 'Expected end of URI delimiter at offset ' + offset )
ref = { uri: value.slice( offset + 1, end ) }
// this.refs.push( ref )
offset = end
state = STATE.URI
} else {
throw new Error( 'Unexpected character "' + value[offset] + '" at offset ' + offset )
}
offset++
} else if( state === STATE.URI ) {
if( hasWhitespace( value[offset] ) ) {
offset++
continue
} else if( value[offset] === ';' ) {
state = STATE.ATTR
offset++
} else if( value[offset] === ',' ) {
state = STATE.IDLE
offset++
} else {
throw new Error( 'Unexpected character "' + value[offset] + '" at offset ' + offset )
}
} else if( state === STATE.ATTR ) {
if( value[offset] ===';' || hasWhitespace( value[offset] ) ) {
offset++
continue
}
var end = value.indexOf( '=', offset )
if( end === -1 ) end = value.indexOf( ';', offset )
if( end === -1 ) end = value.length
var attr = trim( value.slice( offset, end ) ).toLowerCase()
var attrValue = ''
offset = end + 1
offset = skipWhitespace( value, offset )
if( value[offset] === '"' ) {
offset++
while( offset < length ) {
if( value[offset] === '"' ) {
offset++; break
}
if( value[offset] === '\\' ) {
offset++
}
attrValue += value[offset]
offset++
}
} else {
var end = offset + 1
while( !DELIMITER_PATTERN.test( value[end] ) && end < length ) {
end++
}
attrValue = value.slice( offset, end )
offset = end
}
if( ref[ attr ] && Link.isSingleOccurenceAttr( attr ) ) {
// Ignore multiples of attributes which may only appear once
} else if( attr[ attr.length - 1 ] === '*' ) {
ref[ attr ] = Link.parseExtendedValue( attrValue )
} else {
attrValue = attr === 'type' ?
attrValue.toLowerCase() : attrValue
if( ref[ attr ] != null ) {
if( Array.isArray( ref[ attr ] ) ) {
ref[ attr ].push( attrValue )
} else {
ref[ attr ] = [ ref[ attr ], attrValue ]
}
} else {
ref[ attr ] = attrValue
}
}
switch( value[offset] ) {
case ',': state = STATE.IDLE; break
case ';': state = STATE.ATTR; break
}
offset++
} else {
throw new Error( 'Unknown parser state "' + state + '"' )
}
}
if( ref != null ) {
ref.rel != null ?
this.refs.push( ...Link.expandRelations( ref ) ) :
this.refs.push( ref )
}
ref = null
return this
}
toString() {
var refs = []
var link = ''
var ref = null
for( var i = 0; i < this.refs.length; i++ ) {
ref = this.refs[i]
link = Object.keys( this.refs[i] ).reduce( function( link, attr ) {
if( attr === 'uri' ) return link
return link + '; ' + Link.formatAttribute( attr, ref[ attr ] )
}, '<' + ref.uri + '>' )
refs.push( link )
}
return refs.join( ', ' )
}
}
/**
* Determines whether an encoding can be
* natively handled with a `Buffer`
* @param {String} value
* @returns {Boolean}
*/
Link.isCompatibleEncoding = function( value ) {
return COMPATIBLE_ENCODING_PATTERN.test( value )
}
Link.parse = function( value, offset ) {
return new Link().parse( value, offset )
}
Link.isSingleOccurenceAttr = function( attr ) {
return attr === 'rel' || attr === 'type' || attr === 'media' ||
attr === 'title' || attr === 'title*'
}
Link.isTokenAttr = function( attr ) {
return attr === 'rel' || attr === 'type' || attr === 'anchor'
}
Link.escapeQuotes = function( value ) {
return value.replace( /"/g, '\\"' )
}
Link.expandRelations = function( ref ) {
var rels = ref.rel.split( ' ' )
return rels.map( function( rel ) {
var value = Object.assign( {}, ref )
value.rel = rel
return value
})
}
/**
* Parses an extended value and attempts to decode it
* @internal
* @param {String} value
* @return {Object}
*/
Link.parseExtendedValue = function( value ) {
var parts = /([^']+)?(?:'([^']*)')?(.+)/.exec( value )
return {
language: parts[2].toLowerCase(),
encoding: Link.isCompatibleEncoding( parts[1] ) ?
null : parts[1].toLowerCase(),
value: Link.isCompatibleEncoding( parts[1] ) ?
decodeURIComponent( parts[3] ) : parts[3]
}
}
/**
* Format a given extended attribute and it's value
* @param {String} attr
* @param {Object} data
* @return {String}
*/
Link.formatExtendedAttribute = function( attr, data ) {
var encoding = ( data.encoding || 'utf-8' ).toUpperCase()
var language = data.language || 'en'
var encodedValue = ''
if( Buffer.isBuffer( data.value ) && Link.isCompatibleEncoding( encoding ) ) {
encodedValue = data.value.toString( encoding )
} else if( Buffer.isBuffer( data.value ) ) {
encodedValue = data.value.toString( 'hex' )
.replace( /[0-9a-f]{2}/gi, '%$1' )
} else {
encodedValue = encodeURIComponent( data.value )
}
return attr + '=' + encoding + '\'' +
language + '\'' + encodedValue
}
/**
* Format a given attribute and it's value
* @param {String} attr
* @param {String|Object} value
* @return {String}
*/
Link.formatAttribute = function( attr, value ) {
if( Array.isArray( value ) ) {
return value.map(( item ) => {
return Link.formatAttribute( attr, item )
}).join( '; ' )
}
if( attr[ attr.length - 1 ] === '*' || typeof value !== 'string' ) {
return Link.formatExtendedAttribute( attr, value )
}
if( Link.isTokenAttr( attr ) ) {
value = needsQuotes( value ) ?
'"' + Link.escapeQuotes( value ) + '"' :
Link.escapeQuotes( value )
} else if( needsQuotes( value ) ) {
value = encodeURIComponent( value )
// We don't need to escape <SP> <,> <;> within quotes
value = value
.replace( /%20/g, ' ' )
.replace( /%2C/g, ',' )
.replace( /%3B/g, ';' )
value = '"' + value + '"'
}
return attr + '=' + value
}
module.exports = Link

37
node_modules/http-link-header/package.json generated vendored Normal file
View File

@@ -0,0 +1,37 @@
{
"name": "http-link-header",
"version": "1.1.3",
"description": "Parse & format HTTP link headers according to RFC 8288",
"author": "Jonas Hermsmeier <jhermsmeier@gmail.com> (https://jhermsmeier.de)",
"license": "MIT",
"keywords": [
"rfc5988",
"rfc8288",
"rfc",
"5988",
"8288",
"http",
"link",
"header"
],
"main": "lib/link.js",
"scripts": {
"benchmark": "node benchmark",
"test": "control"
},
"devDependencies": {
"@jhermsmeier/control": "2.0.2",
"nanobench": "2.1.1"
},
"homepage": "https://github.com/jhermsmeier/node-http-link-header",
"repository": {
"type": "git",
"url": "git+https://github.com/jhermsmeier/node-http-link-header.git"
},
"bugs": {
"url": "https://github.com/jhermsmeier/node-http-link-header/issues"
},
"engines": {
"node": ">=6.0.0"
}
}