Browse Source

* Namespaced RTL

Michaël Van Canneyt 1 year ago
parent
commit
f3907ef818
98 changed files with 1393 additions and 296 deletions
  1. 0 19
      packages/rtl/generics.strings.pas
  2. 3 0
      packages/rtl/namespaced/Api.JQuery.pas
  3. 3 0
      packages/rtl/namespaced/Browser.Console.pas
  4. 3 0
      packages/rtl/namespaced/Browser.ScriptLoader.pas
  5. 3 0
      packages/rtl/namespaced/Browser.TemplateLoader.pas
  6. 3 0
      packages/rtl/namespaced/Browser.UnitLoader.pas
  7. 3 0
      packages/rtl/namespaced/BrowserApi.Audio.pas
  8. 3 0
      packages/rtl/namespaced/BrowserApi.BlueTooth.pas
  9. 3 0
      packages/rtl/namespaced/BrowserApi.LoadHelper.pas
  10. 3 0
      packages/rtl/namespaced/BrowserApi.RTC.pas
  11. 3 0
      packages/rtl/namespaced/BrowserApi.SVG.pas
  12. 3 0
      packages/rtl/namespaced/BrowserApi.Web.pas
  13. 3 0
      packages/rtl/namespaced/BrowserApi.WebAssembly.pas
  14. 3 0
      packages/rtl/namespaced/BrowserApi.WebGL.pas
  15. 3 0
      packages/rtl/namespaced/BrowserApi.WebOrWorker.pas
  16. 3 0
      packages/rtl/namespaced/BrowserApi.Worker.pas
  17. 3 0
      packages/rtl/namespaced/HTML.Actions.pas
  18. 3 0
      packages/rtl/namespaced/HTML.EventNames.pas
  19. 3 0
      packages/rtl/namespaced/HTML.Translate.pas
  20. 3 0
      packages/rtl/namespaced/HTML.Utils.pas
  21. 3 0
      packages/rtl/namespaced/JSApi.JS.pas
  22. 3 0
      packages/rtl/namespaced/NodeApi.Events.pas
  23. 3 0
      packages/rtl/namespaced/NodeApi.JS.pas
  24. 3 0
      packages/rtl/namespaced/System.ArrayUtils.pas
  25. 3 0
      packages/rtl/namespaced/System.Class2Pas.pas
  26. 3 0
      packages/rtl/namespaced/System.Classes.pas
  27. 3 0
      packages/rtl/namespaced/System.Contnrs.pas
  28. 3 0
      packages/rtl/namespaced/System.DateUtils.pas
  29. 3 0
      packages/rtl/namespaced/System.Generics.Collections.pas
  30. 3 0
      packages/rtl/namespaced/System.Generics.Defaults.pas
  31. 3 0
      packages/rtl/namespaced/System.Generics.Strings.pas
  32. 3 0
      packages/rtl/namespaced/System.HotReload.pas
  33. 3 0
      packages/rtl/namespaced/System.Math.pas
  34. 3 0
      packages/rtl/namespaced/System.RTLConsts.pas
  35. 3 0
      packages/rtl/namespaced/System.Res.pas
  36. 3 0
      packages/rtl/namespaced/System.ResourceTranslate.pas
  37. 3 0
      packages/rtl/namespaced/System.Router.pas
  38. 3 0
      packages/rtl/namespaced/System.Rtti.pas
  39. 3 0
      packages/rtl/namespaced/System.SimpleLinkedList.pas
  40. 3 0
      packages/rtl/namespaced/System.StrUtils.pas
  41. 3 0
      packages/rtl/namespaced/System.SysUtils.pas
  42. 3 0
      packages/rtl/namespaced/System.Timer.pas
  43. 3 0
      packages/rtl/namespaced/System.TypInfo.pas
  44. 3 0
      packages/rtl/namespaced/System.Types.pas
  45. 3 0
      packages/rtl/namespaced/System.WebUtils.pas
  46. 241 0
      packages/rtl/namespaced/pas2js_rtl_namespaced.lpk
  47. 21 0
      packages/rtl/namespaced/pas2js_rtl_namespaced.pas
  48. 0 17
      packages/rtl/pas2js_rtl.pas
  49. 20 0
      packages/rtl/src/Rtl.BrowserLoadHelper.pas
  50. 27 61
      packages/rtl/src/Rtl.HTMLActions.pas
  51. 17 0
      packages/rtl/src/Rtl.HTMLEventNames.pas
  52. 8 2
      packages/rtl/src/Rtl.HTMLTranslate.pas
  53. 8 2
      packages/rtl/src/Rtl.HTMLUtils.pas
  54. 28 2
      packages/rtl/src/Rtl.ScriptLoader.pas
  55. 12 1
      packages/rtl/src/Rtl.TemplateLoader.pas
  56. 29 3
      packages/rtl/src/Rtl.UnitLoader.pas
  57. 20 0
      packages/rtl/src/arrayutils.pas
  58. 7 0
      packages/rtl/src/browserconsole.pas
  59. 7 1
      packages/rtl/src/class2pas.pas
  60. 16 6
      packages/rtl/src/classes.pas
  61. 10 1
      packages/rtl/src/contnrs.pas
  62. 12 3
      packages/rtl/src/dateutils.pas
  63. 23 0
      packages/rtl/src/generics.collections.pas
  64. 17 0
      packages/rtl/src/generics.defaults.pas
  65. 35 0
      packages/rtl/src/generics.strings.pas
  66. 22 1
      packages/rtl/src/hotreloadclient.pas
  67. 6 0
      packages/rtl/src/js.pas
  68. 23 1
      packages/rtl/src/libjquery.pas
  69. 3 1
      packages/rtl/src/math.pas
  70. 21 0
      packages/rtl/src/node.events.pas
  71. 11 5
      packages/rtl/src/nodejs.pas
  72. 0 0
      packages/rtl/src/objpas.pas
  73. 26 1
      packages/rtl/src/p2jsres.pp
  74. 68 4
      packages/rtl/src/pas2js_rtl.lpk
  75. 16 0
      packages/rtl/src/pas2js_rtl.pas
  76. 6 1
      packages/rtl/src/rstranslate.pp
  77. 21 0
      packages/rtl/src/rtl.webthreads.pas
  78. 2 0
      packages/rtl/src/rtlconsts.pas
  79. 16 10
      packages/rtl/src/rtti.pas
  80. 21 0
      packages/rtl/src/simplelinkedlist.pas
  81. 12 1
      packages/rtl/src/strutils.pas
  82. 0 0
      packages/rtl/src/system.pas
  83. 20 13
      packages/rtl/src/sysutils.pas
  84. 9 3
      packages/rtl/src/timer.pas
  85. 2 0
      packages/rtl/src/types.pas
  86. 6 0
      packages/rtl/src/typinfo.pas
  87. 149 97
      packages/rtl/src/web.pas
  88. 21 0
      packages/rtl/src/webassembly.pas
  89. 23 1
      packages/rtl/src/webaudio.pas
  90. 23 1
      packages/rtl/src/webbluetooth.pas
  91. 22 1
      packages/rtl/src/webgl.pas
  92. 21 0
      packages/rtl/src/weborworker.pas
  93. 17 4
      packages/rtl/src/webrouter.pp
  94. 23 2
      packages/rtl/src/webrtc.pas
  95. 22 1
      packages/rtl/src/websvg.pas
  96. 51 0
      packages/rtl/src/webutils.pas
  97. 20 0
      packages/rtl/src/webworker.pas
  98. 0 30
      packages/rtl/webutils.pas

+ 0 - 19
packages/rtl/generics.strings.pas

@@ -1,19 +0,0 @@
-unit Generics.Strings;
-
-{$Mode Delphi}
-
-interface
-
-resourcestring
-  SArgumentOutOfRange = 'Argument out of range';
-  //SArgumentNilNode = 'Node is nil';
-  //SDuplicatesNotAllowed = 'Duplicates not allowed in dictionary';
-  //SCollectionInconsistency = 'Collection inconsistency';
-  //SCollectionDuplicate = 'Collection does not allow duplicates';
-  //SDictionaryKeyDoesNotExist = 'Dictionary key does not exist';
-  //SItemNotFound = 'Item not found';
-
-implementation
-
-end.
-

+ 3 - 0
packages/rtl/namespaced/Api.JQuery.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit Api.JQuery;
+{$include ../src/libjquery.pas}

+ 3 - 0
packages/rtl/namespaced/Browser.Console.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit Browser.Console;
+{$include ../src/browserconsole.pas}

+ 3 - 0
packages/rtl/namespaced/Browser.ScriptLoader.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit Browser.ScriptLoader;
+{$include ../src/Rtl.ScriptLoader.pas}

+ 3 - 0
packages/rtl/namespaced/Browser.TemplateLoader.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit Browser.TemplateLoader;
+{$include ../src/Rtl.TemplateLoader.pas}

+ 3 - 0
packages/rtl/namespaced/Browser.UnitLoader.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit Browser.UnitLoader;
+{$include ../src/Rtl.UnitLoader.pas}

+ 3 - 0
packages/rtl/namespaced/BrowserApi.Audio.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit BrowserApi.Audio;
+{$include ../src/webaudio.pas}

+ 3 - 0
packages/rtl/namespaced/BrowserApi.BlueTooth.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit BrowserApi.BlueTooth;
+{$include ../src/webbluetooth.pas}

+ 3 - 0
packages/rtl/namespaced/BrowserApi.LoadHelper.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit BrowserApi.LoadHelper;
+{$include ../src/Rtl.BrowserLoadHelper.pas}

+ 3 - 0
packages/rtl/namespaced/BrowserApi.RTC.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit BrowserApi.RTC;
+{$include ../src/webrtc.pas}

+ 3 - 0
packages/rtl/namespaced/BrowserApi.SVG.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit BrowserApi.SVG;
+{$include ../src/websvg.pas}

+ 3 - 0
packages/rtl/namespaced/BrowserApi.Web.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit BrowserApi.Web;
+{$include ../src/web.pas}

+ 3 - 0
packages/rtl/namespaced/BrowserApi.WebAssembly.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit BrowserApi.WebAssembly;
+{$include ../src/webassembly.pas}

+ 3 - 0
packages/rtl/namespaced/BrowserApi.WebGL.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit BrowserApi.WebGL;
+{$include ../src/webgl.pas}

+ 3 - 0
packages/rtl/namespaced/BrowserApi.WebOrWorker.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit BrowserApi.WebOrWorker;
+{$include ../src/weborworker.pas}

+ 3 - 0
packages/rtl/namespaced/BrowserApi.Worker.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit BrowserApi.Worker;
+{$include ../src/webworker.pas}

+ 3 - 0
packages/rtl/namespaced/HTML.Actions.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit HTML.Actions;
+{$include ../src/Rtl.HTMLActions.pas}

+ 3 - 0
packages/rtl/namespaced/HTML.EventNames.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit HTML.EventNames;
+{$include ../src/Rtl.HTMLEventNames.pas}

+ 3 - 0
packages/rtl/namespaced/HTML.Translate.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit HTML.Translate;
+{$include ../src/Rtl.HTMLTranslate.pas}

+ 3 - 0
packages/rtl/namespaced/HTML.Utils.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit HTML.Utils;
+{$include ../src/Rtl.HTMLUtils.pas}

+ 3 - 0
packages/rtl/namespaced/JSApi.JS.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+Unit JSApi.JS;
+{$i ../src/js.pas}

+ 3 - 0
packages/rtl/namespaced/NodeApi.Events.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit NodeApi.Events;
+{$include ../src/node.events.pas}

+ 3 - 0
packages/rtl/namespaced/NodeApi.JS.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit NodeApi.JS;
+{$include ../src/nodejs.pas}

+ 3 - 0
packages/rtl/namespaced/System.ArrayUtils.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit System.ArrayUtils;
+{$include ../src/arrayutils.pas}

+ 3 - 0
packages/rtl/namespaced/System.Class2Pas.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit System.Class2Pas;
+{$include ../src/class2pas.pas}

+ 3 - 0
packages/rtl/namespaced/System.Classes.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit System.Classes;
+{$include ../src/classes.pas}

+ 3 - 0
packages/rtl/namespaced/System.Contnrs.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit System.Contnrs;
+{$include ../src/contnrs.pas}

+ 3 - 0
packages/rtl/namespaced/System.DateUtils.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit System.DateUtils;
+{$include ../src/dateutils.pas}

+ 3 - 0
packages/rtl/namespaced/System.Generics.Collections.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit System.Generics.Collections;
+{$include ../src/generics.collections.pas}

+ 3 - 0
packages/rtl/namespaced/System.Generics.Defaults.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit System.Generics.Defaults;
+{$include ../src/generics.defaults.pas}

+ 3 - 0
packages/rtl/namespaced/System.Generics.Strings.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit System.Generics.Strings;
+{$include ../src/generics.strings.pas}

+ 3 - 0
packages/rtl/namespaced/System.HotReload.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit System.HotReload;
+{$include ../src/hotreloadclient.pas}

+ 3 - 0
packages/rtl/namespaced/System.Math.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit System.Math;
+{$include ../src/math.pas}

+ 3 - 0
packages/rtl/namespaced/System.RTLConsts.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit System.RTLConsts;
+{$i ../src/rtlconsts.pas}

+ 3 - 0
packages/rtl/namespaced/System.Res.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit System.Res;
+{$include ../src/p2jsres.pp}

+ 3 - 0
packages/rtl/namespaced/System.ResourceTranslate.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit System.ResourceTranslate;
+{$include ../src/rstranslate.pp}

+ 3 - 0
packages/rtl/namespaced/System.Router.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit System.Router;
+{$include ../src/webrouter.pp}

+ 3 - 0
packages/rtl/namespaced/System.Rtti.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit System.Rtti;
+{$include ../src/rtti.pas}

+ 3 - 0
packages/rtl/namespaced/System.SimpleLinkedList.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit System.SimpleLinkedList;
+{$include ../src/simplelinkedlist.pas}

+ 3 - 0
packages/rtl/namespaced/System.StrUtils.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit System.StrUtils;
+{$include ../src/strutils.pas}

+ 3 - 0
packages/rtl/namespaced/System.SysUtils.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit System.SysUtils;
+{$i ../src/sysutils.pas}

+ 3 - 0
packages/rtl/namespaced/System.Timer.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit System.Timer;
+{$include ../src/timer.pas}

+ 3 - 0
packages/rtl/namespaced/System.TypInfo.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+Unit System.TypInfo;
+{$i ../src/typinfo.pas}

+ 3 - 0
packages/rtl/namespaced/System.Types.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit System.Types;
+{$i ../src/types.pas}

+ 3 - 0
packages/rtl/namespaced/System.WebUtils.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit System.WebUtils;
+{$include ../src/webutils.pas}

+ 241 - 0
packages/rtl/namespaced/pas2js_rtl_namespaced.lpk

@@ -0,0 +1,241 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<CONFIG>
+  <Package Version="5">
+    <Name Value="pas2js_rtl_namespaced"/>
+    <Type Value="RunTimeOnly"/>
+    <Author Value="Mattias Gaertner"/>
+    <AutoUpdate Value="Manually"/>
+    <CompilerOptions>
+      <Version Value="11"/>
+      <SearchPaths>
+        <IncludeFiles Value="../src"/>
+        <UnitOutputDirectory Value="."/>
+      </SearchPaths>
+      <Parsing>
+        <SyntaxOptions>
+          <AllowLabel Value="False"/>
+          <UseAnsiStrings Value="False"/>
+          <CPPInline Value="False"/>
+        </SyntaxOptions>
+      </Parsing>
+      <CodeGeneration>
+        <Optimizations>
+          <OptimizationLevel Value="0"/>
+        </Optimizations>
+      </CodeGeneration>
+      <Linking>
+        <Debugging>
+          <GenerateDebugInfo Value="False"/>
+        </Debugging>
+      </Linking>
+      <Other>
+        <CustomOptions Value="-dPas2js -O- -Jc"/>
+        <CompilerPath Value="$MakeExe(IDE,pas2js)"/>
+        <ExecuteBefore>
+          <Command Value="$MakeExe(IDE,pas2js) -O- -Jc -vbq pas2js_rtl_namespaced.pas"/>
+          <Parsers Count="1">
+            <Item1 Value="Pas2JS"/>
+          </Parsers>
+        </ExecuteBefore>
+      </Other>
+      <SkipCompiler Value="True"/>
+    </CompilerOptions>
+    <Description Value="pas2js RTL - Run Time Library"/>
+    <License Value="Modified LGPL2 as the FPC packages."/>
+    <Version Major="1"/>
+    <Files Count="46">
+      <Item1>
+        <HasRegisterProc Value="True"/>
+      </Item1>
+      <Item2>
+        <Filename Value="System.Classes.pas"/>
+        <UnitName Value="System.Classes"/>
+      </Item2>
+      <Item3>
+        <Filename Value="JSApi.JS.pas"/>
+        <UnitName Value="JSApi.JS"/>
+      </Item3>
+      <Item4>
+        <Filename Value="System.Math.pas"/>
+        <UnitName Value="System.Math"/>
+      </Item4>
+      <Item5>
+        <Filename Value="NodeApi.JS.pas"/>
+        <UnitName Value="NodeApi.JS"/>
+      </Item5>
+      <Item6>
+        <Filename Value="../src/objpas.pas"/>
+        <UnitName Value="ObjPas"/>
+      </Item6>
+      <Item7>
+        <Filename Value="System.RTLConsts.pas"/>
+        <UnitName Value="System.RTLConsts"/>
+      </Item7>
+      <Item8>
+        <Filename Value="../src/system.pas"/>
+        <AddToUsesPkgSection Value="False"/>
+        <UnitName Value="System"/>
+      </Item8>
+      <Item9>
+        <Filename Value="System.SysUtils.pas"/>
+        <UnitName Value="System.SysUtils"/>
+      </Item9>
+      <Item10>
+        <Filename Value="System.Types.pas"/>
+        <UnitName Value="System.Types"/>
+      </Item10>
+      <Item11>
+        <Filename Value="System.TypInfo.pas"/>
+        <UnitName Value="System.TypInfo"/>
+      </Item11>
+      <Item12>
+        <Filename Value="BrowserApi.Web.pas"/>
+        <UnitName Value="BrowserApi.Web"/>
+      </Item12>
+      <Item13>
+        <Filename Value="System.HotReload.pas"/>
+        <UnitName Value="System.HotReload"/>
+      </Item13>
+      <Item14>
+        <Filename Value="System.DateUtils.pas"/>
+        <UnitName Value="System.DateUtils"/>
+      </Item14>
+      <Item15>
+        <Filename Value="System.StrUtils.pas"/>
+        <UnitName Value="System.StrUtils"/>
+      </Item15>
+      <Item16>
+        <Filename Value="System.Contnrs.pas"/>
+        <UnitName Value="System.Contnrs"/>
+      </Item16>
+      <Item17>
+        <Filename Value="Browser.Console.pas"/>
+        <UnitName Value="Browser.Console"/>
+      </Item17>
+      <Item18>
+        <Filename Value="System.Router.pas"/>
+        <UnitName Value="System.Router"/>
+      </Item18>
+      <Item19>
+        <Filename Value="System.Rtti.pas"/>
+        <UnitName Value="System.Rtti"/>
+      </Item19>
+      <Item20>
+        <Filename Value="BrowserApi.WebGL.pas"/>
+        <UnitName Value="BrowserApi.WebGL"/>
+      </Item20>
+      <Item21>
+        <Filename Value="System.Class2Pas.pas"/>
+        <UnitName Value="System.Class2Pas"/>
+      </Item21>
+      <Item22>
+        <Filename Value="Api.JQuery.pas"/>
+        <UnitName Value="Api.JQuery"/>
+      </Item22>
+      <Item23>
+        <Filename Value="System.Timer.pas"/>
+        <UnitName Value="System.Timer"/>
+      </Item23>
+      <Item24>
+        <Filename Value="BrowserApi.Audio.pas"/>
+        <UnitName Value="BrowserApi.Audio"/>
+      </Item24>
+      <Item25>
+        <Filename Value="BrowserApi.BlueTooth.pas"/>
+        <UnitName Value="BrowserApi.BlueTooth"/>
+      </Item25>
+      <Item26>
+        <Filename Value="BrowserApi.SVG.pas"/>
+        <UnitName Value="BrowserApi.SVG"/>
+      </Item26>
+      <Item27>
+        <Filename Value="Browser.ScriptLoader.pas"/>
+        <UnitName Value="Browser.ScriptLoader"/>
+      </Item27>
+      <Item28>
+        <Filename Value="Browser.TemplateLoader.pas"/>
+        <UnitName Value="Browser.TemplateLoader"/>
+      </Item28>
+      <Item29>
+        <Filename Value="Browser.UnitLoader.pas"/>
+        <UnitName Value="Browser.UnitLoader"/>
+      </Item29>
+      <Item30>
+        <Filename Value="BrowserApi.RTC.pas"/>
+        <UnitName Value="BrowserApi.RTC"/>
+      </Item30>
+      <Item31>
+        <Filename Value="BrowserApi.WebAssembly.pas"/>
+        <UnitName Value="BrowserApi.WebAssembly"/>
+      </Item31>
+      <Item32>
+        <Filename Value="BrowserApi.WebOrWorker.pas"/>
+        <UnitName Value="BrowserApi.WebOrWorker"/>
+      </Item32>
+      <Item33>
+        <Filename Value="BrowserApi.Worker.pas"/>
+        <UnitName Value="BrowserApi.Worker"/>
+      </Item33>
+      <Item34>
+        <Filename Value="BrowserApi.LoadHelper.pas"/>
+        <UnitName Value="BrowserApi.LoadHelper"/>
+      </Item34>
+      <Item35>
+        <Filename Value="HTML.Actions.pas"/>
+        <UnitName Value="HTML.Actions"/>
+      </Item35>
+      <Item36>
+        <Filename Value="HTML.EventNames.pas"/>
+        <UnitName Value="HTML.EventNames"/>
+      </Item36>
+      <Item37>
+        <Filename Value="HTML.Translate.pas"/>
+        <UnitName Value="HTML.Translate"/>
+      </Item37>
+      <Item38>
+        <Filename Value="HTML.Utils.pas"/>
+        <UnitName Value="HTML.Utils"/>
+      </Item38>
+      <Item39>
+        <Filename Value="System.ArrayUtils.pas"/>
+        <UnitName Value="System.ArrayUtils"/>
+      </Item39>
+      <Item40>
+        <Filename Value="System.Generics.Collections.pas"/>
+        <UnitName Value="System.Generics.Collections"/>
+      </Item40>
+      <Item41>
+        <Filename Value="System.Generics.Defaults.pas"/>
+        <UnitName Value="System.Generics.Defaults"/>
+      </Item41>
+      <Item42>
+        <Filename Value="System.Generics.Strings.pas"/>
+        <UnitName Value="System.Generics.Strings"/>
+      </Item42>
+      <Item43>
+        <Filename Value="System.Res.pas"/>
+        <UnitName Value="System.Res"/>
+      </Item43>
+      <Item44>
+        <Filename Value="System.ResourceTranslate.pas"/>
+        <UnitName Value="System.ResourceTranslate"/>
+      </Item44>
+      <Item45>
+        <Filename Value="System.SimpleLinkedList.pas"/>
+        <UnitName Value="System.SimpleLinkedList"/>
+      </Item45>
+      <Item46>
+        <Filename Value="System.WebUtils.pas"/>
+        <UnitName Value="System.WebUtils"/>
+      </Item46>
+    </Files>
+    <CompatibilityMode Value="True"/>
+    <UsageOptions>
+      <CustomOptions Value="-dPas2js"/>
+      <UnitPath Value="$(PkgOutDir)"/>
+    </UsageOptions>
+    <PublishOptions>
+      <Version Value="2"/>
+    </PublishOptions>
+  </Package>
+</CONFIG>

+ 21 - 0
packages/rtl/namespaced/pas2js_rtl_namespaced.pas

@@ -0,0 +1,21 @@
+{ This file was automatically created by Lazarus. Do not edit!
+  This source is only used to compile and install the package.
+ }
+
+unit pas2js_rtl_namespaced;
+
+{$warn 5023 off : no warning about unused units}
+interface
+
+uses
+  System.Classes, JSApi.JS, System.Math, NodeApi.JS, ObjPas, System.RTLConsts, System.SysUtils, System.Types, System.TypInfo, 
+  BrowserApi.Web, System.HotReload, System.DateUtils, System.StrUtils, System.Contnrs, Browser.Console, System.Router, 
+  System.Rtti, BrowserApi.WebGL, System.Class2Pas, Api.JQuery, System.Timer, BrowserApi.Audio, BrowserApi.BlueTooth, 
+  BrowserApi.SVG, Browser.ScriptLoader, Browser.TemplateLoader, Browser.UnitLoader, BrowserApi.RTC, BrowserApi.WebAssembly, 
+  BrowserApi.WebOrWorker, BrowserApi.Worker, BrowserApi.LoadHelper, HTML.Actions, HTML.EventNames, HTML.Translate, HTML.Utils, 
+  System.ArrayUtils, System.Generics.Collections, System.Generics.Defaults, System.Generics.Strings, System.Res, 
+  System.ResourceTranslate, System.SimpleLinkedList, System.WebUtils;
+
+implementation
+
+end.

+ 0 - 17
packages/rtl/pas2js_rtl.pas

@@ -1,17 +0,0 @@
-{ This file was automatically created by Lazarus. Do not edit!
-  This source is only used to compile and install the package.
- }
-
-unit pas2js_rtl;
-
-{$warn 5023 off : no warning about unused units}
-interface
-
-uses
-  Classes, JS, Math, ObjPas, RTLConsts, SysUtils, Types, TypInfo, Web, 
-  hotreloadclient, DateUtils, strutils, contnrs, browserconsole, webrouter, 
-  RTTI, webgl;
-
-implementation
-
-end.

+ 20 - 0
packages/rtl/Rtl.BrowserLoadHelper.pas → packages/rtl/src/Rtl.BrowserLoadHelper.pas

@@ -1,11 +1,31 @@
+{
+    This file is part of the Pas2JS run time library.
+    Copyright (c) 2023 by Michael Van Canneyt
+    
+    Loader helper for TStringList, usable in the browser.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS}
 unit Rtl.BrowserLoadHelper;
 unit Rtl.BrowserLoadHelper;
+{$ENDIF}
 
 
 {$mode objfpc}
 {$mode objfpc}
 
 
 interface
 interface
 
 
 uses
 uses
+{$IFDEF FPC_DOTTEDUNITS}
+  System.Classes, System.SysUtils, JSApi.JS, BrowserApi.Web;
+{$ELSE}
   Classes, SysUtils, JS, Web;
   Classes, SysUtils, JS, Web;
+{$ENDIF}  
 
 
 Type
 Type
   { TBrowserLoadHelper }
   { TBrowserLoadHelper }

+ 27 - 61
packages/rtl/Rtl.HTMLActions.pas → packages/rtl/src/Rtl.HTMLActions.pas

@@ -1,4 +1,20 @@
+{
+    This file is part of the Pas2JS run time library.
+    Copyright (c) 2022 by Michael Van Canneyt
+    
+    Delphi TActionList-like implementation for the browser.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS}
 unit Rtl.HTMLActions;
 unit Rtl.HTMLActions;
+{$ENDIF}
 
 
 {$mode ObjFPC}
 {$mode ObjFPC}
 {$H+}
 {$H+}
@@ -6,19 +22,13 @@ unit Rtl.HTMLActions;
 interface
 interface
 
 
 uses
 uses
-  {$ifdef pas2js}
-  web,
-  {$endif}
-  RTL.HTMLEventNames, Classes, SysUtils, Rtl.HTMLUtils;
+{$IFDEF FPC_DOTTEDUNITS}
+  System.Classes, System.SysUtils, BrowserApi.Web, HTML.EventNames, HTML.Utils;
+{$ELSE}
+  web, RTL.HTMLEventNames, Classes, SysUtils, Rtl.HTMLUtils;
+{$ENDIF}
 
 
 Type
 Type
-   {$ifndef pas2js}
-   TJSEvent = Class(TObject);
-   TJSElement = class(TObject);
-   TJSHTMLElement = class(TJSElement);
-   TJSHTMLElementArray = array of TJSHTMLElement;
-
-   {$endif}
    THTMLNotifyEvent = Procedure (Sender : TObject; Event : TJSEvent) of object;
    THTMLNotifyEvent = Procedure (Sender : TObject; Event : TJSEvent) of object;
    THTMLCustomElementActionList = Class;
    THTMLCustomElementActionList = Class;
 
 
@@ -173,7 +183,12 @@ Type
 
 
 implementation
 implementation
 
 
-uses StrUtils;
+uses 
+{$IFDEF FPC_DOTTEDUNITS}
+  System.StrUtils;
+{$ELSE}
+  StrUtils;
+{$ENDIF}
 
 
 { ----------------------------------------------------------------------
 { ----------------------------------------------------------------------
   THTMLCustomElementActionList
   THTMLCustomElementActionList
@@ -606,14 +621,6 @@ begin
     Result:=inherited HasParent;
     Result:=inherited HasParent;
 end;
 end;
 
 
-{ ----------------------------------------------------------------------
-  The methods in this last part are either empty or implemented,
-  depending on whether the unit is used in FPC (IDE) or pas2js
-  ----------------------------------------------------------------------}
-
-
-{$ifdef pas2js}
-
 procedure THTMLCustomElementAction.BindElementEvents;
 procedure THTMLCustomElementAction.BindElementEvents;
 
 
 Var
 Var
@@ -737,46 +744,5 @@ begin
     end;
     end;
 end;
 end;
 
 
-{$else}
-
-procedure THTMLCustomElementAction.BindElementEvents;
-begin
-
-end;
-
-
-procedure THTMLCustomElementAction.Bind;
-begin
-
-end;
-
-procedure THTMLCustomElementAction.HandleEvent(Event: TJSEvent);
-begin
-
-end;
-
-procedure THTMLCustomElementAction.AddClass(const aClass: String);
-begin
-end;
-
-procedure THTMLCustomElementAction.RemoveClass(const aClass: String);
-begin
-
-end;
-
-procedure THTMLCustomElementAction.ToggleClass(const aClass: String);
-
-begin
-
-end;
-
-procedure THTMLCustomElementAction.BindEvents(aEl: TJSElement);
-
-begin
-
-end;
-
-{$endif}
-
 end.
 end.
 
 

+ 17 - 0
packages/rtl/Rtl.HTMLEventNames.pas → packages/rtl/src/Rtl.HTMLEventNames.pas

@@ -1,4 +1,21 @@
+{
+    This file is part of the Pas2JS run time library.
+    Copyright (c) 2017-2020 by the Pas2JS development team.
+
+    Browser Window & DOM event name definitions
+    
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{$IFNDEF FPC_DOTTEDUNITS}
 unit Rtl.HTMLEventNames;
 unit Rtl.HTMLEventNames;
+{$ENDIF}
 
 
 {$mode ObjFPC}
 {$mode ObjFPC}
 {$h+}
 {$h+}

+ 8 - 2
packages/rtl/Rtl.HTMLTranslate.pas → packages/rtl/src/Rtl.HTMLTranslate.pas

@@ -12,12 +12,18 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS} 
 unit Rtl.HTMLTranslate;
 unit Rtl.HTMLTranslate;
+{$ENDIF}
 
 
 interface
 interface
 
 
-Uses SysUtils, JS, Web, Classes, Rtl.HTMLUtils;
-
+Uses 
+{$IFDEF FPC_DOTTEDUNITS}
+  System.SysUtils, JSApi.JS, BrowserApi.Web, System.Classes, HTML.Utils;
+{$ELSE}  
+  SysUtils, JS, Web, Classes, Rtl.HTMLUtils;
+{$ENDIF}
 (* Language data is a JSON object structure. 
 (* Language data is a JSON object structure. 
 
 
   2 file-based formats are supported (see LanguageSource):
   2 file-based formats are supported (see LanguageSource):

+ 8 - 2
packages/rtl/Rtl.HTMLUtils.pas → packages/rtl/src/Rtl.HTMLUtils.pas

@@ -12,12 +12,18 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS}
 unit Rtl.HTMLUtils;
 unit Rtl.HTMLUtils;
+{$ENDIF}
 
 
 interface
 interface
 
 
-uses JS, Web, SysUtils, DateUtils, Types;
-
+uses 
+{$IFDEF FPC_DOTTEDUNITS}
+  JSApi.JS, BrowserApi.Web, System.SysUtils, System.DateUtils, System.Types;
+{$ELSE}
+  JS, Web, SysUtils, DateUtils, Types;
+{$ENDIF}
 Type
 Type
   IHTMLClient = Interface ['{984EDD58-4F93-40BA-A757-06AC293D11F9}']
   IHTMLClient = Interface ['{984EDD58-4F93-40BA-A757-06AC293D11F9}']
     Procedure HTMLLoaded;
     Procedure HTMLLoaded;

+ 28 - 2
packages/rtl/Rtl.ScriptLoader.pas → packages/rtl/src/Rtl.ScriptLoader.pas

@@ -1,8 +1,29 @@
+{
+    This file is part of the Pas2JS run time library.
+    Copyright (c) 2019 by Michael Van Canneyt
+
+    This unit implements a HTML script tag loader.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS}
 unit Rtl.ScriptLoader;
 unit Rtl.ScriptLoader;
+{$ENDIF}
 
 
 interface
 interface
 
 
-uses types;
+uses
+{$IFDEF FPC_DOTTEDUNITS}
+  System.Types;
+{$ELSE} 
+  Types;
+{$ENDIF}
 
 
 Type
 Type
   TloadedCallBack = Reference to procedure(Data : TObject);
   TloadedCallBack = Reference to procedure(Data : TObject);
@@ -12,7 +33,12 @@ Procedure loadScripts(scripts : TStringDynArray; callback : TLoadedCallback; Dat
 
 
 implementation
 implementation
 
 
-uses js, web;
+Uses
+{$IFDEF FPC_DOTTEDUNITS}
+  JSApi.JS, BrowserApi.Web;
+{$ELSE}
+  js, web;
+{$ENDIF}
 
 
 Procedure loadScripts(scripts : TStringDynArray; callback : TLoadedCallback; Data : TObject);
 Procedure loadScripts(scripts : TStringDynArray; callback : TLoadedCallback; Data : TObject);
 
 

+ 12 - 1
packages/rtl/Rtl.TemplateLoader.pas → packages/rtl/src/Rtl.TemplateLoader.pas

@@ -12,14 +12,20 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS}
 unit Rtl.TemplateLoader;
 unit Rtl.TemplateLoader;
+{$ENDIF}
 
 
 {$mode objfpc}
 {$mode objfpc}
 
 
 interface
 interface
 
 
 uses
 uses
+{$IFDEF FPC_DOTTEDUNITS}
+  System.Classes, System.SysUtils, JSApi.JS, BrowserApi.Web;
+{$ELSE}
   Classes, SysUtils, JS, web;
   Classes, SysUtils, JS, web;
+{$ENDIF}  
 
 
 Type
 Type
    TFailData = Record
    TFailData = Record
@@ -128,7 +134,12 @@ Function GlobalTemplates : TCustomTemplateLoader;
 
 
 implementation
 implementation
 
 
-uses p2jsres, rtlconsts;
+Uses
+{$IFDEF FPC_DOTTEDUNITS}
+   System.Res, System.RTLConsts;
+{$ELSE}
+   p2jsres, rtlconsts;
+{$ENDIF}
 
 
 { TCustomTemplateLoader }
 { TCustomTemplateLoader }
 
 

+ 29 - 3
packages/rtl/Rtl.UnitLoader.pas → packages/rtl/src/Rtl.UnitLoader.pas

@@ -1,10 +1,30 @@
+{
+    This file is part of the Pas2JS run time library.
+    Copyright (c) 2019 by Michael Van Canneyt
+
+    This unit implements a Pascal unit loader for the browser.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS}
 unit Rtl.UnitLoader;
 unit Rtl.UnitLoader;
+{$ENDIF}
 
 
 interface
 interface
 { $define DEBUGUNITLOADER}
 { $define DEBUGUNITLOADER}
 
 
-uses SysUtils, JS, Types;
-
+uses 
+{$IFDEF FPC_DOTTEDUNITS}
+  System.SysUtils, JSApi.JS, System.Types;
+{$ELSE}
+  SysUtils, JS, Types;
+{$ENDIF}
 Type
 Type
   EUnitLoader = Class(Exception);
   EUnitLoader = Class(Exception);
 
 
@@ -63,7 +83,13 @@ Type
  
  
 Implementation
 Implementation
 
 
-uses Rtl.ScriptLoader;
+Uses
+{$IFDEF FPC_DOTTEDUNITS}
+   Rtl.ScriptLoader;
+{$ELSE}
+   Browser.ScriptLoader;
+{$ENDIF}
+
 
 
 function IndexOfI(arr: TStringDynArray; Name: string): integer;
 function IndexOfI(arr: TStringDynArray; Name: string): integer;
 begin
 begin

+ 20 - 0
packages/rtl/arrayutils.pas → packages/rtl/src/arrayutils.pas

@@ -1,4 +1,20 @@
+{
+    This file is part of the Pas2JS run time library.
+    Copyright (c) 2022 by Michael Van Canneyt
+    
+    Simple TBytes/TWords helpers
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS}
 unit arrayutils;
 unit arrayutils;
+{$ENDIF}
 
 
 {$mode objfpc}
 {$mode objfpc}
 {$modeswitch typehelpers}
 {$modeswitch typehelpers}
@@ -6,7 +22,11 @@ unit arrayutils;
 interface
 interface
 
 
 uses
 uses
+{$IFDEF FPC_DOTTEDUNITS}
+  System.Types, System.SysUtils;
+{$ELSE}
   Types, SysUtils;
   Types, SysUtils;
+{$ENDIF}  
 
 
 Type
 Type
   TBytesHelper = type helper for TBytes
   TBytesHelper = type helper for TBytes

+ 7 - 0
packages/rtl/browserconsole.pas → packages/rtl/src/browserconsole.pas

@@ -19,14 +19,21 @@
   You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free
   You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free
   Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1335, USA.
   Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1335, USA.
 }
 }
+{$IFNDEF FPC_DOTTEDUNITS}
 unit browserconsole;
 unit browserconsole;
+{$ENDIF}
 
 
 {$mode objfpc}
 {$mode objfpc}
 
 
 interface
 interface
 
 
 uses
 uses
+{$IFDEF FPC_DOTTEDUNITS}
+  JSApi.JS, BrowserApi.Web, BrowserApi.LoadHelper, System.SysUtils;
+{$ELSE}
   js, web, Rtl.BrowserLoadHelper,sysutils;
   js, web, Rtl.BrowserLoadHelper,sysutils;
+{$ENDIF}
+
 
 
 Const
 Const
   BrowserLineBreak = #10;
   BrowserLineBreak = #10;

+ 7 - 1
packages/rtl/class2pas.pas → packages/rtl/src/class2pas.pas

@@ -10,14 +10,20 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS}
 unit class2pas;
 unit class2pas;
+{$ENDIF}
 
 
 {$mode objfpc}{$H+}
 {$mode objfpc}{$H+}
 
 
 interface
 interface
-
 uses
 uses
+
+{$IFDEF FPC_DOTTEDUNITS}
+  System.Classes, System.SysUtils, System.Types, JSApi.JS;
+{$ELSE}
   Classes, SysUtils, Types, JS;
   Classes, SysUtils, Types, JS;
+{$ENDIF}  
 
 
 function ClassToPas(Const aName : string; Obj: TJSObject; aAncestor : string = ''; recurse : Boolean = False): string; overload;
 function ClassToPas(Const aName : string; Obj: TJSObject; aAncestor : string = ''; recurse : Boolean = False): string; overload;
 function ClassToPas(Const aJSName,aPascalName : string; Obj: TJSObject; aAncestor : string = ''; recurse : Boolean = False): string; overload;
 function ClassToPas(Const aJSName,aPascalName : string; Obj: TJSObject; aAncestor : string = ''; recurse : Boolean = False): string; overload;

+ 16 - 6
packages/rtl/classes.pas → packages/rtl/src/classes.pas

@@ -10,14 +10,20 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS}
 unit Classes;
 unit Classes;
+{$ENDIF}
 
 
 {$mode objfpc}
 {$mode objfpc}
 
 
 interface
 interface
 
 
 uses
 uses
+{$IFDEF FPC_DOTTEDUNITS}
+  System.RTLConsts, System.Types, System.SysUtils, JSApi.JS, System.TypInfo, System.Res;
+{$ELSE}
   RTLConsts, Types, SysUtils, JS, TypInfo, p2jsres;
   RTLConsts, Types, SysUtils, JS, TypInfo, p2jsres;
+{$ENDIF}  
 
 
 type
 type
   TNotifyEvent = procedure(Sender: TObject) of object;
   TNotifyEvent = procedure(Sender: TObject) of object;
@@ -49,8 +55,8 @@ type
   TListAssignOp = (laCopy, laAnd, laOr, laXor, laSrcUnique, laDestUnique);
   TListAssignOp = (laCopy, laAnd, laOr, laXor, laSrcUnique, laDestUnique);
   TListSortCompare = function(Item1, Item2: JSValue): Integer;
   TListSortCompare = function(Item1, Item2: JSValue): Integer;
   TListSortCompareFunc = reference to function (Item1, Item2: JSValue): Integer;
   TListSortCompareFunc = reference to function (Item1, Item2: JSValue): Integer;
-  TListCallback = Types.TListCallback;
-  TListStaticCallback = Types.TListStaticCallback;
+  TListCallback = {$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}Types.TListCallback;
+  TListStaticCallback = {$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}Types.TListStaticCallback;
   TAlignment = (taLeftJustify, taRightJustify, taCenter);
   TAlignment = (taLeftJustify, taRightJustify, taCenter);
 
 
   // Forward class definitions
   // Forward class definitions
@@ -1546,7 +1552,11 @@ Const
 
 
 implementation
 implementation
 
 
+{$IFDEF FPC_DOTTEDUNITS}
+uses System.SimpleLinkedList;
+{$ELSE}
 uses simplelinkedlist;
 uses simplelinkedlist;
+{$ENDIF}
 
 
 var
 var
   GlobalLoaded,
   GlobalLoaded,
@@ -10637,7 +10647,7 @@ begin
       else break;
       else break;
     end;
     end;
   end;
   end;
-  fToken:=Classes.toString
+  fToken:=TParserToken.toString
 end;
 end;
 
 
 procedure TParser.HandleMinus;
 procedure TParser.HandleMinus;
@@ -10920,8 +10930,8 @@ begin
   while parser.NextToken = toPlus do
   while parser.NextToken = toPlus do
     begin
     begin
     parser.NextToken;   // Get next string fragment
     parser.NextToken;   // Get next string fragment
-    if not (parser.Token=Classes.toString) then
-      parser.CheckToken(Classes.toString);
+    if not (parser.Token=TParserToken.toString) then
+      parser.CheckToken(TParserToken.toString);
     ws:=ws+parser.TokenString;
     ws:=ws+parser.TokenString;
     end;
     end;
   Output.WriteByte(Ord(vaWstring));
   Output.WriteByte(Ord(vaWstring));
@@ -10947,7 +10957,7 @@ begin
         WriteDouble(flt);
         WriteDouble(flt);
         parser.NextToken;
         parser.NextToken;
       end;
       end;
-    classes.toString:
+    TParserToken.toString:
       ProcessWideString('');
       ProcessWideString('');
     toSymbol:
     toSymbol:
       begin
       begin

+ 10 - 1
packages/rtl/contnrs.pas → packages/rtl/src/contnrs.pas

@@ -11,13 +11,18 @@
 
 
  **********************************************************************}
  **********************************************************************}
 {$mode objfpc}
 {$mode objfpc}
-
+{$IFNDEF FPC_DOTTEDUNITS}
 unit contnrs;
 unit contnrs;
+{$ENDIF}
 
 
 interface
 interface
 
 
 uses
 uses
+{$IFDEF FPC_DOTTEDUNITS}
+  System.SysUtils, System.Classes;
+{$ELSE}
   SysUtils, Classes;
   SysUtils, Classes;
+{$ENDIF}
 
 
 
 
 Type
 Type
@@ -438,7 +443,11 @@ Type
 implementation
 implementation
 
 
 uses
 uses
+{$IFDEF FPC_DOTTEDUNITS}
+  JSApi.JS;
+{$ELSE}
   js;
   js;
+{$ENDIF}
 
 
 ResourceString
 ResourceString
   DuplicateMsg   = 'An item with key %0:s already exists';
   DuplicateMsg   = 'An item with key %0:s already exists';

+ 12 - 3
packages/rtl/dateutils.pas → packages/rtl/src/dateutils.pas

@@ -1,5 +1,4 @@
 {$mode objfpc}
 {$mode objfpc}
-
 {
 {
     This file is part of the Free Pascal run time library.
     This file is part of the Free Pascal run time library.
     Copyright (c) 2018 by the Free Pascal development team
     Copyright (c) 2018 by the Free Pascal development team
@@ -14,13 +13,18 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
-
+{$IFNDEF FPC_DOTTEDUNITS}
 unit DateUtils;
 unit DateUtils;
+{$ENDIF}
 
 
 interface
 interface
 
 
 uses
 uses
+{$IFDEF FPC_DOTTEDUNITS}
+  System.SysUtils, System.Math;
+{$ELSE}
   SysUtils, Math;
   SysUtils, Math;
+{$ENDIF}  
 
 
 { ---------------------------------------------------------------------
 { ---------------------------------------------------------------------
     Various constants
     Various constants
@@ -507,7 +511,12 @@ Function ScanDateTime(APattern,AValue: String; APos : integer = 1) : TDateTime;
 
 
 implementation
 implementation
 
 
-uses  rtlconsts;
+uses
+{$IFDEF FPC_DOTTEDUNITS}
+  System.RTLConsts;
+{$ELSE}
+  rtlconsts;
+{$ENDIF}  
 
 
 const
 const
   TDateTimeEpsilon = 2.2204460493e-16;
   TDateTimeEpsilon = 2.2204460493e-16;

+ 23 - 0
packages/rtl/generics.collections.pas → packages/rtl/src/generics.collections.pas

@@ -1,4 +1,21 @@
+{
+    This file is part of the Pas2JS run time library.
+    Copyright (c) 2023 by Michael Van Canneyt
+      
+    Delphi-compatible generics implementations.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{$IFNDEF FPC_DOTTEDUNITS}
 unit Generics.Collections;
 unit Generics.Collections;
+{$ENDIF}
 
 
 {$Mode Delphi}
 {$Mode Delphi}
 {$COperators On}
 {$COperators On}
@@ -6,9 +23,15 @@ unit Generics.Collections;
 interface
 interface
 
 
 uses
 uses
+{$IFDEF FPC_DOTTEDUNITS}
+  System.Classes, System.SysUtils, System.RTLConsts, System.Types,
+  {$IFDEF Pas2js}JSApi.JS,{$ENDIF}
+  System.Generics.Strings, System.Generics.Defaults;
+{$ELSE FPC_DOTTEDUNITS}
   Classes, SysUtils, rtlconsts, Types,
   Classes, SysUtils, rtlconsts, Types,
   {$IFDEF Pas2js}JS,{$ENDIF}
   {$IFDEF Pas2js}JS,{$ENDIF}
   Generics.Strings, Generics.Defaults;
   Generics.Strings, Generics.Defaults;
+{$ENDIF}
 
 
 type
 type
   TCollectionNotification = (cnAdded, cnRemoved, cnExtracted);
   TCollectionNotification = (cnAdded, cnRemoved, cnExtracted);

+ 17 - 0
packages/rtl/generics.defaults.pas → packages/rtl/src/generics.defaults.pas

@@ -1,4 +1,21 @@
+{
+    This file is part of the Pas2JS run time library.
+    Copyright (c) 2023 by Michael Van Canneyt
+      
+    Delphi-compatible generics helpers implementations.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{$IFNDEF FPC_DOTTEDUNITS}
 unit Generics.Defaults;
 unit Generics.Defaults;
+{$ENDIF}
 
 
 {$MODE DELPHI}
 {$MODE DELPHI}
 
 

+ 35 - 0
packages/rtl/src/generics.strings.pas

@@ -0,0 +1,35 @@
+{
+    This file is part of the Pas2JS run time library.
+    Copyright (c) 2023 by Michael Van Canneyt
+      
+    Delphi-compatible generics string constansts
+    
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS}
+unit Generics.Strings;
+{$ENDIF}
+
+{$Mode Delphi}
+
+interface
+
+resourcestring
+  SArgumentOutOfRange = 'Argument out of range';
+  //SArgumentNilNode = 'Node is nil';
+  //SDuplicatesNotAllowed = 'Duplicates not allowed in dictionary';
+  //SCollectionInconsistency = 'Collection inconsistency';
+  //SCollectionDuplicate = 'Collection does not allow duplicates';
+  //SDictionaryKeyDoesNotExist = 'Dictionary key does not exist';
+  //SItemNotFound = 'Item not found';
+
+implementation
+
+end.
+

+ 22 - 1
packages/rtl/hotreloadclient.pas → packages/rtl/src/hotreloadclient.pas

@@ -1,10 +1,31 @@
+{
+    This file is part of the Pas2JS run time library.
+    Copyright (c) 2022 by Michael Van Canneyt
+    
+    Hot-reload Client API for compileserver.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS}
 unit hotreloadclient;
 unit hotreloadclient;
+{$ENDIF}
 
 
 {$mode objfpc}
 {$mode objfpc}
 
 
 interface
 interface
 
 
-uses sysutils, types, js, web;
+uses 
+{$IFDEF FPC_DOTTEDUNITS}
+  System.SysUtils, System.Types, JSApi.JS, BrowserApi.Web;
+{$ELSE}
+  sysutils, types, js, web;
+{$ENDIF}
 
 
 Type
 Type
 
 

+ 6 - 0
packages/rtl/js.pas → packages/rtl/src/js.pas

@@ -10,7 +10,9 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS}
 unit JS;
 unit JS;
+{$ENDIF}
 
 
 {$mode objfpc}
 {$mode objfpc}
 {$modeswitch externalclass}
 {$modeswitch externalclass}
@@ -18,7 +20,11 @@ unit JS;
 interface
 interface
 
 
 uses
 uses
+{$IFDEF FPC_DOTTEDUNITS}
+  System.Types;
+{$ELSE}
   Types;
   Types;
+{$ENDIF}
 
 
 type
 type
   // We cannot use EConvertError or Exception, this would result in a circular dependency.
   // We cannot use EConvertError or Exception, this would result in a circular dependency.

+ 23 - 1
packages/rtl/libjquery.pas → packages/rtl/src/libjquery.pas

@@ -1,11 +1,33 @@
+{
+    This file is part of the Pas2JS run time library.
+    Copyright (c) 2023 by Michael Van Canneyt
+    
+    JQuery API definition
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{$IFNDEF FPC_DOTTEDUNITS}
 unit libjquery;
 unit libjquery;
+{$ENDIF}
 
 
 {$mode objfpc}
 {$mode objfpc}
 {$modeswitch externalclass}
 {$modeswitch externalclass}
 
 
 interface
 interface
 
 
-uses js, web;
+uses 
+{$IFDEF FPC_DOTTEDUNITS}
+  JSApi.JS, BrowserApi.Web;
+{$ELSE}
+  js, web;
+{$ENDIF}
 
 
 Type
 Type
   TJQueryTopLeft = record
   TJQueryTopLeft = record

+ 3 - 1
packages/rtl/math.pas → packages/rtl/src/math.pas

@@ -9,8 +9,10 @@
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
- **********************************************************************}
+ **********************************************************************} 
+{$IFNDEF FPC_DOTTEDUNITS}
 unit Math;
 unit Math;
+{$ENDIF}
 
 
 {$mode objfpc}
 {$mode objfpc}
 
 

+ 21 - 0
packages/rtl/node.events.pas → packages/rtl/src/node.events.pas

@@ -1,4 +1,21 @@
+{
+    This file is part of the Pas2JS run time library.
+    Copyright (c) 2023 by Michael Van Canneyt
+    
+    Node.JS Event API definition; also usable in the browser
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{$IFNDEF FPC_DOTTEDUNITS}
 unit node.events;
 unit node.events;
+{$ENDIF}
 
 
 {$mode objfpc}
 {$mode objfpc}
 {$ModeSwitch externalclass}
 {$ModeSwitch externalclass}
@@ -6,7 +23,11 @@ unit node.events;
 interface
 interface
 
 
 uses
 uses
+{$IFDEF FPC_DOTTEDUNITS}
+  JSApi.JS;
+{$ELSE}
   JS;
   JS;
+{$ENDIF}  
 
 
 Type
 Type
   TNJSEventEmitterHandler = reference to procedure(arg : JSValue);
   TNJSEventEmitterHandler = reference to procedure(arg : JSValue);

+ 11 - 5
packages/rtl/nodejs.pas → packages/rtl/src/nodejs.pas

@@ -10,7 +10,9 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS}
 unit NodeJS;
 unit NodeJS;
+{$ENDIF}
 
 
 {$mode objfpc}
 {$mode objfpc}
 {$ModeSwitch externalclass}
 {$ModeSwitch externalclass}
@@ -18,7 +20,11 @@ unit NodeJS;
 interface
 interface
 
 
 uses
 uses
-  JS, Types, node.events;
+{$IFDEF FPC_DOTTEDUNITS}
+  JSApi.JS, System.Types, NodeApi.events;
+{$ELSE}
+  JS, Types, Node.Events;
+{$ENDIF}
 
 
 type
 type
 
 
@@ -250,10 +256,10 @@ type
     procedure warn(const Obj1 : JSValue); varargs;
     procedure warn(const Obj1 : JSValue); varargs;
   end;
   end;
 
 
-  TNJSEventEmitterHandler = node.events.TNJSEventEmitterHandler;
-  TNJSEventEmitterHandlerArray = node.events.TNJSEventEmitterHandlerArray;
-  TNJSEventEmitter = node.events.TNJSEventEmitter;
-  TNJSEvents = node.events.TNJSEventEmitter;
+  TNJSEventEmitterHandler = {$IFDEF FPC_DOTTEDUNITS}NodeApi.Events{$ELSE}node.events{$ENDIF}.TNJSEventEmitterHandler;
+  TNJSEventEmitterHandlerArray = {$IFDEF FPC_DOTTEDUNITS}NodeApi.Events{$ELSE}node.events{$ENDIF}.TNJSEventEmitterHandlerArray;
+  TNJSEventEmitter = {$IFDEF FPC_DOTTEDUNITS}NodeApi.Events{$ELSE}node.events{$ENDIF}.TNJSEventEmitter;
+  TNJSEvents = {$IFDEF FPC_DOTTEDUNITS}NodeApi.Events{$ELSE}node.events{$ENDIF}.TNJSEventEmitter;
 
 
   TNJSTimerCallBack = reference to procedure;
   TNJSTimerCallBack = reference to procedure;
 
 

+ 0 - 0
packages/rtl/objpas.pas → packages/rtl/src/objpas.pas


+ 26 - 1
packages/rtl/p2jsres.pp → packages/rtl/src/p2jsres.pp

@@ -1,4 +1,20 @@
+{
+    This file is part of the Pas2JS run time library.
+    Copyright (c) 2023 by Michael Van Canneyt
+    
+    Low-level Pas2JS resource handling.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS}
 unit p2jsres;
 unit p2jsres;
+{$ENDIF}
 
 
 {$mode objfpc}
 {$mode objfpc}
 {$h+}
 {$h+}
@@ -6,7 +22,11 @@ unit p2jsres;
 
 
 interface
 interface
 
 
+{$IFDEF FPC_DOTTEDUNITS}
 uses types;
 uses types;
+{$ELSE}
+uses System.Types;
+{$ENDIF}
 
 
 Type
 Type
   TResourceSource = (rsJS,rsHTML);
   TResourceSource = (rsJS,rsHTML);
@@ -36,7 +56,12 @@ Procedure LoadHTMLLinkResources(const aURL : String; OnLoad : TResourcesLoadedEn
 
 
 implementation
 implementation
 
 
-uses sysutils, js, web;
+Uses
+{$IFDEF FPC_DOTTEDUNITS}
+ System.SysUtils, JSApi.JS, BrowserApi.Web;
+{$ELSE}
+ sysutils, js, web;
+{$ENDIF}
 
 
 var
 var
   gMode: TResourceSource;
   gMode: TResourceSource;

+ 68 - 4
packages/rtl/pas2js_rtl.lpk → packages/rtl/src/pas2js_rtl.lpk

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
 <CONFIG>
 <CONFIG>
-  <Package Version="4">
+  <Package Version="5">
     <Name Value="pas2js_rtl"/>
     <Name Value="pas2js_rtl"/>
     <Type Value="RunTimeOnly"/>
     <Type Value="RunTimeOnly"/>
     <Author Value="Mattias Gaertner"/>
     <Author Value="Mattias Gaertner"/>
@@ -13,8 +13,8 @@
       <Parsing>
       <Parsing>
         <SyntaxOptions>
         <SyntaxOptions>
           <AllowLabel Value="False"/>
           <AllowLabel Value="False"/>
-          <CPPInline Value="False"/>
           <UseAnsiStrings Value="False"/>
           <UseAnsiStrings Value="False"/>
+          <CPPInline Value="False"/>
         </SyntaxOptions>
         </SyntaxOptions>
       </Parsing>
       </Parsing>
       <CodeGeneration>
       <CodeGeneration>
@@ -40,9 +40,10 @@
     <Description Value="pas2js RTL - Run Time Library"/>
     <Description Value="pas2js RTL - Run Time Library"/>
     <License Value="Modified LGPL2 as the FPC packages."/>
     <License Value="Modified LGPL2 as the FPC packages."/>
     <Version Major="1"/>
     <Version Major="1"/>
-    <Files Count="26">
+    <Files Count="42">
       <Item1>
       <Item1>
         <HasRegisterProc Value="True"/>
         <HasRegisterProc Value="True"/>
+        <AddToUsesPkgSection Value="False"/>
       </Item1>
       </Item1>
       <Item2>
       <Item2>
         <Filename Value="classes.pas"/>
         <Filename Value="classes.pas"/>
@@ -58,7 +59,6 @@
       </Item4>
       </Item4>
       <Item5>
       <Item5>
         <Filename Value="nodejs.pas"/>
         <Filename Value="nodejs.pas"/>
-        <AddToUsesPkgSection Value="False"/>
         <UnitName Value="NodeJS"/>
         <UnitName Value="NodeJS"/>
       </Item5>
       </Item5>
       <Item6>
       <Item6>
@@ -146,7 +146,71 @@
         <Filename Value="websvg.pas"/>
         <Filename Value="websvg.pas"/>
         <UnitName Value="websvg"/>
         <UnitName Value="websvg"/>
       </Item26>
       </Item26>
+      <Item27>
+        <Filename Value="generics.collections.pas"/>
+        <AddToUsesPkgSection Value="False"/>
+      </Item27>
+      <Item28>
+        <Filename Value="generics.defaults.pas"/>
+        <AddToUsesPkgSection Value="False"/>
+      </Item28>
+      <Item29>
+        <Filename Value="generics.strings.pas"/>
+        <AddToUsesPkgSection Value="False"/>
+      </Item29>
+      <Item30>
+        <Filename Value="rstranslate.pp"/>
+        <AddToUsesPkgSection Value="False"/>
+      </Item30>
+      <Item31>
+        <Filename Value="Rtl.BrowserLoadHelper.pas"/>
+      </Item31>
+      <Item32>
+        <Filename Value="Rtl.HTMLActions.pas"/>
+        <AddToUsesPkgSection Value="False"/>
+      </Item32>
+      <Item33>
+        <Filename Value="Rtl.HTMLEventNames.pas"/>
+        <AddToUsesPkgSection Value="False"/>
+      </Item33>
+      <Item34>
+        <Filename Value="Rtl.HTMLTranslate.pas"/>
+        <AddToUsesPkgSection Value="False"/>
+      </Item34>
+      <Item35>
+        <Filename Value="Rtl.HTMLUtils.pas"/>
+        <AddToUsesPkgSection Value="False"/>
+      </Item35>
+      <Item36>
+        <Filename Value="Rtl.ScriptLoader.pas"/>
+        <AddToUsesPkgSection Value="False"/>
+      </Item36>
+      <Item37>
+        <Filename Value="Rtl.TemplateLoader.pas"/>
+        <AddToUsesPkgSection Value="False"/>
+      </Item37>
+      <Item38>
+        <Filename Value="Rtl.UnitLoader.pas"/>
+        <AddToUsesPkgSection Value="False"/>
+      </Item38>
+      <Item39>
+        <Filename Value="webassembly.pas"/>
+        <AddToUsesPkgSection Value="False"/>
+      </Item39>
+      <Item40>
+        <Filename Value="webrtc.pas"/>
+        <AddToUsesPkgSection Value="False"/>
+      </Item40>
+      <Item41>
+        <Filename Value="webutils.pas"/>
+        <AddToUsesPkgSection Value="False"/>
+      </Item41>
+      <Item42>
+        <Filename Value="webworker.pas"/>
+        <AddToUsesPkgSection Value="False"/>
+      </Item42>
     </Files>
     </Files>
+    <CompatibilityMode Value="True"/>
     <UsageOptions>
     <UsageOptions>
       <CustomOptions Value="-dPas2js"/>
       <CustomOptions Value="-dPas2js"/>
       <UnitPath Value="$(PkgOutDir)"/>
       <UnitPath Value="$(PkgOutDir)"/>

+ 16 - 0
packages/rtl/src/pas2js_rtl.pas

@@ -0,0 +1,16 @@
+{ This file was automatically created by Lazarus. Do not edit!
+  This source is only used to compile and install the package.
+ }
+
+unit pas2js_rtl;
+
+{$warn 5023 off : no warning about unused units}
+interface
+
+uses
+  Classes, JS, Math, NodeJS, ObjPas, RTLConsts, SysUtils, Types, TypInfo, Web, hotreloadclient, DateUtils, strutils, contnrs, 
+  browserconsole, webrouter, RTTI, webgl, class2pas, libjquery, timer, webaudio, webbluetooth, websvg, Rtl.BrowserLoadHelper;
+
+implementation
+
+end.

+ 6 - 1
packages/rtl/rstranslate.pp → packages/rtl/src/rstranslate.pp

@@ -10,15 +10,20 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************} 
  **********************************************************************} 
+{$IFNDEF FPC_DOTTEDUNITS}
 unit rstranslate;
 unit rstranslate;
+{$ENDIF}
 
 
 {$mode objfpc}
 {$mode objfpc}
 
 
 interface
 interface
 
 
 uses
 uses
+{$IFNDEF FPC_DOTTEDUNITS}
+  System.SysUtils, JSApi.JS, BrowserApi.Web;
+{$ELSE}
   SysUtils, JS, web;
   SysUtils, JS, web;
-
+{$ENDIF}
 Type
 Type
 
 
   { TResourceTranslator }
   { TResourceTranslator }

+ 21 - 0
packages/rtl/rtl.webthreads.pas → packages/rtl/src/rtl.webthreads.pas

@@ -1,4 +1,21 @@
+{
+    This file is part of the Pas2JS run time library.
+    Copyright (c) 2017-2020 by the Pas2JS development team.
+
+    Threads API for Browser Window & Worker
+    
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{$IFNDEF FPC_DOTTEDUNITS}
 unit Rtl.WebThreads;
 unit Rtl.WebThreads;
+{$ENDIF}
 
 
 {$mode ObjFPC}
 {$mode ObjFPC}
 {$modeswitch externalclass}
 {$modeswitch externalclass}
@@ -6,7 +23,11 @@ unit Rtl.WebThreads;
 interface
 interface
 
 
 uses
 uses
+{$IFDEF FPC_DOTTEDUNITS}
+  JSApi.JS, System.SysUtils, System.WasiEnv, BrowserApi.WebAssembly;
+{$ELSE}
   JS, SysUtils, wasienv, webassembly;
   JS, SysUtils, wasienv, webassembly;
+{$ENDIF}  
 
 
 Const
 Const
   // Each thread starts spawning at 1000*IndexOfWorker
   // Each thread starts spawning at 1000*IndexOfWorker

+ 2 - 0
packages/rtl/rtlconsts.pas → packages/rtl/src/rtlconsts.pas

@@ -10,7 +10,9 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS}
 unit RTLConsts;
 unit RTLConsts;
+{$ENDIF}
 
 
 interface
 interface
 
 

+ 16 - 10
packages/rtl/rtti.pas → packages/rtl/src/rtti.pas

@@ -10,7 +10,9 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS}
 unit RTTI;
 unit RTTI;
+{$ENDIF}
 
 
 {$mode objfpc}
 {$mode objfpc}
 {$ModeSwitch advancedrecords}
 {$ModeSwitch advancedrecords}
@@ -18,7 +20,11 @@ unit RTTI;
 interface
 interface
 
 
 uses
 uses
+{$IFDEF FPC_DOTTEDUNITS}
+  JSApi.JS, System.RTLConsts, System.Types, System.SysUtils, System.TypInfo;
+{$ELSE}
   JS, RTLConsts, Types, SysUtils, TypInfo;
   JS, RTLConsts, Types, SysUtils, TypInfo;
+{$ENDIF}  
 
 
 resourcestring
 resourcestring
   SErrInvokeInvalidCodeAddr = 'CodeAddress is not a function';
   SErrInvokeInvalidCodeAddr = 'CodeAddress is not a function';
@@ -932,7 +938,7 @@ var
 begin
 begin
   case jsTypeOf(v) of
   case jsTypeOf(v) of
     'number':
     'number':
-      if JS.isInteger(v) then
+      if {$IFDEF FPC_DOTTEDUNITS}JSApi.{$ENDIF}JS.isInteger(v) then
         begin
         begin
         i:=NativeInt(v);
         i:=NativeInt(v);
         if (i>=low(integer)) and (i<=high(integer)) then
         if (i>=low(integer)) and (i<=high(integer)) then
@@ -947,9 +953,9 @@ begin
     'object':
     'object':
       if v=nil then
       if v=nil then
         Exit(TValue.Empty)
         Exit(TValue.Empty)
-      else if JS.isClass(v) and JS.isExt(v,TObject) then
+      else if {$IFDEF FPC_DOTTEDUNITS}JSApi.{$ENDIF}JS.isClass(v) and {$IFDEF FPC_DOTTEDUNITS}JSApi.{$ENDIF}JS.isExt(v,TObject) then
         TypeOfValue:=System.TypeInfo(TClass(v))
         TypeOfValue:=System.TypeInfo(TClass(v))
-      else if JS.isObject(v) and JS.isExt(v,TObject) then
+      else if {$IFDEF FPC_DOTTEDUNITS}JSApi.{$ENDIF}JS.isObject(v) and {$IFDEF FPC_DOTTEDUNITS}JSApi.{$ENDIF}JS.isExt(v,TObject) then
         TypeOfValue:=System.TypeInfo(TObject(v))
         TypeOfValue:=System.TypeInfo(TObject(v))
       else if isRecord(v) then
       else if isRecord(v) then
         TypeOfValue:=System.TypeInfo(TObject(v))
         TypeOfValue:=System.TypeInfo(TObject(v))
@@ -1007,7 +1013,7 @@ end;
 
 
 function TValue.AsObject: TObject;
 function TValue.AsObject: TObject;
 begin
 begin
-  if IsObject or (IsClass and not JS.IsObject(GetData)) then
+  if IsObject or (IsClass and not {$IFDEF FPC_DOTTEDUNITS}JSApi.{$ENDIF}JS.IsObject(GetData)) then
     Result := TObject(GetData)
     Result := TObject(GetData)
   else
   else
     raise EInvalidCast.Create(SErrInvalidTypecast);
     raise EInvalidCast.Create(SErrInvalidTypecast);
@@ -1032,7 +1038,7 @@ var
   k: TTypeKind;
   k: TTypeKind;
 begin
 begin
   k:=Kind;
   k:=Kind;
-  Result := (k = tkClassRef) or ((k in [tkClass,tkUnknown]) and not JS.IsObject(GetData));
+  Result := (k = tkClassRef) or ((k in [tkClass,tkUnknown]) and not {$IFDEF FPC_DOTTEDUNITS}JSApi.{$ENDIF}JS.IsObject(GetData));
 end;
 end;
 
 
 function TValue.AsClass: TClass;
 function TValue.AsClass: TClass;
@@ -1066,7 +1072,7 @@ end;
 
 
 function TValue.AsInteger: Integer;
 function TValue.AsInteger: Integer;
 begin
 begin
-  if JS.isInteger(GetData) then
+  if {$IFDEF FPC_DOTTEDUNITS}JSApi.{$ENDIF}JS.isInteger(GetData) then
     Result:=NativeInt(GetData)
     Result:=NativeInt(GetData)
   else
   else
     raise EInvalidCast.Create(SErrInvalidTypecast);
     raise EInvalidCast.Create(SErrInvalidTypecast);
@@ -1074,7 +1080,7 @@ end;
 
 
 function TValue.AsNativeInt: NativeInt;
 function TValue.AsNativeInt: NativeInt;
 begin
 begin
-  if JS.isInteger(GetData) then
+  if {$IFDEF FPC_DOTTEDUNITS}JSApi.{$ENDIF}JS.isInteger(GetData) then
     Result:=NativeInt(GetData)
     Result:=NativeInt(GetData)
   else
   else
     raise EInvalidCast.Create(SErrInvalidTypecast);
     raise EInvalidCast.Create(SErrInvalidTypecast);
@@ -1087,7 +1093,7 @@ begin
   k:=Kind;
   k:=Kind;
   if k = tkInterface then
   if k = tkInterface then
     Result := IInterface(GetData)// ToDo
     Result := IInterface(GetData)// ToDo
-  else if (k in [tkClass, tkClassRef, tkUnknown]) and not JS.isObject(GetData) then
+  else if (k in [tkClass, tkClassRef, tkUnknown]) and not {$IFDEF FPC_DOTTEDUNITS}JSApi.{$ENDIF}JS.isObject(GetData) then
     Result := Nil
     Result := Nil
   else
   else
     raise EInvalidCast.Create(SErrInvalidTypecast);
     raise EInvalidCast.Create(SErrInvalidTypecast);
@@ -1095,7 +1101,7 @@ end;
 
 
 function TValue.AsString: string;
 function TValue.AsString: string;
 begin
 begin
-  if js.isString(GetData) then
+  if {$IFDEF FPC_DOTTEDUNITS}JSApi.{$ENDIF}JS.isString(GetData) then
     Result:=String(GetData)
     Result:=String(GetData)
   else
   else
     raise EInvalidCast.Create(SErrInvalidTypecast);
     raise EInvalidCast.Create(SErrInvalidTypecast);
@@ -1108,7 +1114,7 @@ end;
 
 
 function TValue.AsExtended: Extended;
 function TValue.AsExtended: Extended;
 begin
 begin
-  if js.isNumber(GetData) then
+  if {$IFDEF FPC_DOTTEDUNITS}JSApi.{$ENDIF}JS.isNumber(GetData) then
     Result:=Double(GetData)
     Result:=Double(GetData)
   else
   else
     raise EInvalidCast.Create(SErrInvalidTypecast);
     raise EInvalidCast.Create(SErrInvalidTypecast);

+ 21 - 0
packages/rtl/simplelinkedlist.pas → packages/rtl/src/simplelinkedlist.pas

@@ -1,4 +1,21 @@
+{
+    This file is part of the Pas2JS run time library.
+    Copyright (c) 2022 by Michael Van Canneyt
+    
+    Simple Linked List implementation.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{$IFNDEF FPC_DOTTEDUNITS}
 unit simplelinkedlist;
 unit simplelinkedlist;
+{$ENDIF}
 
 
 {$mode objfpc}
 {$mode objfpc}
 
 
@@ -37,7 +54,11 @@ Type
 
 
 implementation
 implementation
 
 
+{$IFDEF FPC_DOTTEDUNITS}
+uses System.SysUtils;
+{$ELSE}
 uses sysutils;
 uses sysutils;
+{$ENDIF}
 
 
 { TLinkedList }
 { TLinkedList }
 
 

+ 12 - 1
packages/rtl/strutils.pas → packages/rtl/src/strutils.pas

@@ -15,12 +15,18 @@
 {$mode objfpc}
 {$mode objfpc}
 
 
 {$inline on}
 {$inline on}
+{$IFNDEF FPC_DOTTEDUNITS}
 unit strutils;
 unit strutils;
+{$ENDIF}
 
 
 interface
 interface
 
 
 uses
 uses
+{$IFDEF FPC_DOTTEDUNITS}
   SysUtils, Types;
   SysUtils, Types;
+{$ELSE}  
+  System.SysUtils, System.Types;
+{$ENDIF}  
 
 
 { ---------------------------------------------------------------------
 { ---------------------------------------------------------------------
     Case insensitive search/replace
     Case insensitive search/replace
@@ -225,7 +231,12 @@ type
 
 
 implementation
 implementation
 
 
-uses js;
+uses
+{$IFDEF FPC_DOTTEDUNITS}
+  JSApi.JS;
+{$ELSE}
+  js;
+{$ENDIF}
 
 
 { ---------------------------------------------------------------------
 { ---------------------------------------------------------------------
    Possibly Exception raising functions
    Possibly Exception raising functions

+ 0 - 0
packages/rtl/system.pas → packages/rtl/src/system.pas


+ 20 - 13
packages/rtl/sysutils.pas → packages/rtl/src/sysutils.pas

@@ -10,7 +10,9 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS}
 unit SysUtils;
 unit SysUtils;
+{$ENDIF}
 
 
 {$mode objfpc}
 {$mode objfpc}
 {$modeswitch typehelpers}
 {$modeswitch typehelpers}
@@ -19,8 +21,13 @@ unit SysUtils;
 
 
 interface
 interface
 
 
+
 uses
 uses
+{$IFDEF FPC_DOTTEDUNITS}
+  System.RTLConsts, JSApi.JS;
+{$ELSE}
   RTLConsts, js;
   RTLConsts, js;
+{$ENDIF}
 
 
 procedure FreeAndNil(var Obj);
 procedure FreeAndNil(var Obj);
 
 
@@ -5771,7 +5778,7 @@ end;
 class function TStringHelper.CompareText(const A: string; const B: string
 class function TStringHelper.CompareText(const A: string; const B: string
   ): Integer;
   ): Integer;
 begin
 begin
-  Result:=Sysutils.CompareText(A,B);
+  Result:={$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}SysUtils.CompareText(A,B);
 end;
 end;
 
 
 
 
@@ -5807,7 +5814,7 @@ end;
 
 
 class function TStringHelper.EndsText(const ASubText, AText: string): Boolean;
 class function TStringHelper.EndsText(const ASubText, AText: string): Boolean;
 begin
 begin
-  Result:=(ASubText<>'') and (sysutils.CompareText(System.Copy(AText,System.Length(AText)-System.Length(ASubText)+1,System.Length(ASubText)),ASubText)=0);
+  Result:=(ASubText<>'') and ({$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}SysUtils.CompareText(System.Copy(AText,System.Length(AText)-System.Length(ASubText)+1,System.Length(ASubText)),ASubText)=0);
 end;
 end;
 
 
 
 
@@ -5819,7 +5826,7 @@ end;
 
 
 class function TStringHelper.Format(const AFormat: string; const args: array of const): string;
 class function TStringHelper.Format(const AFormat: string; const args: array of const): string;
 begin
 begin
-  Result:=Sysutils.Format(AFormat,Args);
+  Result:={$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}SysUtils.Format(AFormat,Args);
 end;
 end;
 
 
 
 
@@ -5831,7 +5838,7 @@ end;
 
 
 class function TStringHelper.IsNullOrWhiteSpace(const AValue: string): Boolean;
 class function TStringHelper.IsNullOrWhiteSpace(const AValue: string): Boolean;
 begin
 begin
-  Result:=system.Length(sysutils.Trim(AValue))=0;
+  Result:=system.Length({$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}SysUtils.Trim(AValue))=0;
 end;
 end;
 
 
 
 
@@ -5867,7 +5874,7 @@ end;
 
 
 class function TStringHelper.LowerCase(const S: string): string;
 class function TStringHelper.LowerCase(const S: string): string;
 begin
 begin
-  Result:=sysutils.Lowercase(S);
+  Result:={$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}SysUtils.Lowercase(S);
 end;
 end;
 
 
 
 
@@ -5927,7 +5934,7 @@ end;
 
 
 class function TStringHelper.UpperCase(const S: string): string;
 class function TStringHelper.UpperCase(const S: string): string;
 begin
 begin
-  Result:=sysutils.Uppercase(S);
+  Result:={$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}SysUtils.Uppercase(S);
 end;
 end;
 
 
 class function TStringHelper.ToCharArray(const S: String): TCharArray;
 class function TStringHelper.ToCharArray(const S: String): TCharArray;
@@ -6051,7 +6058,7 @@ end;
 function TStringHelper.Format(const args: array of const): string;
 function TStringHelper.Format(const args: array of const): string;
 
 
 begin
 begin
-  Result:=Sysutils.Format(Self,Args);
+  Result:={$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}SysUtils.Format(Self,Args);
 end;
 end;
 
 
 
 
@@ -6365,7 +6372,7 @@ end;
 function TStringHelper.IsDelimiter(const Delimiters: string; Index: SizeInt
 function TStringHelper.IsDelimiter(const Delimiters: string; Index: SizeInt
   ): Boolean;
   ): Boolean;
 begin
 begin
-  Result:=sysutils.IsDelimiter(Delimiters,Self,Index+1);
+  Result:={$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}SysUtils.IsDelimiter(Delimiters,Self,Index+1);
 end;
 end;
 
 
 
 
@@ -6377,7 +6384,7 @@ end;
 
 
 function TStringHelper.LastDelimiter(const Delims: string): SizeInt;
 function TStringHelper.LastDelimiter(const Delims: string): SizeInt;
 begin
 begin
-  Result:=sysutils.LastDelimiter(Delims,Self)-1;
+  Result:={$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}SysUtils.LastDelimiter(Delims,Self)-1;
 end;
 end;
 
 
 
 
@@ -6960,19 +6967,19 @@ end;
 
 
 function TStringHelper.Trim: string;
 function TStringHelper.Trim: string;
 begin
 begin
-  Result:=SysUtils.Trim(self);
+  Result:={$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}SysUtils.Trim(self);
 end;
 end;
 
 
 
 
 function TStringHelper.TrimLeft: string;
 function TStringHelper.TrimLeft: string;
 begin
 begin
-  Result:=SysUtils.TrimLeft(Self);
+  Result:={$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}SysUtils.TrimLeft(Self);
 end;
 end;
 
 
 
 
 function TStringHelper.TrimRight: string;
 function TStringHelper.TrimRight: string;
 begin
 begin
-  Result:=SysUtils.TrimRight(Self);
+  Result:={$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}SysUtils.TrimRight(Self);
 end;
 end;
 
 
 
 
@@ -7036,7 +7043,7 @@ end;
 Class Function TDoubleHelper.IsNan(const AValue: Double): Boolean; overload; inline;
 Class Function TDoubleHelper.IsNan(const AValue: Double): Boolean; overload; inline;
 
 
 begin
 begin
-  Result:=JS.jsIsNaN(AValue);
+  Result:={$IFDEF FPC_DOTTEDUNITS}JSApi.{$ENDIF}JS.jsIsNaN(AValue);
 end;
 end;
 
 
 Class Function TDoubleHelper.IsInfinity(const AValue: Double): Boolean; overload; inline;
 Class Function TDoubleHelper.IsInfinity(const AValue: Double): Boolean; overload; inline;

+ 9 - 3
packages/rtl/timer.pas → packages/rtl/src/timer.pas

@@ -10,14 +10,20 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS}
+unit timer;
+{$ENDIF}
 
 
 {$mode objfpc}
 {$mode objfpc}
 
 
-unit timer;
-
 Interface
 Interface
 
 
-uses JS, Web, Classes;
+uses 
+{$IFDEF FPC_DOTTEDUNITS}
+  JSApi.JS, BrowserApi.Web, System.Classes;
+{$ELSE}
+  JS, Web, Classes;
+{$ENDIF}
 
 
 type
 type
   TTimer = class(TComponent)
   TTimer = class(TComponent)

+ 2 - 0
packages/rtl/types.pas → packages/rtl/src/types.pas

@@ -10,7 +10,9 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS}
 unit Types;
 unit Types;
+{$ENDIF}
 
 
 {$mode objfpc}
 {$mode objfpc}
 
 

+ 6 - 0
packages/rtl/typinfo.pas → packages/rtl/src/typinfo.pas

@@ -10,7 +10,9 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS}
 unit TypInfo;
 unit TypInfo;
+{$ENDIF}
 
 
 {$mode objfpc}
 {$mode objfpc}
 {$modeswitch externalclass}
 {$modeswitch externalclass}
@@ -18,7 +20,11 @@ unit TypInfo;
 interface
 interface
 
 
 uses
 uses
+{$IFDEF FPC_DOTTEDUNITS}
+  System.SysUtils, System.Types, System.RTLConsts, JSApi.JS;
+{$ELSE}  
   SysUtils, Types, RTLConsts, JS;
   SysUtils, Types, RTLConsts, JS;
+{$ENDIF}
 
 
 type
 type
   // TCallConv for compatibility with Delphi/FPC, ignored under pas2js
   // TCallConv for compatibility with Delphi/FPC, ignored under pas2js

+ 149 - 97
packages/rtl/web.pas → packages/rtl/src/web.pas

@@ -2,6 +2,8 @@
     This file is part of the Pas2JS run time library.
     This file is part of the Pas2JS run time library.
     Copyright (c) 2017-2020 by the Pas2JS development team.
     Copyright (c) 2017-2020 by the Pas2JS development team.
 
 
+    Browser Window & DOM API definitions
+    
     See the file COPYING.FPC, included in this distribution,
     See the file COPYING.FPC, included in this distribution,
     for details about the copyright.
     for details about the copyright.
 
 
@@ -11,14 +13,20 @@
 
 
  **********************************************************************}
  **********************************************************************}
 
 
+{$IFNDEF FPC_DOTTEDUNITS}
+unit Web;
+{$ENDIF}
 {$mode objfpc}
 {$mode objfpc}
 {$modeswitch externalclass}
 {$modeswitch externalclass}
 
 
-unit Web;
-
 interface
 interface
 
 
-uses Types, JS, weborworker;
+Uses
+{$IFDEF FPC_DOTTEDUNITS}
+  System.Types, JSApi.JS, BrowserApi.WebOrWorker;
+{$ELSE FPC_DOTTEDUNITS}
+  Types, JS, weborworker;
+{$ENDIF FPC_DOTTEDUNITS}
 
 
 Type
 Type
   // Forward definitions
   // Forward definitions
@@ -46,29 +54,153 @@ Type
   TJSShowOpenFilePickerOptions = class;
   TJSShowOpenFilePickerOptions = class;
   TJSShowSaveFilePickerOptions = class;
   TJSShowSaveFilePickerOptions = class;
 
 
+{$IFDEF FPC_DOTTEDUNITS}
+  TJSServiceWorker = BrowserApi.WebOrWorker.TJSServiceWorker;
+  TJSServiceWorkerRegistration = BrowserApi.WebOrWorker.TJSServiceWorkerRegistration;
+  TJSMessageEvent = BrowserApi.WebOrWorker.TJSMessageEvent;
+  TJSEvent = BrowserApi.WebOrWorker.TJSEvent;
+  TJSBlob = BrowserApi.WebOrWorker.TJSBlob;
+  TJSEventTarget = BrowserApi.WebOrWorker.TJSEventTarget;
+  TJSEventInit = BrowserApi.WebOrWorker.TJSEventInit;
+  TJSConsole = BrowserApi.WebOrWorker.TJSConsole;
+  KeyType = BrowserApi.WebOrWorker.TJSCryptoKeyType;
+  KeyUsage = BrowserApi.WebOrWorker.TJSCryptoKeyUsage;
+  NamedCurve = BrowserApi.WebOrWorker.TJSCryptoNamedCurve;
+  BigInteger = BrowserApi.WebOrWorker.TJSCryptoBigInteger;
+  KeyFormat = BrowserApi.WebOrWorker.TJSCryptoKeyFormat;
+  Algorithm = BrowserApi.WebOrWorker.TJSCryptoAlgorithm;
+  AesCbcParams = BrowserApi.WebOrWorker.TJSCryptoAesCbcParams;
+  AesCtrParams = BrowserApi.WebOrWorker.TJSCryptoAesCtrParams;
+  AesGcmParams = BrowserApi.WebOrWorker.TJSCryptoAesGcmParams;
+  HmacImportParams = BrowserApi.WebOrWorker.TJSCryptoHmacImportParams;
+  Pbkdf2Params = BrowserApi.WebOrWorker.TJSCryptoPbkdf2Params;
+  RsaHashedImportParams = BrowserApi.WebOrWorker.TJSCryptoRsaHashedImportParams;
+  AesKeyGenParams = BrowserApi.WebOrWorker.TJSCryptoAesKeyGenParams;
+  HmacKeyGenParams = BrowserApi.WebOrWorker.TJSCryptoHmacKeyGenParams;
+  RsaHashedKeyGenParams = BrowserApi.WebOrWorker.TJSCryptoRsaHashedKeyGenParams;
+  RsaOaepParams = BrowserApi.WebOrWorker.TJSCryptoRsaOaepParams;
+  RsaPssParams = BrowserApi.WebOrWorker.TJSCryptoRsaPssParams;
+  DhKeyGenParams = BrowserApi.WebOrWorker.TJSCryptoDhKeyGenParams;
+  EcKeyGenParams = BrowserApi.WebOrWorker.TJSCryptoEcKeyGenParams;
+  AesDerivedKeyParams = BrowserApi.WebOrWorker.TJSCryptoAesDerivedKeyParams;
+  HmacDerivedKeyParams = BrowserApi.WebOrWorker.TJSCryptoHmacDerivedKeyParams;
+  EcdhKeyDeriveParams = BrowserApi.WebOrWorker.TJSCryptoEcdhKeyDeriveParams;
+  DhKeyDeriveParams = BrowserApi.WebOrWorker.TJSCryptoDhKeyDeriveParams;
+  DhImportKeyParams = BrowserApi.WebOrWorker.TJSCryptoDhImportKeyParams;
+  EcdsaParams = BrowserApi.WebOrWorker.TJSCryptoEcdsaParams;
+  EcKeyImportParams = BrowserApi.WebOrWorker.TJSCryptoEcKeyImportParams;
+  CryptoKeyPair = BrowserApi.WebOrWorker.TJSCryptoKeyPair;
+  HkdfParams = BrowserApi.WebOrWorker.TJSCryptoHkdfParams;
+  RsaOtherPrimesInfo = BrowserApi.WebOrWorker.TJSCryptoRsaOtherPrimesInfo;
+  TRsaOtherPrimesInfoDynArray = BrowserApi.WebOrWorker.TJSCryptoRsaOtherPrimesInfoDynArray;
+  TKeyUsageDynArray = BrowserApi.WebOrWorker.TJSCryptoKeyUsageDynArray;
+  TJSCryptoKey = BrowserApi.WebOrWorker.TJSCryptoKey;
+  TJSSubtleCrypto = BrowserApi.WebOrWorker.TJSSubtleCrypto;
+  TJSCrypto = BrowserApi.WebOrWorker.TJSCrypto;
+  TJSIDBTransactionMode = BrowserApi.WebOrWorker.TJSIDBTransactionMode;
+  TJSIDBTransaction = BrowserApi.WebOrWorker.TJSIDBTransaction;
+  TJSIDBKeyRange = BrowserApi.WebOrWorker.TJSIDBKeyRange;
+  TJSIDBIndexParameters = BrowserApi.WebOrWorker.TJSIDBIndexParameters;
+  TJSIDBIndex = BrowserApi.WebOrWorker.TJSIDBIndex;
+  TJSIDBCursorDirection = BrowserApi.WebOrWorker.TJSIDBCursorDirection;
+  TJSIDBCursor = BrowserApi.WebOrWorker.TJSIDBCursor;
+  TJSIDBObjectStore = BrowserApi.WebOrWorker.TJSIDBObjectStore;
+  TJSIDBRequest = BrowserApi.WebOrWorker.TJSIDBRequest;
+  TJSIDBOpenDBRequest = BrowserApi.WebOrWorker.TJSIDBOpenDBRequest;
+  TJSCreateObjectStoreOptions = BrowserApi.WebOrWorker.TJSCreateObjectStoreOptions;
+  TIDBDatabase = BrowserApi.WebOrWorker.TIDBDatabase;
+  TJSIDBFactory = BrowserApi.WebOrWorker.TJSIDBFactory;
+  TJSWorker = BrowserApi.WebOrWorker.TJSWorker;
+  TJSExtendableEvent = BrowserApi.WebOrWorker.TJSExtendableEvent;
+  TJSClient = BrowserApi.WebOrWorker.TJSClient;
+  TJSExtendableMessageEvent = BrowserApi.WebOrWorker.TJSExtendableMessageEvent;
+  TJSURLSearchParams = BrowserApi.WebOrWorker.TJSURLSearchParams;
+  TJSURL = BrowserApi.WebOrWorker.TJSURL;
+  TJSURLDynArray = BrowserApi.WebOrWorker.TJSURLDynArray;
+  TJSTimerCallBack = BrowserApi.WebOrWorker.TJSTimerCallBack;
+  TJSReadableStream = BrowserApi.WebOrWorker.TJSReadableStream;
+  TJSWritableStream = BrowserApi.WebOrWorker.TJSWritableStream;
+  TJSBody = BrowserApi.WebOrWorker.TJSBody;
+  TJSResponse = BrowserApi.WebOrWorker.TJSResponse;
+  TJSCache = BrowserApi.WebOrWorker.TJSCache;
+  TJSCacheStorage = BrowserApi.WebOrWorker.TJSCacheStorage;
+{$ELSE}
   TJSServiceWorker = weborworker.TJSServiceWorker;
   TJSServiceWorker = weborworker.TJSServiceWorker;
   TJSServiceWorkerRegistration = weborworker.TJSServiceWorkerRegistration;
   TJSServiceWorkerRegistration = weborworker.TJSServiceWorkerRegistration;
   TJSMessageEvent = weborworker.TJSMessageEvent;
   TJSMessageEvent = weborworker.TJSMessageEvent;
-  TJSMessagePortArray = TJSMessagePortDynArray;
-
-  { TEventListenerEvent }
-
-(*
-TEventListenerEvent = class external name 'EventListener_Event' (TJSObject)
-  private
-    FTarget: TJSEventTarget; external name 'target';
-  public
-    Property target: TJSEventTarget Read FTarget;
-  end;
-*)
   TJSEvent = weborworker.TJSEvent;
   TJSEvent = weborworker.TJSEvent;
-  TEventListenerEvent = TJSEvent;
   TJSBlob = weborworker.TJSBlob;
   TJSBlob = weborworker.TJSBlob;
+  TJSEventTarget = weborworker.TJSEventTarget;
+  TJSEventInit = weborworker.TJSEventInit;
+  TJSConsole = weborworker.TJSConsole;
+  KeyType = weborworker.TJSCryptoKeyType;
+  KeyUsage = weborworker.TJSCryptoKeyUsage;
+  NamedCurve = weborworker.TJSCryptoNamedCurve;
+  BigInteger = weborworker.TJSCryptoBigInteger;
+  KeyFormat = weborworker.TJSCryptoKeyFormat;
+  Algorithm = weborworker.TJSCryptoAlgorithm;
+  AesCbcParams = weborworker.TJSCryptoAesCbcParams;
+  AesCtrParams = weborworker.TJSCryptoAesCtrParams;
+  AesGcmParams = weborworker.TJSCryptoAesGcmParams;
+  HmacImportParams = weborworker.TJSCryptoHmacImportParams;
+  Pbkdf2Params = weborworker.TJSCryptoPbkdf2Params;
+  RsaHashedImportParams = weborworker.TJSCryptoRsaHashedImportParams;
+  AesKeyGenParams = weborworker.TJSCryptoAesKeyGenParams;
+  HmacKeyGenParams = weborworker.TJSCryptoHmacKeyGenParams;
+  RsaHashedKeyGenParams = weborworker.TJSCryptoRsaHashedKeyGenParams;
+  RsaOaepParams = weborworker.TJSCryptoRsaOaepParams;
+  RsaPssParams = weborworker.TJSCryptoRsaPssParams;
+  DhKeyGenParams = weborworker.TJSCryptoDhKeyGenParams;
+  EcKeyGenParams = weborworker.TJSCryptoEcKeyGenParams;
+  AesDerivedKeyParams = weborworker.TJSCryptoAesDerivedKeyParams;
+  HmacDerivedKeyParams = weborworker.TJSCryptoHmacDerivedKeyParams;
+  EcdhKeyDeriveParams = weborworker.TJSCryptoEcdhKeyDeriveParams;
+  DhKeyDeriveParams = weborworker.TJSCryptoDhKeyDeriveParams;
+  DhImportKeyParams = weborworker.TJSCryptoDhImportKeyParams;
+  EcdsaParams = weborworker.TJSCryptoEcdsaParams;
+  EcKeyImportParams = weborworker.TJSCryptoEcKeyImportParams;
+  CryptoKeyPair = weborworker.TJSCryptoKeyPair;
+  HkdfParams = weborworker.TJSCryptoHkdfParams;
+  RsaOtherPrimesInfo = weborworker.TJSCryptoRsaOtherPrimesInfo;
+  TRsaOtherPrimesInfoDynArray = weborworker.TJSCryptoRsaOtherPrimesInfoDynArray;
+  TKeyUsageDynArray = weborworker.TJSCryptoKeyUsageDynArray;
+  TJSCryptoKey = weborworker.TJSCryptoKey;
+  TJSSubtleCrypto = weborworker.TJSSubtleCrypto;
+  TJSCrypto = weborworker.TJSCrypto;
+  TJSIDBTransactionMode = weborworker.TJSIDBTransactionMode;
+  TJSIDBTransaction = weborworker.TJSIDBTransaction;
+  TJSIDBKeyRange = weborworker.TJSIDBKeyRange;
+  TJSIDBIndexParameters = weborworker.TJSIDBIndexParameters;
+  TJSIDBIndex = weborworker.TJSIDBIndex;
+  TJSIDBCursorDirection = weborworker.TJSIDBCursorDirection;
+  TJSIDBCursor = weborworker.TJSIDBCursor;
+  TJSIDBObjectStore = weborworker.TJSIDBObjectStore;
+  TJSIDBRequest = weborworker.TJSIDBRequest;
+  TJSIDBOpenDBRequest = weborworker.TJSIDBOpenDBRequest;
+  TJSCreateObjectStoreOptions = weborworker.TJSCreateObjectStoreOptions;
+  TIDBDatabase = weborworker.TIDBDatabase;
+  TJSIDBFactory = weborworker.TJSIDBFactory;
+  TJSWorker = weborworker.TJSWorker;
+  TJSExtendableEvent = weborworker.TJSExtendableEvent;
+  TJSClient = weborworker.TJSClient;
+  TJSExtendableMessageEvent = weborworker.TJSExtendableMessageEvent;
+  TJSURLSearchParams = weborworker.TJSURLSearchParams;
+  TJSURL = weborworker.TJSURL;
+  TJSURLDynArray = weborworker.TJSURLDynArray;
+  TJSTimerCallBack = weborworker.TJSTimerCallBack;
+  TJSReadableStream = weborworker.TJSReadableStream;
+  TJSWritableStream = weborworker.TJSWritableStream;
+  TJSBody = weborworker.TJSBody;
+  TJSResponse = weborworker.TJSResponse;
+  TJSCache = weborworker.TJSCache;
+  TJSCacheStorage = weborworker.TJSCacheStorage;
+{$ENDIF}
+  TJSMessagePortArray = TJSMessagePortDynArray;
+  TEventListenerEvent = TJSEvent;
 
 
   TJSEventHandler = reference to function(Event: TEventListenerEvent): boolean; safecall;
   TJSEventHandler = reference to function(Event: TEventListenerEvent): boolean; safecall;
   TJSRawEventHandler = reference to Procedure(Event: TJSEvent); safecall;
   TJSRawEventHandler = reference to Procedure(Event: TJSEvent); safecall;
 
 
-  TJSEventTarget = weborworker.TJSEventTarget;
 
 
   TJSNode = class external name 'Node' (TJSEventTarget)
   TJSNode = class external name 'Node' (TJSEventTarget)
   Private
   Private
@@ -430,7 +562,6 @@ TEventListenerEvent = class external name 'EventListener_Event' (TJSObject)
     property lastElementChild : TJSElement read FlastElementChild;
     property lastElementChild : TJSElement read FlastElementChild;
   end;
   end;
 
 
-  TJSEventInit = weborworker.TJSEventInit;
 
 
   { TJSEventHelper }
   { TJSEventHelper }
 
 
@@ -1018,53 +1149,6 @@ TEventListenerEvent = class external name 'EventListener_Event' (TJSObject)
     property visibilityState : string read FVisibilityState;
     property visibilityState : string read FVisibilityState;
   end;
   end;
 
 
-  TJSConsole = weborworker.TJSConsole;
-
-//  TJSBufferSource = class external name 'BufferSource' end;
-//  TJSTypedArray = class external name 'TypedArray' end;
-
-  // Forward class definitions
-  KeyType = weborworker.TJSCryptoKeyType;
-  KeyUsage = weborworker.TJSCryptoKeyUsage;
-
-  NamedCurve = weborworker.TJSCryptoNamedCurve;
-  BigInteger = weborworker.TJSCryptoBigInteger;
-
-  KeyFormat = weborworker.TJSCryptoKeyFormat;
-  // Union of object, DOMString
-
-
-  Algorithm = weborworker.TJSCryptoAlgorithm;
-  AesCbcParams = weborworker.TJSCryptoAesCbcParams;
-  AesCtrParams = weborworker.TJSCryptoAesCtrParams;
-  AesGcmParams = weborworker.TJSCryptoAesGcmParams;
-  HmacImportParams = weborworker.TJSCryptoHmacImportParams;
-  Pbkdf2Params = weborworker.TJSCryptoPbkdf2Params;
-  RsaHashedImportParams = weborworker.TJSCryptoRsaHashedImportParams;
-  AesKeyGenParams = weborworker.TJSCryptoAesKeyGenParams;
-  HmacKeyGenParams = weborworker.TJSCryptoHmacKeyGenParams;
-  RsaHashedKeyGenParams = weborworker.TJSCryptoRsaHashedKeyGenParams;
-  RsaOaepParams = weborworker.TJSCryptoRsaOaepParams;
-  RsaPssParams = weborworker.TJSCryptoRsaPssParams;
-  DhKeyGenParams = weborworker.TJSCryptoDhKeyGenParams;
-  EcKeyGenParams = weborworker.TJSCryptoEcKeyGenParams;
-  AesDerivedKeyParams = weborworker.TJSCryptoAesDerivedKeyParams;
-  HmacDerivedKeyParams = weborworker.TJSCryptoHmacDerivedKeyParams;
-  EcdhKeyDeriveParams = weborworker.TJSCryptoEcdhKeyDeriveParams;
-  DhKeyDeriveParams = weborworker.TJSCryptoDhKeyDeriveParams;
-  DhImportKeyParams = weborworker.TJSCryptoDhImportKeyParams;
-
-  EcdsaParams = weborworker.TJSCryptoEcdsaParams;
-  EcKeyImportParams = weborworker.TJSCryptoEcKeyImportParams;
-
-  CryptoKeyPair = weborworker.TJSCryptoKeyPair;
-  HkdfParams = weborworker.TJSCryptoHkdfParams;
-  RsaOtherPrimesInfo = weborworker.TJSCryptoRsaOtherPrimesInfo;
-  TRsaOtherPrimesInfoDynArray = weborworker.TJSCryptoRsaOtherPrimesInfoDynArray;
-  TKeyUsageDynArray = weborworker.TJSCryptoKeyUsageDynArray;
-  TJSCryptoKey = weborworker.TJSCryptoKey;
-  TJSSubtleCrypto = weborworker.TJSSubtleCrypto;
-  TJSCrypto = weborworker.TJSCrypto;
 
 
   { TJSHistory }
   { TJSHistory }
 
 
@@ -1090,21 +1174,6 @@ TEventListenerEvent = class external name 'EventListener_Event' (TJSObject)
     property length: NativeInt read FLength;
     property length: NativeInt read FLength;
   end;
   end;
 
 
-  { IndexedDB - moved to weborworker}
-
-  TJSIDBTransactionMode = weborworker.TJSIDBTransactionMode;
-  TJSIDBTransaction = weborworker.TJSIDBTransaction;
-  TJSIDBKeyRange = weborworker.TJSIDBKeyRange;
-  TJSIDBIndexParameters = weborworker.TJSIDBIndexParameters;
-  TJSIDBIndex = weborworker.TJSIDBIndex;
-  TJSIDBCursorDirection = weborworker.TJSIDBCursorDirection;
-  TJSIDBCursor = weborworker.TJSIDBCursor;
-  TJSIDBObjectStore = weborworker.TJSIDBObjectStore;
-  TJSIDBRequest = weborworker.TJSIDBRequest;
-  TJSIDBOpenDBRequest = weborworker.TJSIDBOpenDBRequest;
-  TJSCreateObjectStoreOptions = weborworker.TJSCreateObjectStoreOptions;
-  TIDBDatabase = weborworker.TIDBDatabase;
-  TJSIDBFactory = weborworker.TJSIDBFactory;
 
 
   { TJSStorage }
   { TJSStorage }
 
 
@@ -1184,7 +1253,6 @@ TEventListenerEvent = class external name 'EventListener_Event' (TJSObject)
   TJSMediaDevices = class external name 'MediaDevices' (TJSEventTarget)
   TJSMediaDevices = class external name 'MediaDevices' (TJSEventTarget)
   end;
   end;
 
 
-  TJSWorker = weborworker.TJSWorker;
 
 
 
 
   { TJSSharedWorker }
   { TJSSharedWorker }
@@ -1198,9 +1266,6 @@ TEventListenerEvent = class external name 'EventListener_Event' (TJSObject)
     property port : TJSMessagePort Read FPort;
     property port : TJSMessagePort Read FPort;
   end;
   end;
 
 
-  TJSExtendableEvent = weborworker.TJSExtendableEvent;
-  TJSClient = weborworker.TJSClient;
-  TJSExtendableMessageEvent = weborworker.TJSExtendableMessageEvent;
 
 
   TJSServiceWorkerContainerOptions = record
   TJSServiceWorkerContainerOptions = record
     scope : string;
     scope : string;
@@ -1346,12 +1411,6 @@ TEventListenerEvent = class external name 'EventListener_Event' (TJSObject)
 
 
 
 
 
 
-  TJSURLSearchParams = weborworker.TJSURLSearchParams;
-  TJSURL = weborworker.TJSURL;
-  TJSURLDynArray = weborworker.TJSURLDynArray;
-
-
-  TJSTimerCallBack = weborworker.TJSTimerCallBack;
 
 
 
 
   { TJSMediaQueryList }
   { TJSMediaQueryList }
@@ -1365,11 +1424,6 @@ TEventListenerEvent = class external name 'EventListener_Event' (TJSObject)
     Property media : String Read FMedia;
     Property media : String Read FMedia;
   end;
   end;
 
 
-  TJSReadableStream = weborworker.TJSReadableStream;
-  TJSWritableStream = weborworker.TJSWritableStream;
-  TJSBody = weborworker.TJSBody;
-
-  TJSResponse = weborworker.TJSResponse;
 
 
   TJSDOMHighResTimeStamp = Double;
   TJSDOMHighResTimeStamp = Double;
   TFrameRequestCallback = reference to procedure (aTime: TJSDOMHighResTimeStamp);
   TFrameRequestCallback = reference to procedure (aTime: TJSDOMHighResTimeStamp);
@@ -1393,8 +1447,6 @@ TEventListenerEvent = class external name 'EventListener_Event' (TJSObject)
     property didTimeout: Boolean read FDidTimeout;
     property didTimeout: Boolean read FDidTimeout;
   end;
   end;
 
 
-  TJSCache = weborworker.TJSCache;
-  TJSCacheStorage = weborworker.TJSCacheStorage;
 
 
   TJSWindowArray = Array of TJSWindow;
   TJSWindowArray = Array of TJSWindow;
   TIdleCallbackProc = reference to procedure(idleDeadline: TJSIdleDeadline);
   TIdleCallbackProc = reference to procedure(idleDeadline: TJSIdleDeadline);

+ 21 - 0
packages/rtl/webassembly.pas → packages/rtl/src/webassembly.pas

@@ -1,4 +1,21 @@
+{
+    This file is part of the Pas2JS run time library.
+    Copyright (c) 2022 by Michael Van Canneyt
+    
+    Browser WebAssembly API definitions
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{$IFNDEF FPC_DOTTEDUNITS}
 unit webassembly;
 unit webassembly;
+{$ENDIF}
 
 
 {$mode objfpc}
 {$mode objfpc}
 {$modeswitch externalclass}
 {$modeswitch externalclass}
@@ -6,7 +23,11 @@ unit webassembly;
 interface
 interface
 
 
 uses
 uses
+{$IFDEF FPC_DOTTEDUNITS}
+  JSApi.JS;
+{$ELSE}
   js;
   js;
+{$ENDIF}  
 
 
 Type
 Type
   { TJSWebAssemblyMemory }
   { TJSWebAssemblyMemory }

+ 23 - 1
packages/rtl/webaudio.pas → packages/rtl/src/webaudio.pas

@@ -1,4 +1,21 @@
+{
+    This file is part of the Pas2JS run time library.
+    Copyright (c) 2022 by Michael Van Canneyt
+    
+    Browser Audio API definitions.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{$IFNDEF FPC_DOTTEDUNITS}
 Unit webaudio;
 Unit webaudio;
+{$ENDIF}
 
 
 {$MODE ObjFPC}
 {$MODE ObjFPC}
 {$H+}
 {$H+}
@@ -6,7 +23,12 @@ Unit webaudio;
 
 
 interface
 interface
 
 
-uses SysUtils, JS, weborworker, web, types;
+uses 
+{$IFDEF FPC_DOTTEDAPI}
+  System.SysUtils, JSApi.JS, BrowserApi.WebOrWorker, BrowserApi.Web, System.Types;
+{$ELSE}
+  SysUtils, JS, weborworker, web, types;
+{$ENDIF}
 
 
 {
 {
   Automatically generated file by TWebIDLToPas on 2018-06-23 10:52:00
   Automatically generated file by TWebIDLToPas on 2018-06-23 10:52:00

+ 23 - 1
packages/rtl/webbluetooth.pas → packages/rtl/src/webbluetooth.pas

@@ -1,4 +1,21 @@
+{
+    This file is part of the Pas2JS run time library.
+    Copyright (c) 2022 by Michael Van Canneyt
+    
+    Browser BlueTooth API definitions
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{$IFNDEF FPC_DOTTEDUNITS}
 Unit webbluetooth;
 Unit webbluetooth;
+{$ENDIF}
 
 
 {$MODE ObjFPC}
 {$MODE ObjFPC}
 {$H+}
 {$H+}
@@ -6,7 +23,12 @@ Unit webbluetooth;
 
 
 interface
 interface
 
 
-uses JS,web;
+uses 
+{$IFDEF FPC_DOTTEDUNITS}
+  JSApi.JS, BrowserApi.Web;
+{$ELSE}
+  JS, Web;
+{$ENDIF}
 
 
 Type
 Type
   // Forward class definitions
   // Forward class definitions

+ 22 - 1
packages/rtl/webgl.pas → packages/rtl/src/webgl.pas

@@ -1,4 +1,20 @@
+{
+    This file is part of the Pas2JS run time library.
+    Copyright (c) 2022 by Michael Van Canneyt
+    
+    Browser WebGL API definitions.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS}
 Unit webgl;
 Unit webgl;
+{$ENDIF}
 
 
 {$MODE ObjFPC}
 {$MODE ObjFPC}
 {$H+}
 {$H+}
@@ -6,7 +22,12 @@ Unit webgl;
 
 
 interface
 interface
 
 
-uses JS, Web;
+uses 
+{$IFDEF FPC_DOTTEDUNITS}
+  JSApi.JS, BrowserApi.Web;
+{$ELSE}
+JS, Web;
+{$ENDIF}
 
 
 {
 {
   Automatically generated file by TWebIDLToPas on 2018-06-23 15:31:57
   Automatically generated file by TWebIDLToPas on 2018-06-23 15:31:57

+ 21 - 0
packages/rtl/weborworker.pas → packages/rtl/src/weborworker.pas

@@ -1,4 +1,21 @@
+{
+    This file is part of the Pas2JS run time library.
+    Copyright (c) 2022 by Michael Van Canneyt
+    
+    Browser Worker and Window API definitions
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{$IFNDEF FPC_DOTTEDUNITS}
 unit weborworker;
 unit weborworker;
+{$ENDIF}
 
 
 {$mode objfpc}
 {$mode objfpc}
 {$modeswitch externalclass}
 {$modeswitch externalclass}
@@ -6,7 +23,11 @@ unit weborworker;
 interface
 interface
 
 
 uses
 uses
+{$IFDEF FPC_DOTTEDUNITS}
+  JSApi.JS, System.Types;
+{$ELSE}
   JS, types;
   JS, types;
+{$ENDIF}
 
 
 type
 type
   // Forward declarations
   // Forward declarations

+ 17 - 4
packages/rtl/webrouter.pp → packages/rtl/src/webrouter.pp

@@ -16,16 +16,24 @@
   Note:
   Note:
   The MatchPattern routine was taken from Brook Framework's router unit, by Silvio Clecio.
   The MatchPattern routine was taken from Brook Framework's router unit, by Silvio Clecio.
 }
 }
+{$IFNDEF FPC_DOTTEDUNITS}
+unit webrouter;
+{$ENDIF}
+
+{$MODE OBJFPC}
+{$WARN 4501 off}
 
 
-{$mode objfpc}
 // Define this to output some debugging output
 // Define this to output some debugging output
 { $DEFINE DEBUGROUTER }
 { $DEFINE DEBUGROUTER }
-unit webrouter;
-{$WARN 4501 off : }
+
 interface
 interface
 
 
 uses
 uses
+{$IFDEF FPC_DOTTEDUNITS}
+  System.Classes, System.SysUtils, BrowserApi.Web;
+{$ELSE}  
   Classes, SysUtils, web;
   Classes, SysUtils, web;
+{$ENDIF}
 
 
 Type
 Type
   EHTTPRoute = Class(Exception);
   EHTTPRoute = Class(Exception);
@@ -319,7 +327,12 @@ Function IncludeHTTPPathDelimiter (S : String) : String;
 
 
 implementation
 implementation
 
 
-uses strutils, js;
+uses 
+{$IFDEF FPC_DOTTEDUNITS}
+  System.StrUtils, JSApi.JS;
+{$ELSE}  
+  strutils,js;
+{$ENDIF}  
 
 
 Resourcestring
 Resourcestring
   EDuplicateRoute = 'Duplicate route pattern: %s';
   EDuplicateRoute = 'Duplicate route pattern: %s';

+ 23 - 2
packages/rtl/webrtc.pas → packages/rtl/src/webrtc.pas

@@ -1,4 +1,20 @@
+{
+    This file is part of the Pas2JS run time library.
+    Copyright (c) 2022 by Michael Van Canneyt
+    
+    Browser RTC (Real-Time Communications) API definitions
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS}
 Unit webrtc;
 Unit webrtc;
+{$ENDIF}
 
 
 {$MODE ObjFPC}
 {$MODE ObjFPC}
 {$H+}
 {$H+}
@@ -6,7 +22,12 @@ Unit webrtc;
 
 
 interface
 interface
 
 
-uses SysUtils, JS,web;
+uses 
+{$IFDEF FPC_DOTTEDUNITS}
+  System.SysUtils, JSApi.JS, BrowserApi.WebOrWorker, BrowserApi.Web;
+{$ELSE}
+  SysUtils, JS, weborworker, web;
+{$ENDIF}
 
 
 {
 {
   Automatically generated file by TWebIDLToPas on 2020-03-23 14:48:13
   Automatically generated file by TWebIDLToPas on 2020-03-23 14:48:13
@@ -524,7 +545,7 @@ Type
     function createOffer(successCallback : RTCSessionDescriptionCallback; failureCallback : RTCPeerConnectionErrorCallback): TJSPromise; overload;
     function createOffer(successCallback : RTCSessionDescriptionCallback; failureCallback : RTCPeerConnectionErrorCallback): TJSPromise; overload;
     function createAnswer(successCallback : RTCSessionDescriptionCallback; failureCallback : RTCPeerConnectionErrorCallback): TJSPromise;
     function createAnswer(successCallback : RTCSessionDescriptionCallback; failureCallback : RTCPeerConnectionErrorCallback): TJSPromise;
     function addIceCandidate(candidate : TJSRTCIceCandidateInit; successCallback : TProcedure; failureCallback : RTCPeerConnectionErrorCallback): TJSPromise;
     function addIceCandidate(candidate : TJSRTCIceCandidateInit; successCallback : TProcedure; failureCallback : RTCPeerConnectionErrorCallback): TJSPromise;
-    function generateCertificate(keygenAlgorithm : AlgorithmIdentifier): TJSPromise;
+    function generateCertificate(keygenAlgorithm : TJSCryptoAlgorithmIdentifier): TJSPromise;
     function getSenders: TTJSRTCRtpSenderDynArray;
     function getSenders: TTJSRTCRtpSenderDynArray;
     function getReceivers: TTJSRTCRtpReceiverDynArray;
     function getReceivers: TTJSRTCRtpReceiverDynArray;
     function getTransceivers: TTJSRTCRtpTransceiverDynArray;
     function getTransceivers: TTJSRTCRtpTransceiverDynArray;

+ 22 - 1
packages/rtl/websvg.pas → packages/rtl/src/websvg.pas

@@ -1,4 +1,20 @@
+{
+    This file is part of the Pas2JS run time library.
+    Copyright (c) 2022 by Michael Van Canneyt
+    
+    Browser SVG API definitions.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS}
 unit websvg;
 unit websvg;
+{$ENDIF}
 
 
 {$MODE ObjFPC}
 {$MODE ObjFPC}
 {$H+}
 {$H+}
@@ -6,7 +22,12 @@ unit websvg;
 
 
 interface
 interface
 
 
-uses SysUtils, web, JS;
+uses 
+{$IFDEF FPC_DOTTEDUNITS}
+  System.SysUtils, BrowserApi.Web, JSApi.JS;
+{$ELSE}
+  SysUtils, web, JS;
+{$ENDIF}
 
 
 type
 type
   // Forward class
   // Forward class

+ 51 - 0
packages/rtl/src/webutils.pas

@@ -0,0 +1,51 @@
+{
+    This file is part of the Pas2JS run time library.
+    Copyright (c) 2022 by Michael Van Canneyt
+    
+    Utility routines for in the browser. Deprecated.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{$IFNDEF FPC_DOTTEDUNITS}
+unit webutils deprecated 'Use rtl.HTMLUtils';
+{$ENDIF}
+
+{$mode objfpc}
+
+interface
+
+uses
+{$IFDEF FPC_DOTTEDUNITS}
+  BrowserApi.Web, JSApi.JS;
+{$ELSE}
+  web, js;
+{$ENDIF}  
+
+function AsyncSleep(ms: NativeInt): TJSPromise deprecated 'Use HTML.Utils.AsyncSleep';
+
+implementation
+
+function AsyncSleep(ms: NativeInt): TJSPromise;
+
+begin
+  Result := TJSPromise.New(
+  procedure(resolve,reject : TJSPromiseResolver)
+  begin
+    window.setTimeout(
+    procedure()
+    begin
+      resolve(ms);
+    end,
+    ms);
+  end);
+end;
+
+end.
+

+ 20 - 0
packages/rtl/webworker.pas → packages/rtl/src/webworker.pas

@@ -1,4 +1,20 @@
+{
+    This file is part of the Pas2JS run time library.
+    Copyright (c) 2022 by Michael Van Canneyt
+    
+    Browser WebWorker API definitions.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS}
 unit webworker;
 unit webworker;
+{$ENDIF}
 
 
 {$mode ObjFPC}
 {$mode ObjFPC}
 {$modeswitch externalclass}
 {$modeswitch externalclass}
@@ -6,7 +22,11 @@ unit webworker;
 interface
 interface
 
 
 uses
 uses
+{$IFDEF FPC_DOTTEDUNITS}
+  JSApi.JS, BrowserApi.WebOrWorker;
+{$ELSE}
   JS, weborworker;
   JS, weborworker;
+{$ENDIF}
 
 
 Type
 Type
 
 

+ 0 - 30
packages/rtl/webutils.pas

@@ -1,30 +0,0 @@
-unit webutils deprecated 'Use rtl.HTMLUtils';
-
-{$mode objfpc}
-
-interface
-
-uses
-  web, js;
-
-function AsyncSleep(ms: NativeInt): TJSPromise deprecated 'Use rtl.HTMLUtils.AsyncSleep';
-
-implementation
-
-function AsyncSleep(ms: NativeInt): TJSPromise;
-
-begin
-  Result := TJSPromise.New(
-  procedure(resolve,reject : TJSPromiseResolver)
-  begin
-    window.setTimeout(
-    procedure()
-    begin
-      resolve(ms);
-    end,
-    ms);
-  end);
-end;
-
-end.
-