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

Añadir parte del EsDom API #9

Open
wants to merge 32 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c9871f1
Añadir @es-js/runtime
Trollhunters501PC Nov 2, 2024
059d932
Arreglar Error
Trollhunters501PC Nov 2, 2024
dd9d530
Añadir recomentacion de coderabbitai
Trollhunters501PC Nov 2, 2024
17e8d2d
Añadir ventana, navegador y algunas funciones
Trollhunters501PC Nov 9, 2024
4123e43
añadir mas funciones
Trollhunters501PC Nov 9, 2024
17ba72d
Arreglar Error
Trollhunters501PC Nov 9, 2024
bf2da0d
Arreglar
Trollhunters501PC Nov 9, 2024
b24ed2d
Añadir Apoderado = Proxy
Trollhunters501PC Nov 9, 2024
ac72d9a
Añadir tipos
Trollhunters501PC Nov 9, 2024
bdc5860
.
Trollhunters501PC Nov 9, 2024
0a7ff97
añadir mas funciones,
Trollhunters501PC Nov 9, 2024
b9a220b
Arreglar Error en Simbolo
Trollhunters501PC Nov 9, 2024
e3913e1
Añadir Numero Grande
Trollhunters501PC Nov 10, 2024
47341ed
Arreglar Proxy y añadir NumeroGrande a tipos
Trollhunters501PC Nov 10, 2024
11d2c6f
Añadir Documento
Trollhunters501PC Nov 12, 2024
7f96e0d
Merge branch 'develop' into main-runtime
enzonotario Nov 12, 2024
1bda6df
Arreglar Errores
Trollhunters501PC Nov 13, 2024
f60f5aa
Arreglar error de ventana caches
Trollhunters501PC Nov 14, 2024
c7f2644
Arreglar propiedades de simbolo
Trollhunters501PC Nov 20, 2024
16b6683
Cambiar documento a document estatico
Trollhunters501PC Nov 20, 2024
b379625
Arreglar simbolo aCadena propiedad a etiquetaCadena
Trollhunters501PC Nov 20, 2024
0c4ff03
Arreglar Documento
Trollhunters501PC Nov 20, 2024
ead21f9
chore(tests): add Plugins fixtures
enzonotario Nov 22, 2024
02e8f78
chore(tests): plugins fixtures
enzonotario Nov 22, 2024
8216fbf
Update packages/core/src/plugins/ventana/index.ts
enzonotario Nov 22, 2024
928fbd3
Update packages/core/src/plugins/documento/index.ts
enzonotario Nov 22, 2024
88d5a56
Update packages/core/src/plugins/ventana/index.ts
enzonotario Nov 22, 2024
d5b357a
Update packages/core/src/plugins/documento/index.ts
enzonotario Nov 22, 2024
30b3fce
Update packages/core/src/plugins/documento/index.ts
enzonotario Nov 22, 2024
b2186ca
change(documento): cambiar `agregar` por `anexar`; eliminar funciones…
enzonotario Nov 28, 2024
ae5c4c3
chore(documento): fix fixture
enzonotario Nov 28, 2024
59f7e68
Update packages/core/src/plugins/ventana/index.ts
enzonotario Nov 28, 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
145 changes: 145 additions & 0 deletions packages/core/src/plugins/documento/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
import {
replaceExpressionMethods,
enzonotario marked this conversation as resolved.
Show resolved Hide resolved
replaceInstanceof,
replaceObjectProperties,
replaceObjectStaticMethods,
replaceObjects,
} from '../utils'

export const report = () => 'Converts Documento methods to JavaScript'
enzonotario marked this conversation as resolved.
Show resolved Hide resolved

export const methods = new Map<string, string>([
['adoptarNodo', 'adoptNode'],
['agregar', 'append'],
['temasNavegador', 'browsingTopics'],
enzonotario marked this conversation as resolved.
Show resolved Hide resolved
['posicionCursorPunto', 'caretPositionFromPoint'],
['rangoCursorPunto', 'caretRangeFromPoint'],
['crearAtributo', 'createAttribute'],
['crearAtributoNS', 'createAttributeNS'],
['crearSeccionCDATA', 'createCDATASection'],
['crearComentario', 'createComment'],
['crearFragmentoDocumento', 'createDocumentFragment'],
['crearElemento', 'createElement'],
['crearElementoNS', 'createElementNS'],
['crearEvento', 'createEvent'],
['crearIteradorNodo', 'createNodeIterator'],
['crearInstruccionProcesamiento', 'createProcessingInstruction'],
['crearRango', 'createRange'],
['crearNodoTexto', 'createTextNode'],
['crearToque', 'createTouch'],
['crearListaToque', 'createTouchList'],
['crearCaminanteArboles', 'createTreeWalker'],
['elementoDesdePunto', 'elementFromPoint'],
['elementosDesdePunto', 'elementsFromPoint'],
['salirPantallaCompleta', 'exitFullscreen'],
['salirPantallaEnPantalla', 'exitPictureInPicture'],
['salirBloqueoPuntero', 'exitPointerLock'],
['obtenerAnimaciones', 'getAnimations'],
['obtenerElementoPorId', 'getElementById'],
['obtenerElementosPorNombreClase', 'getElementsByClassName'],
['obtenerElementosPorNombreEtiqueta', 'getElementsByTagName'],
['obtenerElementosPorNombreNSEtiqueta', 'getElementsByTagNameNS'],
['obtenerSeleccion', 'getSelection'],
['tieneAccesoAlmacenamiento', 'hasStorageAccess'],
['tieneAccesoCookiesSinParticiones', 'hasUnpartitionedCookieAccess'],
['importarNodo', 'importNode'],
['mozEstablecerElementoImagen', 'mozSetImageElement'],
['anteponer', 'prepend'],
['consultarSeleccion', 'querySelector'],
['consultarSelectoresTodo', 'querySelectorAll'],
['liberarCaptura', 'releaseCapture'],
['reemplazarSecundario', 'replaceChildren'],
['solicitarAccesoAlmacenamiento', 'requestStorageAccess'],
['solicitarAccesoAlmacenamientoPara', 'requestStorageAccessFor'],
enzonotario marked this conversation as resolved.
Show resolved Hide resolved
['iniciarVerTransicion', 'startViewTransition'],
['crearExpresion', 'createExpression'],
['crearSolucionarNS', 'createNSResolver'],
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Corrección de traducción: 'createNSResolver' debería ser 'crearResolverNS'

El método 'createNSResolver' se traduce más apropiadamente como 'crearResolverNS', ya que 'resolver' es 'resolver' en este contexto. 'Solucionar' se refiere más a 'solve' que a 'resolve'.

Aplicar el siguiente cambio:

-['crearSolucionarNS', 'createNSResolver'],
+['crearResolverNS', 'createNSResolver'],
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
['crearSolucionarNS', 'createNSResolver'],
['crearResolverNS', 'createNSResolver'],

['evaluar', 'evaluate'],
['cerrar', 'close'],
['ejecComando', 'execCommand'],
enzonotario marked this conversation as resolved.
Show resolved Hide resolved
['obtenerElementosPorNombre', 'getElementsByName'],
['estaEnfocado', 'hasFocus'],
['abrir', 'open'],
['consultarComandoActivo', 'queryCommandEnabled'],
['escribir', 'write'],
['escribirEn', 'writeln']
])

export const staticMethods = new Map<string, string>([
['analizarHTMLInseguro', 'parseHTMLUnsafe']
])

export const properties = new Map<string, string>([
['elementoActivo', 'activeElement'],
['hojasEstiloAdoptadas', 'adoptedStyleSheets'],
['cuerpo', 'body'],
['caracteresEstablecidos', 'characterSet'],
enzonotario marked this conversation as resolved.
Show resolved Hide resolved
['longitudElementosSecundarios', 'childElementCount'],
['secundarios', 'children'],
Comment on lines +71 to +72
Copy link

@coderabbitai coderabbitai bot Nov 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Unificar terminología: Reemplazar 'Secundario' por 'Hijo'

El término "hijo" es la traducción más comúnmente aceptada para "child" en programación y DOM. Se recomienda reemplazar "Secundario" por "Hijo" para mejorar la claridad y alinearse con las convenciones estándar.

Aplicar el siguiente cambio:

-['longitudElementosSecundarios', 'childElementCount'],
-['secundarios', 'children'],
-['primerElementoSecundario', 'firstElementChild'],
-['ultimoElementoSecundario', 'lastElementChild'],
+['longitudElementosHijos', 'childElementCount'],
+['hijos', 'children'],
+['primerElementoHijo', 'firstElementChild'],
+['ultimoElementoHijo', 'lastElementChild'],

Also applies to: 87-87, 96-96

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

crea un commit para esto

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@enzonotario, entiendo su solicitud, pero no puedo crear un commit directamente en el repositorio. Por favor, aplique el cambio sugerido en su entorno local y realice el commit correspondiente.

Comment on lines +71 to +72
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Unificar terminología: Reemplazar 'Secundario' por 'Hijo'

El término "hijo" es más apropiado para referirse a 'child' en el contexto del DOM.

Aplicar los siguientes cambios:

- ['longitudElementosSecundarios', 'childElementCount'],
- ['secundarios', 'children'],
- ['primerElementoSecundario', 'firstElementChild'],
- ['ultimoElementoSecundario', 'lastElementChild'],
+ ['longitudElementosHijos', 'childElementCount'],
+ ['hijos', 'children'],
+ ['primerElementoHijo', 'firstElementChild'],
+ ['ultimoElementoHijo', 'lastElementChild'],

Also applies to: 84-85, 93-93

['modoEstricto', 'compatMode'],
['tipoContenido', 'contentType'],
['scriptActual', 'currentScript'],
['tipoDoc', 'doctype'],
['elementoDocumento', 'documentElement'],
['documentoURI', 'documentURI'],
['incrustados', 'embeds'],
['politicaCaracteristicas', 'featurePolicy'],
['primerElementoSecundario', 'firstElementChild'],
['fuentes', 'fonts'],
['formularios', 'forms'],
['fragmentoDirectivo', 'fragmentDirective'],
['elementoPantallaCompleta', 'fullscreenElement'],
['cabecera', 'head'],
['oculta', 'hidden'],
['imagenes', 'images'],
['implementacion', 'implementation'],
['ultimoElementoSecundario', 'lastElementChild'],
['links', 'links'],
['elementoImagenEnImagen', 'pictureInPictureElement'],
['imagenEnImagenActivo', 'pictureInPictureEnabled'],
Copy link

@coderabbitai coderabbitai bot Nov 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Corrección de traducción: Reemplazar 'Activo/Activa' por 'Habilitado/Habilitada'

La palabra "Enabled" se traduce más apropiadamente como "Habilitado" o "Habilitada" en lugar de "Activo/Activa". Para mayor precisión en la traducción de las propiedades, se sugiere actualizar los nombres.

Aplicar el siguiente cambio:

-['imagenEnImagenActivo', 'pictureInPictureEnabled'],
+['imagenEnImagenHabilitado', 'pictureInPictureEnabled'],

-['pantallaCompletaActiva', 'fullscreenEnabled'],
+['pantallaCompletaHabilitada', 'fullscreenEnabled'],

Also applies to: 112-112

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

crea un commit para esto

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@enzonotario, lo siento, pero no tengo la capacidad de crear commits en el repositorio. Sin embargo, puedes aplicar los cambios sugeridos para corregir las traducciones.

Copy link

@coderabbitai coderabbitai bot Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Corrección de traducción: Reemplazar 'Activo/Activa' por 'Habilitado/Habilitada'

Para mayor precisión, se sugiere usar 'Habilitado' en lugar de 'Activo'.

Aplicar los siguientes cambios:

- ['imagenEnImagenActivo', 'pictureInPictureEnabled'],
+ ['imagenEnImagenHabilitado', 'pictureInPictureEnabled'],

- ['pantallaCompletaActiva', 'fullscreenEnabled'],
+ ['pantallaCompletaHabilitada', 'fullscreenEnabled'],

Also applies to: 109-109

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

crea un commit para esto

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@enzonotario, entiendo tu solicitud, pero como asistente, no puedo crear commits directamente en el repositorio. Por favor, aplica los cambios sugeridos manualmente en tu PR.

['complementos', 'plugins'],
['bloqueoPunteroElemento', 'pointerLockElement'],
['preRenderizacion', 'prerendering'],
['scripts', 'scripts'],
['desplazarElemento', 'scrollingElement'],
['hojasEstilo', 'styleSheets'],
['lineaTiempo', 'timeline'],
['estadoVisibilidad', 'visibilityState'],
['cookie', 'cookie'],
['vistaPorDefecto', 'defaultView'],
['modoEditor', 'designMode'],
enzonotario marked this conversation as resolved.
Show resolved Hide resolved
['dir', 'dir'],
['pantallaCompletaActiva', 'fullscreenEnabled'],
['ultimaModificacion', 'lastModified'],
['ubicacion', 'location'],
['estadoCarga', 'readyState'],
['referencia', 'referrer'],
['titulo', 'title'],
['URL', 'URL']
])

export const objects = new Map<string, string>([['Documento', 'Document']])

export function replace() {
return {
...replaceObjectStaticMethods({
from: 'Documento',
to: 'Document',
methods: staticMethods,
}),
enzonotario marked this conversation as resolved.
Show resolved Hide resolved
...replaceExpressionMethods({
methods,
}),
...replaceObjectProperties({
properties,
}),
...replaceInstanceof({
from: 'Documento',
to: 'Document',
}),
...replaceObjects({
objects,
}),
enzonotario marked this conversation as resolved.
Show resolved Hide resolved
}
}

12 changes: 12 additions & 0 deletions packages/core/src/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ import * as soporte from './soporte'
import * as funcion from './funcion'
import * as json from './json'
import * as tipos from './tipos'
import * as navegador from './navegador'
import * as ventana from './ventana'
import * as puente from './puente'
import * as simbolo from './simbolo'
import * as numerogrande from './numerogrande'
import * as documento from './documento'

export const plugins = [
['consola', consola],
Expand All @@ -25,6 +31,12 @@ export const plugins = [
['soporte', soporte],
['json', json],
['tipos', tipos],
['navegador', navegador],
['ventana', ventana],
['puente', puente],
['simbolo', simbolo],
['numerogrande', numerogrande],
['documento', documento]
]

export { setToEsJS }
72 changes: 72 additions & 0 deletions packages/core/src/plugins/navegador/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import {
replaceObjectStaticMethods,
replaceObjectStaticProperties,
replaceObjects
} from '../utils'
export const report = () => 'Converts navegador to navigator'

export const properties = new Map<string, string>([
["credenciales", "credentials"],
["memoriaDispositivo", "deviceMemory"],
["concurrenciaHardware", "hardwareConcurrency"],
["idioma", "language"],
["idiomas", "languages"],
["puntosContactoMax", "maxTouchPoints"],
["enLinea", "onLine"],
["visorPdfHabilitado", "pdfViewerEnabled"],
["agenteUsuario", "userAgent"],
["controladorWeb", "webdriver"],
["conexion", "connection"],
["cookieHabilitada", "cookieEnabled"],
["geoLocalizacion", "geolocation"],
["teclado", "keyboard"],
["claves", "locks"],
["capacidadesMedio", "mediaCapabilities"],
["dispositivosMultimedia", "mediaDevices"],
["sesionMultimedia", "mediaSession"],
["permisos", "permissions"],
["presentacion", "presentation"],
["servicioTrabajo", "serviceWorker"],
["almacenamiento", "storage"],
["activacionUsuario", "userActivation"],
["datosAgenteUsuario", "userAgentData"],
["controlesVentanaSuperpuestos", "windowControlsOverlay"],
["hid", "hid"],
["serial", "serial"],
["re", "xr"]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Sugerencia: Revisar la traducción de 're' a 'xr'

La clave "re" se está traduciendo a "xr". Puede que "re" no sea la representación más clara en español para "XR" (realidad extendida). Considera utilizar "xr" directamente o una traducción más descriptiva como "realidadExtendida".

])

export const objects = new Map<string, string>([['navegador', 'navigator']])

export const methods = new Map<string, string>([
["puedeCompartir", "canShare"],
["borrarInsigniaApp", "clearAppBadge"],
["obtenerBateria", "getBattery"],
["registrarControladorProtocolo", "registerProtocolHandler"],
["solicitarClavesMultimedia", "requestMediaKeySystemAccess"],
["solicitarAccesoMIDI", "requestMIDIAccess"],
["enviarBeacon", "sendBeacon"],
["establecerInsigniaApp", "setAppBadge"],
["compartir", "share"],
["vibrar", "vibrate"],
['javaHabilitado', 'javaEnabled'],
['obtenerNotificaciones', 'getNotifications']
])
Comment on lines +52 to +54
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Mantener consistencia en el uso de comillas

En las líneas 52 a 54, las claves están entre comillas simples ('javaHabilitado', 'obtenerNotificaciones'), mientras que en el resto del archivo se utilizan comillas dobles. Para mantener la consistencia y legibilidad, sería recomendable unificar el estilo de comillas en todo el mapa.


export function replace() {
return {
...replaceObjectStaticMethods({
from: 'navegador',
to: 'navigator',
methods,
}),
...replaceObjectStaticProperties({
from: 'navegador',
to: 'navigator',
properties,
}),
...replaceObjects({
objects,
})
}
}
enzonotario marked this conversation as resolved.
Show resolved Hide resolved
49 changes: 49 additions & 0 deletions packages/core/src/plugins/numerogrande/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import {
replaceExpressionMethods,
replaceInstanceof,
replaceObjectProperties,
replaceObjectStaticMethods,
replaceObjects,
} from '../utils'

export const report = () => 'Converts NumeroGrande methods to JavaScript'
enzonotario marked this conversation as resolved.
Show resolved Hide resolved

export const staticMethods = new Map<string, string>([
['comoNumeroSig', 'asIntN'],
['comoNumero', 'asUintN']
])
enzonotario marked this conversation as resolved.
Show resolved Hide resolved

export const properties = new Map<string, string>([
['etiquetaCadena', 'toStringTag']
])

export const methods = new Map<string, string>([
['aCadenaLocalizada', 'toLocaleString'],
['aCadena', 'toString'],
['valorDe', 'valueOf']
])
enzonotario marked this conversation as resolved.
Show resolved Hide resolved

export const objects = new Map<string, string>([['NumeroGrande', 'BigInt']])
enzonotario marked this conversation as resolved.
Show resolved Hide resolved

export function replace() {
return {
...replaceObjectStaticMethods({
from: 'NumeroGrande',
to: 'BigInt',
methods: staticMethods,
}),
...replaceExpressionMethods({
methods,
}),
...replaceObjectProperties({
properties,
}),
...replaceInstanceof({
from: 'NumeroGrande',
to: 'BigInt',
}),
...replaceObjects({
objects,
}),
}
}
enzonotario marked this conversation as resolved.
Show resolved Hide resolved
31 changes: 31 additions & 0 deletions packages/core/src/plugins/puente/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import {
replaceInstanceof,
replaceObjectStaticMethods,
replaceObjects,
} from '../utils'

export const report = () => 'Converts Puente methods to JavaScript'

export const staticMethods = new Map<string, string>([
["revocable", "revocable"]
])

export const objects = new Map<string, string>([['Puente', 'Proxy']])

export function replace() {
return {
...replaceObjectStaticMethods({
from: 'Puente',
to: 'Proxy',
methods: staticMethods,
}),
...replaceInstanceof({
from: 'Puente',
to: 'Proxy',
}),
...replaceObjects({
objects,
}),
}
}

Loading
Loading