@mlightcad/cad-simple-viewer 1.8.0-preview.0 → 1.8.0-preview.2

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 (54) hide show
  1. package/README.md +14 -0
  2. package/dist/cad-simple-viewer-AcUiFileOpenSession-BCcqBAH9.js +2427 -0
  3. package/dist/cad-simple-viewer-AcUiFileOpenSession-drptdOYc.js +324 -0
  4. package/dist/cad-simple-viewer-file-open-panel.js +32 -0
  5. package/dist/cad-simple-viewer-file-open-panel.umd.cjs +1 -0
  6. package/dist/cad-simple-viewer.js +7637 -9757
  7. package/dist/cad-simple-viewer.umd.cjs +122 -444
  8. package/dist/mtext-renderer-worker.js +854 -778
  9. package/file-open-panel.ts +6 -0
  10. package/lib/app/AcApOpenDatabaseOptions.d.ts +1 -1
  11. package/lib/app/AcApOpenDatabaseOptions.d.ts.map +1 -1
  12. package/lib/app/dataSource/AcApDataSourceIds.d.ts +5 -0
  13. package/lib/app/dataSource/AcApDataSourceIds.d.ts.map +1 -0
  14. package/lib/app/dataSource/AcApDataSourceIds.js +5 -0
  15. package/lib/app/dataSource/AcApDataSourceIds.js.map +1 -0
  16. package/lib/app/dataSource/AcApLocalDataSource.d.ts +1 -2
  17. package/lib/app/dataSource/AcApLocalDataSource.d.ts.map +1 -1
  18. package/lib/app/dataSource/AcApLocalDataSource.js +2 -2
  19. package/lib/app/dataSource/AcApLocalDataSource.js.map +1 -1
  20. package/lib/app/dataSource/AcApUrlDataSource.d.ts +1 -2
  21. package/lib/app/dataSource/AcApUrlDataSource.d.ts.map +1 -1
  22. package/lib/app/dataSource/AcApUrlDataSource.js +2 -2
  23. package/lib/app/dataSource/AcApUrlDataSource.js.map +1 -1
  24. package/lib/app/dataSource/acapBuildDataSourceMenu.js +1 -1
  25. package/lib/app/dataSource/acapBuildDataSourceMenu.js.map +1 -1
  26. package/lib/app/dataSource/index.d.ts +3 -2
  27. package/lib/app/dataSource/index.d.ts.map +1 -1
  28. package/lib/app/dataSource/index.js +3 -2
  29. package/lib/app/dataSource/index.js.map +1 -1
  30. package/lib/file-open-panel.d.ts +15 -0
  31. package/lib/file-open-panel.d.ts.map +1 -0
  32. package/lib/file-open-panel.js +33 -0
  33. package/lib/file-open-panel.js.map +1 -0
  34. package/lib/i18n/AcApI18n.d.ts.map +1 -1
  35. package/lib/i18n/AcApI18n.js +18 -9
  36. package/lib/i18n/AcApI18n.js.map +1 -1
  37. package/lib/ui/AcUiFileOpenLanding.d.ts +131 -0
  38. package/lib/ui/AcUiFileOpenLanding.d.ts.map +1 -0
  39. package/lib/ui/AcUiFileOpenLanding.js +248 -0
  40. package/lib/ui/AcUiFileOpenLanding.js.map +1 -0
  41. package/lib/ui/AcUiFileOpenPanel.d.ts +25 -5
  42. package/lib/ui/AcUiFileOpenPanel.d.ts.map +1 -1
  43. package/lib/ui/AcUiFileOpenPanel.js +25 -13
  44. package/lib/ui/AcUiFileOpenPanel.js.map +1 -1
  45. package/lib/ui/AcUiFileOpenSession.d.ts +119 -0
  46. package/lib/ui/AcUiFileOpenSession.d.ts.map +1 -0
  47. package/lib/ui/AcUiFileOpenSession.js +294 -0
  48. package/lib/ui/AcUiFileOpenSession.js.map +1 -0
  49. package/lib/ui/index.d.ts +2 -0
  50. package/lib/ui/index.d.ts.map +1 -1
  51. package/lib/ui/index.js +2 -0
  52. package/lib/ui/index.js.map +1 -1
  53. package/package.json +16 -6
  54. package/src/file-open-panel.ts +89 -0
@@ -0,0 +1,119 @@
1
+ import type { AcApDataSource } from '../app/dataSource/AcApDataSource';
2
+ import type { AcApDataSourceManager } from '../app/dataSource/AcApDataSourceManager';
3
+ import type { AcEdUiTheme } from '../editor/global/AcEdUiTheme';
4
+ import { AcUiFileOpenLanding, type AcUiFileOpenLandingOptions, type AcUiFileOpenRequest } from './AcUiFileOpenLanding';
5
+ /**
6
+ * Minimal DocManager surface needed by {@link AcUiFileOpenSession}.
7
+ *
8
+ * Hosts typically return `AcApDocManager.instance` after a dynamic import of
9
+ * `@mlightcad/cad-simple-viewer`. Keeping this structural avoids pulling the
10
+ * viewer into the `/file-open-panel` entry graph.
11
+ */
12
+ export interface AcUiFileOpenDocManager {
13
+ readonly dataSourceManager: AcApDataSourceManager;
14
+ openDocument(fileName: string, content: ArrayBuffer, options?: unknown): Promise<boolean>;
15
+ openUrl(url: string, options?: unknown): Promise<boolean>;
16
+ newDocument(options?: unknown): Promise<boolean>;
17
+ }
18
+ /** Outcome of {@link AcUiFileOpenSession.open}. */
19
+ export type AcUiFileOpenSessionResult = {
20
+ ok: true;
21
+ } | {
22
+ ok: false;
23
+ error?: unknown;
24
+ };
25
+ export type AcUiFileOpenSessionOptions = Omit<AcUiFileOpenLandingOptions, 'onOpen'> & {
26
+ /**
27
+ * Lazily creates (or returns) the viewer DocManager.
28
+ * Called once on the first open; subsequent opens reuse the instance.
29
+ */
30
+ createDocManager: () => Promise<AcUiFileOpenDocManager>;
31
+ /** Optional options object passed to openDocument / openUrl / newDocument. */
32
+ getOpenOptions?: () => unknown;
33
+ /** Runs before ensure/open (e.g. show a loading indicator). */
34
+ onBeforeOpen?: (request: AcUiFileOpenRequest) => void | Promise<void>;
35
+ /**
36
+ * Runs after DocManager is ready and sources are attached, immediately
37
+ * before `openDocument` / `openUrl` / `newDocument` (e.g. set OPENPROF).
38
+ */
39
+ onPrepareOpen?: (request: AcUiFileOpenRequest, docManager: AcUiFileOpenDocManager) => void | Promise<void>;
40
+ /** Runs after open settles (success or failure). */
41
+ onAfterOpen?: (request: AcUiFileOpenRequest, result: AcUiFileOpenSessionResult) => void | Promise<void>;
42
+ };
43
+ /**
44
+ * Landing + lazy DocManager session.
45
+ *
46
+ * On each open request the session:
47
+ * 1. Calls {@link AcUiFileOpenSessionOptions.createDocManager} once
48
+ * 2. Attaches landing cloud sources onto the DocManager registry
49
+ * 3. Runs `openDocument` / `openUrl` / `newDocument`
50
+ *
51
+ * The `/file-open-panel` entry stays light — the host supplies DocManager via
52
+ * dynamic `import('@mlightcad/cad-simple-viewer')` inside `createDocManager`.
53
+ */
54
+ export declare class AcUiFileOpenSession {
55
+ readonly landing: AcUiFileOpenLanding;
56
+ private readonly options;
57
+ private docManager;
58
+ private ensurePromise;
59
+ /** Bumped on {@link dispose} so in-flight `createDocManager` results are dropped. */
60
+ private ensureGeneration;
61
+ /** Chains {@link open} calls so overlapping picks do not interleave. */
62
+ private openTail;
63
+ private disposed;
64
+ constructor(options: AcUiFileOpenSessionOptions);
65
+ /** Landing data-source registry. */
66
+ get manager(): AcApDataSourceManager;
67
+ /** Effective card theme. */
68
+ get theme(): AcEdUiTheme;
69
+ /** Cached DocManager after the first successful {@link ensureDocManager}. */
70
+ get docManagerInstance(): AcUiFileOpenDocManager | null;
71
+ /**
72
+ * Registers a cloud (or custom) data source on the landing registry.
73
+ *
74
+ * When DocManager already exists, the same instance is attached there too
75
+ * so late async plugin registration still reaches in-viewer File → Open.
76
+ *
77
+ * @param source - Source to register
78
+ */
79
+ registerSource(source: AcApDataSource): void;
80
+ /**
81
+ * Removes a data source from the landing registry (and DocManager when ready).
82
+ *
83
+ * @param id - Source id
84
+ */
85
+ unregisterSource(id: string): void;
86
+ setTheme(theme: AcEdUiTheme | undefined): void;
87
+ refreshSourceButtons(): void;
88
+ /**
89
+ * Ensures DocManager exists and landing sources are attached.
90
+ *
91
+ * @returns The DocManager instance
92
+ */
93
+ ensureDocManager(): Promise<AcUiFileOpenDocManager>;
94
+ /**
95
+ * Opens a normalized landing request (also used by the panel `onOpen` path).
96
+ *
97
+ * Concurrent calls are serialized so overlapping picks do not interleave
98
+ * against the same DocManager.
99
+ *
100
+ * @param request - File / URL / new drawing intent
101
+ */
102
+ open(request: AcUiFileOpenRequest): Promise<AcUiFileOpenSessionResult>;
103
+ private openExclusive;
104
+ /**
105
+ * Disposes the landing panel.
106
+ *
107
+ * In-flight {@link ensureDocManager} / {@link open} calls observe disposal and
108
+ * stop attaching sources or opening; the host still owns any DocManager that
109
+ * `createDocManager` already constructed.
110
+ */
111
+ dispose(): void;
112
+ }
113
+ /**
114
+ * Creates a landing + lazy DocManager session.
115
+ *
116
+ * @param options - Session options including {@link createDocManager}
117
+ */
118
+ export declare function acuiCreateFileOpenSession(options: AcUiFileOpenSessionOptions): AcUiFileOpenSession;
119
+ //# sourceMappingURL=AcUiFileOpenSession.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcUiFileOpenSession.d.ts","sourceRoot":"","sources":["../../src/ui/AcUiFileOpenSession.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AACtE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAA;AACpF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,EACL,mBAAmB,EACnB,KAAK,0BAA0B,EAC/B,KAAK,mBAAmB,EACzB,MAAM,uBAAuB,CAAA;AAE9B;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,iBAAiB,EAAE,qBAAqB,CAAA;IACjD,YAAY,CACV,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE,OAAO,GAChB,OAAO,CAAC,OAAO,CAAC,CAAA;IACnB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IACzD,WAAW,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CACjD;AAED,mDAAmD;AACnD,MAAM,MAAM,yBAAyB,GACjC;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GACZ;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AAElC,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAC3C,0BAA0B,EAC1B,QAAQ,CACT,GAA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E,WAAW,GAAG,SAAS,GAAG,IAAI;IAI9C,oBAAoB,IAAI,IAAI;IAI5B;;;;OAIG;IACG,gBAAgB,IAAI,OAAO,CAAC,sBAAsB,CAAC;IA0BzD;;;;;;;OAOG;IACG,IAAI,CACR,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,yBAAyB,CAAC;YAUvB,aAAa;IA8C3B;;;;;;OAMG;IACH,OAAO,IAAI,IAAI;CAOhB;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,0BAA0B,GAClC,mBAAmB,CAErB"}
@@ -0,0 +1,294 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
23
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ var __rest = (this && this.__rest) || function (s, e) {
49
+ var t = {};
50
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
51
+ t[p] = s[p];
52
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
53
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
54
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
55
+ t[p[i]] = s[p[i]];
56
+ }
57
+ return t;
58
+ };
59
+ import { AcUiFileOpenLanding } from './AcUiFileOpenLanding';
60
+ /**
61
+ * Landing + lazy DocManager session.
62
+ *
63
+ * On each open request the session:
64
+ * 1. Calls {@link AcUiFileOpenSessionOptions.createDocManager} once
65
+ * 2. Attaches landing cloud sources onto the DocManager registry
66
+ * 3. Runs `openDocument` / `openUrl` / `newDocument`
67
+ *
68
+ * The `/file-open-panel` entry stays light — the host supplies DocManager via
69
+ * dynamic `import('@mlightcad/cad-simple-viewer')` inside `createDocManager`.
70
+ */
71
+ var AcUiFileOpenSession = /** @class */ (function () {
72
+ function AcUiFileOpenSession(options) {
73
+ var _this = this;
74
+ this.docManager = null;
75
+ this.ensurePromise = null;
76
+ /** Bumped on {@link dispose} so in-flight `createDocManager` results are dropped. */
77
+ this.ensureGeneration = 0;
78
+ /** Chains {@link open} calls so overlapping picks do not interleave. */
79
+ this.openTail = Promise.resolve();
80
+ this.disposed = false;
81
+ this.options = options;
82
+ var _createDocManager = options.createDocManager, _getOpenOptions = options.getOpenOptions, _onBeforeOpen = options.onBeforeOpen, _onPrepareOpen = options.onPrepareOpen, _onAfterOpen = options.onAfterOpen, landingOptions = __rest(options, ["createDocManager", "getOpenOptions", "onBeforeOpen", "onPrepareOpen", "onAfterOpen"]);
83
+ this.landing = new AcUiFileOpenLanding(__assign(__assign({}, landingOptions), { onOpen: function (request) {
84
+ void _this.open(request);
85
+ } }));
86
+ }
87
+ Object.defineProperty(AcUiFileOpenSession.prototype, "manager", {
88
+ /** Landing data-source registry. */
89
+ get: function () {
90
+ return this.landing.manager;
91
+ },
92
+ enumerable: false,
93
+ configurable: true
94
+ });
95
+ Object.defineProperty(AcUiFileOpenSession.prototype, "theme", {
96
+ /** Effective card theme. */
97
+ get: function () {
98
+ return this.landing.theme;
99
+ },
100
+ enumerable: false,
101
+ configurable: true
102
+ });
103
+ Object.defineProperty(AcUiFileOpenSession.prototype, "docManagerInstance", {
104
+ /** Cached DocManager after the first successful {@link ensureDocManager}. */
105
+ get: function () {
106
+ return this.docManager;
107
+ },
108
+ enumerable: false,
109
+ configurable: true
110
+ });
111
+ /**
112
+ * Registers a cloud (or custom) data source on the landing registry.
113
+ *
114
+ * When DocManager already exists, the same instance is attached there too
115
+ * so late async plugin registration still reaches in-viewer File → Open.
116
+ *
117
+ * @param source - Source to register
118
+ */
119
+ AcUiFileOpenSession.prototype.registerSource = function (source) {
120
+ if (this.disposed)
121
+ return;
122
+ this.landing.registerSource(source);
123
+ if (this.docManager) {
124
+ this.landing.attachSourcesTo(this.docManager.dataSourceManager);
125
+ this.landing.refreshSourceButtons();
126
+ }
127
+ };
128
+ /**
129
+ * Removes a data source from the landing registry (and DocManager when ready).
130
+ *
131
+ * @param id - Source id
132
+ */
133
+ AcUiFileOpenSession.prototype.unregisterSource = function (id) {
134
+ var _a;
135
+ if (this.disposed)
136
+ return;
137
+ this.landing.unregisterSource(id);
138
+ (_a = this.docManager) === null || _a === void 0 ? void 0 : _a.dataSourceManager.unregister(id);
139
+ };
140
+ AcUiFileOpenSession.prototype.setTheme = function (theme) {
141
+ this.landing.setTheme(theme);
142
+ };
143
+ AcUiFileOpenSession.prototype.refreshSourceButtons = function () {
144
+ this.landing.refreshSourceButtons();
145
+ };
146
+ /**
147
+ * Ensures DocManager exists and landing sources are attached.
148
+ *
149
+ * @returns The DocManager instance
150
+ */
151
+ AcUiFileOpenSession.prototype.ensureDocManager = function () {
152
+ return __awaiter(this, void 0, void 0, function () {
153
+ var generation_1;
154
+ var _this = this;
155
+ return __generator(this, function (_a) {
156
+ if (this.disposed) {
157
+ throw new Error('AcUiFileOpenSession is disposed');
158
+ }
159
+ if (this.docManager)
160
+ return [2 /*return*/, this.docManager];
161
+ if (!this.ensurePromise) {
162
+ generation_1 = this.ensureGeneration;
163
+ this.ensurePromise = this.options
164
+ .createDocManager()
165
+ .then(function (dm) {
166
+ if (_this.disposed || generation_1 !== _this.ensureGeneration) {
167
+ throw new Error('AcUiFileOpenSession is disposed');
168
+ }
169
+ _this.docManager = dm;
170
+ _this.landing.attachSourcesTo(dm.dataSourceManager);
171
+ _this.landing.refreshSourceButtons();
172
+ return dm;
173
+ })
174
+ .catch(function (error) {
175
+ _this.ensurePromise = null;
176
+ throw error;
177
+ });
178
+ }
179
+ return [2 /*return*/, this.ensurePromise];
180
+ });
181
+ });
182
+ };
183
+ /**
184
+ * Opens a normalized landing request (also used by the panel `onOpen` path).
185
+ *
186
+ * Concurrent calls are serialized so overlapping picks do not interleave
187
+ * against the same DocManager.
188
+ *
189
+ * @param request - File / URL / new drawing intent
190
+ */
191
+ AcUiFileOpenSession.prototype.open = function (request) {
192
+ return __awaiter(this, void 0, void 0, function () {
193
+ var run, resultPromise;
194
+ var _this = this;
195
+ return __generator(this, function (_a) {
196
+ run = function () { return _this.openExclusive(request); };
197
+ resultPromise = this.openTail.then(run, run);
198
+ this.openTail = resultPromise.then(function () { return undefined; }, function () { return undefined; });
199
+ return [2 /*return*/, resultPromise];
200
+ });
201
+ });
202
+ };
203
+ AcUiFileOpenSession.prototype.openExclusive = function (request) {
204
+ return __awaiter(this, void 0, void 0, function () {
205
+ var result, dm, openOptions, success, content, error_1;
206
+ var _a, _b, _c, _d, _e, _f, _g, _h;
207
+ return __generator(this, function (_j) {
208
+ switch (_j.label) {
209
+ case 0:
210
+ if (this.disposed) {
211
+ return [2 /*return*/, { ok: false, error: new Error('AcUiFileOpenSession is disposed') }];
212
+ }
213
+ return [4 /*yield*/, ((_b = (_a = this.options).onBeforeOpen) === null || _b === void 0 ? void 0 : _b.call(_a, request))];
214
+ case 1:
215
+ _j.sent();
216
+ _j.label = 2;
217
+ case 2:
218
+ _j.trys.push([2, 12, , 13]);
219
+ return [4 /*yield*/, this.ensureDocManager()];
220
+ case 3:
221
+ dm = _j.sent();
222
+ if (this.disposed) {
223
+ return [2 /*return*/, {
224
+ ok: false,
225
+ error: new Error('AcUiFileOpenSession is disposed')
226
+ }];
227
+ }
228
+ return [4 /*yield*/, ((_d = (_c = this.options).onPrepareOpen) === null || _d === void 0 ? void 0 : _d.call(_c, request, dm))];
229
+ case 4:
230
+ _j.sent();
231
+ openOptions = (_f = (_e = this.options).getOpenOptions) === null || _f === void 0 ? void 0 : _f.call(_e);
232
+ success = false;
233
+ if (!(request.kind === 'file')) return [3 /*break*/, 7];
234
+ return [4 /*yield*/, request.file.arrayBuffer()];
235
+ case 5:
236
+ content = _j.sent();
237
+ return [4 /*yield*/, dm.openDocument(request.file.name, content, openOptions)];
238
+ case 6:
239
+ success = _j.sent();
240
+ return [3 /*break*/, 11];
241
+ case 7:
242
+ if (!(request.kind === 'url')) return [3 /*break*/, 9];
243
+ return [4 /*yield*/, dm.openUrl(request.url, openOptions)];
244
+ case 8:
245
+ success = _j.sent();
246
+ return [3 /*break*/, 11];
247
+ case 9: return [4 /*yield*/, dm.newDocument(openOptions)];
248
+ case 10:
249
+ success = _j.sent();
250
+ _j.label = 11;
251
+ case 11:
252
+ // `false` usually means the viewer already reported via event bus
253
+ // (`failed-to-open-file`); avoid inventing a duplicate error here.
254
+ result = success ? { ok: true } : { ok: false };
255
+ return [3 /*break*/, 13];
256
+ case 12:
257
+ error_1 = _j.sent();
258
+ result = { ok: false, error: error_1 };
259
+ return [3 /*break*/, 13];
260
+ case 13: return [4 /*yield*/, ((_h = (_g = this.options).onAfterOpen) === null || _h === void 0 ? void 0 : _h.call(_g, request, result))];
261
+ case 14:
262
+ _j.sent();
263
+ return [2 /*return*/, result];
264
+ }
265
+ });
266
+ });
267
+ };
268
+ /**
269
+ * Disposes the landing panel.
270
+ *
271
+ * In-flight {@link ensureDocManager} / {@link open} calls observe disposal and
272
+ * stop attaching sources or opening; the host still owns any DocManager that
273
+ * `createDocManager` already constructed.
274
+ */
275
+ AcUiFileOpenSession.prototype.dispose = function () {
276
+ if (this.disposed)
277
+ return;
278
+ this.disposed = true;
279
+ this.ensureGeneration += 1;
280
+ this.ensurePromise = null;
281
+ this.landing.dispose();
282
+ };
283
+ return AcUiFileOpenSession;
284
+ }());
285
+ export { AcUiFileOpenSession };
286
+ /**
287
+ * Creates a landing + lazy DocManager session.
288
+ *
289
+ * @param options - Session options including {@link createDocManager}
290
+ */
291
+ export function acuiCreateFileOpenSession(options) {
292
+ return new AcUiFileOpenSession(options);
293
+ }
294
+ //# sourceMappingURL=AcUiFileOpenSession.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcUiFileOpenSession.js","sourceRoot":"","sources":["../../src/ui/AcUiFileOpenSession.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,OAAO,EACL,mBAAmB,EAGpB,MAAM,uBAAuB,CAAA;AAqD9B;;;;;;;;;;GAUG;AACH;IAYE,6BAAY,OAAmC;QAA/C,iBAiBC;QAzBO,eAAU,GAAkC,IAAI,CAAA;QAChD,kBAAa,GAA2C,IAAI,CAAA;QACpE,qFAAqF;QAC7E,qBAAgB,GAAG,CAAC,CAAA;QAC5B,wEAAwE;QAChE,aAAQ,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAA;QAC3C,aAAQ,GAAG,KAAK,CAAA;QAGtB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QAEpB,IAAkB,iBAAiB,GAMjC,OAAO,iBAN0B,EACnB,eAAe,GAK7B,OAAO,eALsB,EACjB,aAAa,GAIzB,OAAO,aAJkB,EACZ,cAAc,GAG3B,OAAO,cAHoB,EAChB,YAAY,GAEvB,OAAO,YAFgB,EACtB,cAAc,UACf,OAAO,EAPL,sFAOL,CADkB,CACR;QAEX,IAAI,CAAC,OAAO,GAAG,IAAI,mBAAmB,uBACjC,cAAc,KACjB,MAAM,EAAE,UAAA,OAAO;gBACb,KAAK,KAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YACzB,CAAC,IACD,CAAA;IACJ,CAAC;IAGD,sBAAI,wCAAO;QADX,oCAAoC;aACpC;YACE,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAA;QAC7B,CAAC;;;OAAA;IAGD,sBAAI,sCAAK;QADT,4BAA4B;aAC5B;YACE,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAA;QAC3B,CAAC;;;OAAA;IA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,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAA;;;;wBAE/C,MAAM,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,SAAA,EAAE,CAAA;;6BAG/B,qBAAM,CAAA,MAAA,MAAA,IAAI,CAAC,OAAO,EAAC,WAAW,mDAAG,OAAO,EAAE,MAAM,CAAC,CAAA,EAAA;;wBAAjD,SAAiD,CAAA;wBACjD,sBAAO,MAAM,EAAA;;;;KACd;IAED;;;;;;OAMG;IACH,qCAAO,GAAP;QACE,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAM;QACzB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAA;QACpB,IAAI,CAAC,gBAAgB,IAAI,CAAC,CAAA;QAC1B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAA;QACzB,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAA;IACxB,CAAC;IACH,0BAAC;AAAD,CAAC,AAjMD,IAiMC;;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CACvC,OAAmC;IAEnC,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAA;AACzC,CAAC"}
package/lib/ui/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export * from './AcUiDialog';
2
+ export * from './AcUiFileOpenLanding';
2
3
  export * from './AcUiFileOpenPanel';
4
+ export * from './AcUiFileOpenSession';
3
5
  export * from './AcUiAboutDialog';
4
6
  export * from './AcUiAciPaletteUi';
5
7
  export * from './AcUiAciColorDialog';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iCAAiC,CAAA;AAC/C,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,0BAA0B,CAAA;AACxC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,WAAW,CAAA;AACzB,cAAc,wBAAwB,CAAA;AACtC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iCAAiC,CAAA;AAC/C,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,0BAA0B,CAAA;AACxC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,WAAW,CAAA;AACzB,cAAc,wBAAwB,CAAA;AACtC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,SAAS,CAAA"}
package/lib/ui/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  export * from './AcUiDialog';
2
+ export * from './AcUiFileOpenLanding';
2
3
  export * from './AcUiFileOpenPanel';
4
+ export * from './AcUiFileOpenSession';
3
5
  export * from './AcUiAboutDialog';
4
6
  export * from './AcUiAciPaletteUi';
5
7
  export * from './AcUiAciColorDialog';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iCAAiC,CAAA;AAC/C,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,0BAA0B,CAAA;AACxC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,WAAW,CAAA;AACzB,cAAc,wBAAwB,CAAA;AACtC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,SAAS,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iCAAiC,CAAA;AAC/C,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,0BAA0B,CAAA;AACxC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,WAAW,CAAA;AACzB,cAAc,wBAAwB,CAAA;AACtC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,SAAS,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mlightcad/cad-simple-viewer",
3
- "version": "1.8.0-preview.0",
3
+ "version": "1.8.0-preview.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -23,8 +23,10 @@
23
23
  "lib",
24
24
  "icons.ts",
25
25
  "find.ts",
26
+ "file-open-panel.ts",
26
27
  "src/ui/icons.ts",
27
28
  "src/find",
29
+ "src/file-open-panel.ts",
28
30
  "README.md",
29
31
  "package.json"
30
32
  ],
@@ -37,6 +39,14 @@
37
39
  "import": "./dist/cad-simple-viewer.js",
38
40
  "require": "./dist/cad-simple-viewer.umd.cjs"
39
41
  },
42
+ "./file-open-panel": {
43
+ "types": "./lib/file-open-panel.d.ts",
44
+ "import": {
45
+ "development": "./src/file-open-panel.ts",
46
+ "default": "./dist/cad-simple-viewer-file-open-panel.js"
47
+ },
48
+ "default": "./dist/cad-simple-viewer-file-open-panel.js"
49
+ },
40
50
  "./icons": {
41
51
  "types": "./src/ui/icons.ts",
42
52
  "import": "./src/ui/icons.ts",
@@ -50,9 +60,9 @@
50
60
  },
51
61
  "devDependencies": {
52
62
  "@mlightcad/data-model": "1.15.22",
53
- "@mlightcad/mtext-input-box": "0.3.7",
63
+ "@mlightcad/mtext-input-box": "0.3.8",
54
64
  "@mlightcad/mtext-parser": "1.5.7",
55
- "@mlightcad/mtext-renderer": "0.13.7",
65
+ "@mlightcad/mtext-renderer": "0.13.8",
56
66
  "@mlightcad/three-viewcube": "0.0.9",
57
67
  "@types/lodash-es": "^4.17.12",
58
68
  "@types/rbush": "^3.0.4",
@@ -61,15 +71,15 @@
61
71
  "mitt": "^3.0.1",
62
72
  "rbush": "^4.0.1",
63
73
  "three": "^0.186.1",
64
- "@mlightcad/three-renderer": "1.8.0-preview.0"
74
+ "@mlightcad/three-renderer": "1.8.0-preview.2"
65
75
  },
66
76
  "peerDependencies": {
67
77
  "@mlightcad/data-model": "1.15.22",
68
78
  "@mlightcad/mtext-parser": "1.5.7",
69
- "@mlightcad/mtext-renderer": "0.13.7",
79
+ "@mlightcad/mtext-renderer": "0.13.8",
70
80
  "lodash-es": "4.17.21",
71
81
  "three": "^0.186.1",
72
- "@mlightcad/three-renderer": "^1.8.0-preview.0"
82
+ "@mlightcad/three-renderer": "^1.8.0-preview.2"
73
83
  },
74
84
  "scripts": {
75
85
  "clean": "rimraf dist lib tsconfig.tsbuildinfo",
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Subpath entry for `@mlightcad/cad-simple-viewer/file-open-panel`.
3
+ *
4
+ * Landing-page file open UI and data-source registry helpers that do **not**
5
+ * depend on {@link AcApDocManager}, three.js, or the command/view stack.
6
+ * Import this from demo / host landing pages so the full viewer stays lazy.
7
+ */
8
+ import { AcApI18n } from './i18n/AcApI18n'
9
+ import arMain from './i18n/ar/main'
10
+ import csMain from './i18n/cs/main'
11
+ import enMain from './i18n/en/main'
12
+ import trMain from './i18n/tr/main'
13
+ import zhMain from './i18n/zh/main'
14
+
15
+ // Register only `main.*` strings needed by the panel (not command/jig catalogs).
16
+ AcApI18n.mergeLocaleMessage('en', { main: enMain })
17
+ AcApI18n.mergeLocaleMessage('zh', { main: zhMain })
18
+ AcApI18n.mergeLocaleMessage('tr', { main: trMain })
19
+ AcApI18n.mergeLocaleMessage('cs', { main: csMain })
20
+ AcApI18n.mergeLocaleMessage('ar', { main: arMain })
21
+
22
+ export {
23
+ AcApOpenViewMode,
24
+ type AcApOpenDatabaseOptions
25
+ } from './app/AcApOpenDatabaseOptions'
26
+ export {
27
+ acedIsCompactUiLayout,
28
+ ML_UI_COMPACT_MAX_WIDTH,
29
+ ML_UI_COMPACT_MEDIA_QUERY,
30
+ ML_UI_MOBILE_MAX_WIDTH,
31
+ ML_UI_MOBILE_MEDIA_QUERY
32
+ } from './editor/global/AcEdUiLayout'
33
+ export type {
34
+ AcApDataSource,
35
+ AcApDataSourceAccountProfile,
36
+ AcApDataSourceAuthState,
37
+ AcApDataSourceFile
38
+ } from './app/dataSource/AcApDataSource'
39
+ export {
40
+ ACAP_LOCAL_DATA_SOURCE_ID,
41
+ ACAP_URL_DATA_SOURCE_ID
42
+ } from './app/dataSource/AcApDataSourceIds'
43
+ export {
44
+ AcApDataSourceManager,
45
+ type AcApDataSourceManagerEvents
46
+ } from './app/dataSource/AcApDataSourceManager'
47
+ export {
48
+ acapBuildDataSourceMenu,
49
+ acapIsSingleLocalOpen,
50
+ type AcApDataSourceMenuAction,
51
+ type AcApDataSourceMenuItem
52
+ } from './app/dataSource/acapBuildDataSourceMenu'
53
+ export { acapInvokeDataSourceMenuAction } from './app/dataSource/acapInvokeDataSourceMenuAction'
54
+ export { acapOpenCenteredPopup } from './app/dataSource/acapOpenCenteredPopup'
55
+ export {
56
+ acedApplyUiTheme,
57
+ acedSubscribeUiTheme,
58
+ type AcEdApplyUiThemeOptions,
59
+ type AcEdUiTheme,
60
+ resolveUiTheme
61
+ } from './editor/global/AcEdUiTheme'
62
+ export { AcEdOpenMode } from './editor/view/AcEdOpenMode'
63
+ export {
64
+ AcApI18n,
65
+ type AcApLocale,
66
+ type AcApLocaleChangedEventArgs,
67
+ type AcApLocaleMessage,
68
+ type AcApLocaleMessages,
69
+ type AcApTranslateOptions
70
+ } from './i18n/AcApI18n'
71
+ export {
72
+ AcUiFileOpenLanding,
73
+ acuiAttachDataSources,
74
+ type AcUiFileOpenLandingOptions,
75
+ type AcUiFileOpenRequest
76
+ } from './ui/AcUiFileOpenLanding'
77
+ export {
78
+ AcUiFileOpenPanel,
79
+ type AcUiFileOpenPanelCardSize,
80
+ type AcUiFileOpenPanelOptions,
81
+ type AcUiFileOpenPanelResult
82
+ } from './ui/AcUiFileOpenPanel'
83
+ export {
84
+ AcUiFileOpenSession,
85
+ acuiCreateFileOpenSession,
86
+ type AcUiFileOpenDocManager,
87
+ type AcUiFileOpenSessionOptions,
88
+ type AcUiFileOpenSessionResult
89
+ } from './ui/AcUiFileOpenSession'