@breakside/jskit 2024.22.0 → 2024.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/Frameworks/DOM.jsframework/Info.json +2 -2
  2. package/Frameworks/DOM.jsframework/io.breakside.JSKit.DOM-bundle.js +2 -2
  3. package/Frameworks/FontKit.jsframework/Info.json +2 -2
  4. package/Frameworks/FontKit.jsframework/io.breakside.JSKit.FontKit-bundle.js +2 -2
  5. package/Frameworks/Foundation.jsframework/Info.json +2 -2
  6. package/Frameworks/Foundation.jsframework/JS/JSAttributedString.js +32 -0
  7. package/Frameworks/Foundation.jsframework/JS/JSHTMLTextParser.js +584 -0
  8. package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
  9. package/Frameworks/Foundation.jsframework/sources.json +3 -0
  10. package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
  11. package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
  12. package/Info.json +2 -2
  13. package/Node/io.breakside.jskit-bundle.js +2 -2
  14. package/Node/jskit +1 -0
  15. package/Root/Frameworks/APIKit/Info.yaml +1 -1
  16. package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
  17. package/Root/Frameworks/AuthKit/Info.yaml +1 -1
  18. package/Root/Frameworks/CSSOM/Info.yaml +1 -1
  19. package/Root/Frameworks/ChartKit/Info.yaml +1 -1
  20. package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
  21. package/Root/Frameworks/DBKit/Info.yaml +1 -1
  22. package/Root/Frameworks/DOM/Info.yaml +1 -1
  23. package/Root/Frameworks/Dispatch/Info.yaml +1 -1
  24. package/Root/Frameworks/FontKit/Info.yaml +1 -1
  25. package/Root/Frameworks/Foundation/Info.yaml +1 -1
  26. package/Root/Frameworks/Foundation/JSAttributedString.js +32 -0
  27. package/Root/Frameworks/Foundation/JSHTMLTextParser.js +584 -0
  28. package/Root/Frameworks/ImageKit/Info.yaml +1 -1
  29. package/Root/Frameworks/MediaKit/Info.yaml +1 -1
  30. package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
  31. package/Root/Frameworks/NotificationKit/Info.yaml +1 -1
  32. package/Root/Frameworks/PDFKit/Info.yaml +1 -1
  33. package/Root/Frameworks/QRKit/Info.yaml +1 -1
  34. package/Root/Frameworks/SearchKit/Info.yaml +1 -1
  35. package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
  36. package/Root/Frameworks/ServerKit/Info.yaml +1 -1
  37. package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
  38. package/Root/Frameworks/TestKit/Info.yaml +1 -1
  39. package/Root/Frameworks/UIKit/Info.yaml +1 -1
  40. package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
  41. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "JSBundleType": "framework",
3
3
  "JSBundleIdentifier": "io.breakside.JSKit.DOM",
4
- "JSBundleVersion": "2024.22.0",
4
+ "JSBundleVersion": "2024.24.0",
5
5
  "JSDevelopmentLanguage": "en",
6
6
  "JSCopyright": "Copyright © 2020 Breakside Inc.",
7
7
  "JSBundleEnvironments": {
@@ -9,5 +9,5 @@
9
9
  "node": "DOM+Node.js"
10
10
  },
11
11
  "JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
12
- "GitRevision": "525f95aef8e447ed12a30cbfb600e16308ab8d97"
12
+ "GitRevision": "ee315347cd47b683c4dde72b26fece996ad63d72"
13
13
  }
@@ -3,7 +3,7 @@ JSBundle.bundles['io.breakside.JSKit.DOM'] = {
3
3
  "Info": {
4
4
  "JSBundleType": "framework",
5
5
  "JSBundleIdentifier": "io.breakside.JSKit.DOM",
6
- "JSBundleVersion": "2024.22.0",
6
+ "JSBundleVersion": "2024.24.0",
7
7
  "JSDevelopmentLanguage": "en",
8
8
  "JSCopyright": "Copyright © 2020 Breakside Inc.",
9
9
  "JSBundleEnvironments": {
@@ -11,7 +11,7 @@ JSBundle.bundles['io.breakside.JSKit.DOM'] = {
11
11
  "node": "DOM+Node.js"
12
12
  },
13
13
  "JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
14
- "GitRevision": "525f95aef8e447ed12a30cbfb600e16308ab8d97"
14
+ "GitRevision": "ee315347cd47b683c4dde72b26fece996ad63d72"
15
15
  },
16
16
  "Resources": [],
17
17
  "ResourceLookup": {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "JSBundleType": "framework",
3
3
  "JSBundleIdentifier": "io.breakside.JSKit.FontKit",
4
- "JSBundleVersion": "2024.22.0",
4
+ "JSBundleVersion": "2024.24.0",
5
5
  "JSDevelopmentLanguage": "en",
6
6
  "JSCopyright": "Copyright © 2020 Breakside Inc.",
7
7
  "JSBundleEnvironments": {
8
8
  "html": "FontKit+HTML.js"
9
9
  },
10
10
  "JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
11
- "GitRevision": "525f95aef8e447ed12a30cbfb600e16308ab8d97"
11
+ "GitRevision": "ee315347cd47b683c4dde72b26fece996ad63d72"
12
12
  }
@@ -3,14 +3,14 @@ JSBundle.bundles['io.breakside.JSKit.FontKit'] = {
3
3
  "Info": {
4
4
  "JSBundleType": "framework",
5
5
  "JSBundleIdentifier": "io.breakside.JSKit.FontKit",
6
- "JSBundleVersion": "2024.22.0",
6
+ "JSBundleVersion": "2024.24.0",
7
7
  "JSDevelopmentLanguage": "en",
8
8
  "JSCopyright": "Copyright © 2020 Breakside Inc.",
9
9
  "JSBundleEnvironments": {
10
10
  "html": "FontKit+HTML.js"
11
11
  },
12
12
  "JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
13
- "GitRevision": "525f95aef8e447ed12a30cbfb600e16308ab8d97"
13
+ "GitRevision": "ee315347cd47b683c4dde72b26fece996ad63d72"
14
14
  },
15
15
  "Resources": [],
16
16
  "ResourceLookup": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "JSBundleType": "framework",
3
3
  "JSBundleIdentifier": "io.breakside.JSKit.Foundation",
4
- "JSBundleVersion": "2024.22.0",
4
+ "JSBundleVersion": "2024.24.0",
5
5
  "JSDevelopmentLanguage": "en",
6
6
  "JSCopyright": "Copyright © 2020 Breakside Inc.",
7
7
  "JSBundleEnvironments": {
@@ -9,5 +9,5 @@
9
9
  "node": "Foundation+Node.js"
10
10
  },
11
11
  "JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
12
- "GitRevision": "525f95aef8e447ed12a30cbfb600e16308ab8d97"
12
+ "GitRevision": "ee315347cd47b683c4dde72b26fece996ad63d72"
13
13
  }
@@ -18,6 +18,7 @@
18
18
  // #import "JSTextAttachment.js"
19
19
  // #import "JSFont.js"
20
20
  // #import "JSColor.js"
21
+ // #import "JSHTMLTextParser.js"
21
22
  'use strict';
22
23
 
23
24
  (function(){
@@ -197,6 +198,37 @@ JSClass("JSAttributedString", JSObject, {
197
198
  this.initWithAttachment(attachment);
198
199
  },
199
200
 
201
+ initWithHTML: function(html, options){
202
+ if (options === undefined){
203
+ options = {};
204
+ }
205
+ var string = "";
206
+ var run = JSAttributedStringRun(JSRange.Zero, {});
207
+ var runs = [run];
208
+ if (html !== null && html !== undefined){
209
+ var parser = JSHTMLTextParser.initWithHTML(html);
210
+ parser.delegate = {
211
+ htmlTextParserDidFindAttributedText: function(parser, text, attributes){
212
+ if (run.range.length === 0){
213
+ run.attributes = JSCopy(attributes);
214
+ run.range.length += text.length;
215
+ }else if (run.onlyContainsEqualAttributes(attributes)){
216
+ run.range.length += text.length;
217
+ }else{
218
+ run = JSAttributedStringRun(JSRange(run.range.end, text.length), attributes);
219
+ runs.push(run);
220
+ }
221
+ string += text;
222
+ }
223
+ };
224
+ parser.state.preserveWhitespace = options.preserveWhitespace === true;
225
+ parser.state.baseURL = options.baseURL || null;
226
+ parser.parse();
227
+ }
228
+ this._string = string;
229
+ this._runs = runs;
230
+ },
231
+
200
232
  // MARK: - Getting the unattributed string value
201
233
 
202
234
  getString: function(){