snice 7.1.0 → 7.1.1
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.
- package/README.md +5 -0
- package/adapters/react/SniceProvider.js +1 -1
- package/adapters/react/SniceRouter.js +1 -1
- package/adapters/react/matchRoute.js +1 -1
- package/adapters/react/useRequestHandler.js +1 -1
- package/dist/cdn/accordion/snice-accordion.js +1 -1
- package/dist/cdn/action-bar/snice-action-bar.js +1 -1
- package/dist/cdn/activity-feed/snice-activity-feed.js +1 -1
- package/dist/cdn/alert/snice-alert.js +1 -1
- package/dist/cdn/app-tiles/snice-app-tiles.js +1 -1
- package/dist/cdn/approval-flow/snice-approval-flow.js +1 -1
- package/dist/cdn/audio-recorder/snice-audio-recorder.js +1 -1
- package/dist/cdn/availability/snice-availability.js +1 -1
- package/dist/cdn/avatar/snice-avatar.js +1 -1
- package/dist/cdn/avatar-group/snice-avatar-group.js +1 -1
- package/dist/cdn/badge/snice-badge.js +1 -1
- package/dist/cdn/banner/snice-banner.js +1 -1
- package/dist/cdn/binpack/snice-binpack.js +1 -1
- package/dist/cdn/book/snice-book.js +1 -1
- package/dist/cdn/booking/snice-booking.js +1 -1
- package/dist/cdn/breadcrumbs/snice-breadcrumbs.js +1 -1
- package/dist/cdn/button/snice-button.js +1 -1
- package/dist/cdn/calendar/snice-calendar.js +1 -1
- package/dist/cdn/camera/snice-camera.js +1 -1
- package/dist/cdn/camera-annotate/snice-camera-annotate.js +1 -1
- package/dist/cdn/candlestick/snice-candlestick.js +1 -1
- package/dist/cdn/card/snice-card.js +1 -1
- package/dist/cdn/carousel/snice-carousel.js +1 -1
- package/dist/cdn/cart/snice-cart.js +1 -1
- package/dist/cdn/chart/snice-chart.js +1 -1
- package/dist/cdn/chat/snice-chat.js +1 -1
- package/dist/cdn/checkbox/snice-checkbox.js +1 -1
- package/dist/cdn/chip/snice-chip.js +1 -1
- package/dist/cdn/code-block/snice-code-block.js +1 -1
- package/dist/cdn/color-display/snice-color-display.js +1 -1
- package/dist/cdn/color-picker/snice-color-picker.js +1 -1
- package/dist/cdn/command-palette/snice-command-palette.js +1 -1
- package/dist/cdn/comments/snice-comments.js +1 -1
- package/dist/cdn/countdown/snice-countdown.js +1 -1
- package/dist/cdn/cropper/snice-cropper.js +1 -1
- package/dist/cdn/data-card/snice-data-card.js +1 -1
- package/dist/cdn/date-picker/snice-date-picker.js +1 -1
- package/dist/cdn/date-range-picker/snice-date-range-picker.js +1 -1
- package/dist/cdn/date-time-picker/snice-date-time-picker.js +1 -1
- package/dist/cdn/diff/snice-diff.js +1 -1
- package/dist/cdn/divider/snice-divider.js +1 -1
- package/dist/cdn/doc/snice-doc.js +1 -1
- package/dist/cdn/draw/snice-draw.js +1 -1
- package/dist/cdn/drawer/snice-drawer.js +1 -1
- package/dist/cdn/empty-state/snice-empty-state.js +1 -1
- package/dist/cdn/estimate/snice-estimate.js +1 -1
- package/dist/cdn/file-gallery/snice-file-gallery.js +1 -1
- package/dist/cdn/file-upload/snice-file-upload.js +1 -1
- package/dist/cdn/flip-card/snice-flip-card.js +1 -1
- package/dist/cdn/flow/snice-flow.js +1 -1
- package/dist/cdn/form-layout/snice-form-layout.js +1 -1
- package/dist/cdn/funnel/snice-funnel.js +1 -1
- package/dist/cdn/gantt/snice-gantt.js +1 -1
- package/dist/cdn/gauge/snice-gauge.js +1 -1
- package/dist/cdn/grid/snice-grid.js +1 -1
- package/dist/cdn/heatmap/snice-heatmap.js +1 -1
- package/dist/cdn/image/snice-image.js +1 -1
- package/dist/cdn/input/snice-input.js +1 -1
- package/dist/cdn/invoice/snice-invoice.js +1 -1
- package/dist/cdn/kanban/snice-kanban.js +1 -1
- package/dist/cdn/key-value/snice-key-value.js +1 -1
- package/dist/cdn/kpi/snice-kpi.js +1 -1
- package/dist/cdn/layout/snice-layout.js +1 -1
- package/dist/cdn/leaderboard/snice-leaderboard.js +1 -1
- package/dist/cdn/link/snice-link.js +1 -1
- package/dist/cdn/link-preview/snice-link-preview.js +1 -1
- package/dist/cdn/list/snice-list.js +1 -1
- package/dist/cdn/location/snice-location.js +1 -1
- package/dist/cdn/login/snice-login.js +1 -1
- package/dist/cdn/map/snice-map.js +1 -1
- package/dist/cdn/markdown/snice-markdown.js +1 -1
- package/dist/cdn/masonry/snice-masonry.js +1 -1
- package/dist/cdn/menu/snice-menu.js +1 -1
- package/dist/cdn/message-strip/snice-message-strip.js +1 -1
- package/dist/cdn/modal/snice-modal.js +1 -1
- package/dist/cdn/music-player/snice-music-player.js +1 -1
- package/dist/cdn/nav/snice-nav.js +1 -1
- package/dist/cdn/network-graph/snice-network-graph.js +1 -1
- package/dist/cdn/notification-center/snice-notification-center.js +1 -1
- package/dist/cdn/order-tracker/snice-order-tracker.js +1 -1
- package/dist/cdn/org-chart/snice-org-chart.js +1 -1
- package/dist/cdn/pagination/snice-pagination.js +1 -1
- package/dist/cdn/paint/snice-paint.js +1 -1
- package/dist/cdn/pdf-viewer/snice-pdf-viewer.js +1 -1
- package/dist/cdn/permission-matrix/snice-permission-matrix.js +1 -1
- package/dist/cdn/podcast-player/snice-podcast-player.js +1 -1
- package/dist/cdn/popover/snice-popover.js +1 -1
- package/dist/cdn/pricing-table/snice-pricing-table.js +1 -1
- package/dist/cdn/product-card/snice-product-card.js +1 -1
- package/dist/cdn/progress/snice-progress.js +1 -1
- package/dist/cdn/progress-ring/snice-progress-ring.js +1 -1
- package/dist/cdn/qr-code/snice-qr-code.js +1 -1
- package/dist/cdn/qr-reader/snice-qr-reader.js +1 -1
- package/dist/cdn/radio/snice-radio.js +1 -1
- package/dist/cdn/range-slider/snice-range-slider.js +1 -1
- package/dist/cdn/rating/snice-rating.js +1 -1
- package/dist/cdn/receipt/snice-receipt.js +1 -1
- package/dist/cdn/recipe/snice-recipe.js +1 -1
- package/dist/cdn/runtime/README.md +2 -2
- package/dist/cdn/runtime/snice-runtime.esm.js +114 -15
- package/dist/cdn/runtime/snice-runtime.esm.js.map +1 -1
- package/dist/cdn/runtime/snice-runtime.esm.min.js +1 -1
- package/dist/cdn/runtime/snice-runtime.esm.min.js.map +1 -1
- package/dist/cdn/runtime/snice-runtime.js +114 -15
- package/dist/cdn/runtime/snice-runtime.js.map +1 -1
- package/dist/cdn/runtime/snice-runtime.min.js +1 -1
- package/dist/cdn/runtime/snice-runtime.min.js.map +1 -1
- package/dist/cdn/sankey/snice-sankey.js +1 -1
- package/dist/cdn/segmented-control/snice-segmented-control.js +1 -1
- package/dist/cdn/select/snice-select.js +1 -1
- package/dist/cdn/skeleton/snice-skeleton.js +1 -1
- package/dist/cdn/slider/snice-slider.js +1 -1
- package/dist/cdn/sortable/snice-sortable.js +1 -1
- package/dist/cdn/sparkline/snice-sparkline.js +1 -1
- package/dist/cdn/spinner/snice-spinner.js +1 -1
- package/dist/cdn/split-button/snice-split-button.js +1 -1
- package/dist/cdn/split-pane/snice-split-pane.js +1 -1
- package/dist/cdn/spotlight/snice-spotlight.js +1 -1
- package/dist/cdn/stat-group/snice-stat-group.js +1 -1
- package/dist/cdn/step-input/snice-step-input.js +1 -1
- package/dist/cdn/stepper/snice-stepper.js +1 -1
- package/dist/cdn/switch/snice-switch.js +1 -1
- package/dist/cdn/table/snice-table.esm.js +1 -1
- package/dist/cdn/table/snice-table.js +1 -1
- package/dist/cdn/tabs/snice-tabs.js +1 -1
- package/dist/cdn/tag/snice-tag.js +1 -1
- package/dist/cdn/tag-input/snice-tag-input.js +1 -1
- package/dist/cdn/terminal/snice-terminal.js +1 -1
- package/dist/cdn/testimonial/snice-testimonial.js +1 -1
- package/dist/cdn/textarea/snice-textarea.js +1 -1
- package/dist/cdn/time-picker/snice-time-picker.js +1 -1
- package/dist/cdn/time-range-picker/snice-time-range-picker.js +1 -1
- package/dist/cdn/timeline/snice-timeline.js +1 -1
- package/dist/cdn/timer/snice-timer.js +1 -1
- package/dist/cdn/toast/snice-toast.js +1 -1
- package/dist/cdn/tooltip/snice-tooltip.js +1 -1
- package/dist/cdn/tree/snice-tree.js +1 -1
- package/dist/cdn/treemap/snice-treemap.js +1 -1
- package/dist/cdn/user-card/snice-user-card.js +1 -1
- package/dist/cdn/video-player/snice-video-player.js +1 -1
- package/dist/cdn/virtual-scroller/snice-virtual-scroller.js +1 -1
- package/dist/cdn/waterfall/snice-waterfall.js +1 -1
- package/dist/cdn/weather/snice-weather.js +1 -1
- package/dist/cdn/work-order/snice-work-order.js +1 -1
- package/dist/controller.d.ts +5 -0
- package/dist/index.cjs +111 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +111 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +111 -12
- package/dist/index.iife.js.map +1 -1
- package/dist/parts.d.ts +2 -2
- package/dist/react/SniceProvider.js +1 -1
- package/dist/react/SniceRouter.js +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/matchRoute.js +1 -1
- package/dist/react/useRequestHandler.js +1 -1
- package/dist/symbols.cjs +9 -1
- package/dist/symbols.cjs.map +1 -1
- package/dist/symbols.d.ts +2 -0
- package/dist/symbols.esm.js +8 -2
- package/dist/symbols.esm.js.map +1 -1
- package/dist/transitions.cjs +1 -1
- package/dist/transitions.esm.js +1 -1
- package/docs/ai/architecture.md +1 -1
- package/docs/ai/bindings.md +1 -1
- package/docs/ai/controllers.md +1 -1
- package/docs/ai/decorators.md +1 -1
- package/docs/ai/patterns.md +4 -3
- package/docs/bindings.md +1 -1
- package/docs/controllers.md +8 -2
- package/package.json +1 -1
package/dist/controller.d.ts
CHANGED
|
@@ -20,6 +20,11 @@ export declare function deferControllerAttachment(element: HTMLElement, controll
|
|
|
20
20
|
* pending attachments. Direct class binding only changes the attach side.
|
|
21
21
|
*/
|
|
22
22
|
export declare function isControllerClass(value: unknown): value is ControllerClass;
|
|
23
|
+
/**
|
|
24
|
+
* Restore the diagnostic attribute for an attached class controller. Returns
|
|
25
|
+
* true when the direct class channel owns the element.
|
|
26
|
+
*/
|
|
27
|
+
export declare function restoreDirectControllerAttribute(element: HTMLElement): boolean;
|
|
23
28
|
/**
|
|
24
29
|
* Attaches a controller to an element
|
|
25
30
|
* @param element The element to attach the controller to
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* snice v7.0
|
|
2
|
+
* snice v7.1.0
|
|
3
3
|
* A decorator-driven web component library with routing, controllers, daemons, and 130+ UI components. For better coding-agent results, run npx snice init-ai.
|
|
4
4
|
* (c) 2024
|
|
5
5
|
* Released under the MIT License.
|
|
@@ -62,9 +62,15 @@ const CONTROLLER_NAME_KEY = getSymbol('controller-name');
|
|
|
62
62
|
const CONTROLLER_ID = getSymbol('controller-id');
|
|
63
63
|
const CONTROLLER_OPERATIONS = getSymbol('controller-operations');
|
|
64
64
|
const NATIVE_CONTROLLER = getSymbol('native-controller');
|
|
65
|
+
// Decorator name stored on the class so direct class bindings can expose the
|
|
66
|
+
// same useful DOM label without resolving the controller through the registry.
|
|
67
|
+
const CONTROLLER_REGISTRY_NAME = getSymbol('controller-registry-name');
|
|
65
68
|
// Set while a controller CLASS (not a registry name) is attached — the
|
|
66
69
|
// attribute/MutationObserver channel must not attach over or detach it.
|
|
67
70
|
const DIRECT_CONTROLLER = getSymbol('direct-controller');
|
|
71
|
+
// Guards framework-authored diagnostic controller attribute writes from the
|
|
72
|
+
// synchronous custom-element attributeChangedCallback path.
|
|
73
|
+
const CONTROLLER_ATTRIBUTE_SYNC = getSymbol('controller-attribute-sync');
|
|
68
74
|
// A controller class bound by a template before the custom element was
|
|
69
75
|
// defined/upgraded. Picked up by connectedCallback on first initialization.
|
|
70
76
|
const PENDING_CONTROLLER_BINDING = getSymbol('pending-controller-binding');
|
|
@@ -2122,6 +2128,12 @@ function controller(name) {
|
|
|
2122
2128
|
registry.set(name, constructor);
|
|
2123
2129
|
// Mark as controller class for channel decorator detection
|
|
2124
2130
|
constructor.prototype[IS_CONTROLLER_CLASS] = true;
|
|
2131
|
+
// Preserve the registry name on the class. Direct class attachments still
|
|
2132
|
+
// skip registry lookup; this is only their inspectable DOM label.
|
|
2133
|
+
Object.defineProperty(constructor, CONTROLLER_REGISTRY_NAME, {
|
|
2134
|
+
value: name,
|
|
2135
|
+
configurable: true
|
|
2136
|
+
});
|
|
2125
2137
|
const pending = snice.pendingControllerAttachments.get(name);
|
|
2126
2138
|
if (pending) {
|
|
2127
2139
|
snice.pendingControllerAttachments.delete(name);
|
|
@@ -2193,6 +2205,52 @@ function controllerLabel(controller) {
|
|
|
2193
2205
|
? controller
|
|
2194
2206
|
: (controller?.name || '(anonymous controller class)');
|
|
2195
2207
|
}
|
|
2208
|
+
/** Registry/decorator name used for a direct class attachment's DOM marker. */
|
|
2209
|
+
function directControllerAttributeName(controllerClass) {
|
|
2210
|
+
const registeredName = Object.prototype.hasOwnProperty.call(controllerClass, CONTROLLER_REGISTRY_NAME)
|
|
2211
|
+
? controllerClass[CONTROLLER_REGISTRY_NAME]
|
|
2212
|
+
: undefined;
|
|
2213
|
+
return typeof registeredName === 'string'
|
|
2214
|
+
? registeredName
|
|
2215
|
+
: controllerLabel(controllerClass);
|
|
2216
|
+
}
|
|
2217
|
+
/**
|
|
2218
|
+
* Write the inspectable controller marker without feeding it back into the
|
|
2219
|
+
* custom-element attribute channel. Native MutationObservers are asynchronous
|
|
2220
|
+
* and are excluded independently by DIRECT_CONTROLLER.
|
|
2221
|
+
*/
|
|
2222
|
+
function writeControllerAttribute(element, value) {
|
|
2223
|
+
if (value === null) {
|
|
2224
|
+
if (!element.hasAttribute('controller'))
|
|
2225
|
+
return;
|
|
2226
|
+
}
|
|
2227
|
+
else if (element.getAttribute('controller') === value) {
|
|
2228
|
+
return;
|
|
2229
|
+
}
|
|
2230
|
+
element[CONTROLLER_ATTRIBUTE_SYNC] = true;
|
|
2231
|
+
try {
|
|
2232
|
+
if (value === null)
|
|
2233
|
+
element.removeAttribute('controller');
|
|
2234
|
+
else
|
|
2235
|
+
element.setAttribute('controller', value);
|
|
2236
|
+
}
|
|
2237
|
+
finally {
|
|
2238
|
+
delete element[CONTROLLER_ATTRIBUTE_SYNC];
|
|
2239
|
+
}
|
|
2240
|
+
}
|
|
2241
|
+
/**
|
|
2242
|
+
* Restore the diagnostic attribute for an attached class controller. Returns
|
|
2243
|
+
* true when the direct class channel owns the element.
|
|
2244
|
+
*/
|
|
2245
|
+
function restoreDirectControllerAttribute(element) {
|
|
2246
|
+
if (!element[DIRECT_CONTROLLER])
|
|
2247
|
+
return false;
|
|
2248
|
+
const source = element[CONTROLLER_NAME_KEY];
|
|
2249
|
+
if (typeof source !== 'function')
|
|
2250
|
+
return false;
|
|
2251
|
+
writeControllerAttribute(element, directControllerAttributeName(source));
|
|
2252
|
+
return true;
|
|
2253
|
+
}
|
|
2196
2254
|
/**
|
|
2197
2255
|
* Attaches a controller to an element
|
|
2198
2256
|
* @param element The element to attach the controller to
|
|
@@ -2222,11 +2280,26 @@ async function attachController(element, controller) {
|
|
|
2222
2280
|
}
|
|
2223
2281
|
if (existingSource === controller && existingController) {
|
|
2224
2282
|
// Already attached and controller exists (name or class reference match)
|
|
2283
|
+
if (typeof controller !== 'string') {
|
|
2284
|
+
restoreDirectControllerAttribute(element);
|
|
2285
|
+
}
|
|
2225
2286
|
return;
|
|
2226
2287
|
}
|
|
2227
2288
|
// If there's an existing controller, detach it first
|
|
2228
2289
|
if (existingController) {
|
|
2229
2290
|
await detachController(element);
|
|
2291
|
+
// Light-DOM reconciliation can issue commit() and reconnected() requests
|
|
2292
|
+
// for the same class while the previous controller is still detaching.
|
|
2293
|
+
// If the other request already installed that exact source, this request
|
|
2294
|
+
// is redundant. Different sources retain the established rapid-switch
|
|
2295
|
+
// behavior and continue through the normal replacement path.
|
|
2296
|
+
const replacement = element[CONTROLLER_KEY];
|
|
2297
|
+
const replacementSource = element[CONTROLLER_NAME_KEY];
|
|
2298
|
+
if (replacement && replacementSource === controller) {
|
|
2299
|
+
if (typeof controller !== 'string')
|
|
2300
|
+
restoreDirectControllerAttribute(element);
|
|
2301
|
+
return;
|
|
2302
|
+
}
|
|
2230
2303
|
}
|
|
2231
2304
|
let ControllerClass;
|
|
2232
2305
|
if (typeof controller === 'string') {
|
|
@@ -2242,13 +2315,16 @@ async function attachController(element, controller) {
|
|
|
2242
2315
|
}
|
|
2243
2316
|
else {
|
|
2244
2317
|
ControllerClass = controller;
|
|
2245
|
-
// The class channel owns the element from here on: the attribute /
|
|
2246
|
-
// MutationObserver channel goes inert and its bookkeeping is dropped.
|
|
2247
|
-
element[DIRECT_CONTROLLER] = true;
|
|
2248
|
-
delete element[NATIVE_CONTROLLER];
|
|
2249
2318
|
}
|
|
2250
2319
|
// Create controller instance with unique ID and scope
|
|
2251
2320
|
const controllerInstance = new ControllerClass();
|
|
2321
|
+
if (typeof controller !== 'string') {
|
|
2322
|
+
// Construction succeeded, so the class channel can safely take ownership.
|
|
2323
|
+
// Setting this before construction would leave a stale observer guard when
|
|
2324
|
+
// a controller constructor throws.
|
|
2325
|
+
element[DIRECT_CONTROLLER] = true;
|
|
2326
|
+
delete element[NATIVE_CONTROLLER];
|
|
2327
|
+
}
|
|
2252
2328
|
snice.controllerIdCounter += 1;
|
|
2253
2329
|
const controllerId = snice.controllerIdCounter;
|
|
2254
2330
|
const scope = new ControllerScope();
|
|
@@ -2267,6 +2343,12 @@ async function attachController(element, controller) {
|
|
|
2267
2343
|
element[CONTROLLER_KEY] = controllerInstance;
|
|
2268
2344
|
element[CONTROLLER_NAME_KEY] = controller;
|
|
2269
2345
|
element[CONTROLLER_OPERATIONS] = scope;
|
|
2346
|
+
if (typeof controller !== 'string') {
|
|
2347
|
+
// The class reference remains the sole attachment authority. This
|
|
2348
|
+
// attribute is diagnostic only; custom-element callbacks and native
|
|
2349
|
+
// MutationObservers are guarded from treating it as a string attachment.
|
|
2350
|
+
restoreDirectControllerAttribute(element);
|
|
2351
|
+
}
|
|
2270
2352
|
// Wait for element to be ready. Race against abort (detachController) and
|
|
2271
2353
|
// a 30s deadline so a caller that forgets to append the element gets a
|
|
2272
2354
|
// clear error instead of an unresolvable promise.
|
|
@@ -2298,6 +2380,9 @@ async function attachController(element, controller) {
|
|
|
2298
2380
|
// attached — otherwise a later attach short-circuits as "already attached"
|
|
2299
2381
|
// and a detach would run detach() on it.
|
|
2300
2382
|
if (element[CONTROLLER_KEY] === controllerInstance) {
|
|
2383
|
+
if (typeof controller !== 'string') {
|
|
2384
|
+
writeControllerAttribute(element, null);
|
|
2385
|
+
}
|
|
2301
2386
|
delete element[CONTROLLER_KEY];
|
|
2302
2387
|
delete element[CONTROLLER_NAME_KEY];
|
|
2303
2388
|
delete element[CONTROLLER_OPERATIONS];
|
|
@@ -2349,6 +2434,12 @@ async function detachController(element) {
|
|
|
2349
2434
|
// controller reassignment) finds no instance and returns, instead of running
|
|
2350
2435
|
// detach() a second time on the same controller. The rest of this function
|
|
2351
2436
|
// works off the locals captured above.
|
|
2437
|
+
if (typeof controllerSource === 'function') {
|
|
2438
|
+
// Remove the class channel's diagnostic marker while its guards are still
|
|
2439
|
+
// active. A queued native MutationObserver therefore sees no attribute and
|
|
2440
|
+
// cannot resurrect a registry attachment after detach.
|
|
2441
|
+
writeControllerAttribute(element, null);
|
|
2442
|
+
}
|
|
2352
2443
|
delete element[CONTROLLER_KEY];
|
|
2353
2444
|
delete element[CONTROLLER_NAME_KEY];
|
|
2354
2445
|
delete element[CONTROLLER_OPERATIONS];
|
|
@@ -2423,8 +2514,12 @@ function useNativeElementControllers() {
|
|
|
2423
2514
|
// attachController(el, Class)). The class channel owns the element:
|
|
2424
2515
|
// attribute writes must not attach over it, and insertion sweeps must
|
|
2425
2516
|
// not detach it.
|
|
2426
|
-
if (element[DIRECT_CONTROLLER])
|
|
2517
|
+
if (element[DIRECT_CONTROLLER]) {
|
|
2518
|
+
// External writes cannot replace a class binding. Keep the DOM marker
|
|
2519
|
+
// honest about the class that is actually attached.
|
|
2520
|
+
restoreDirectControllerAttribute(element);
|
|
2427
2521
|
return;
|
|
2522
|
+
}
|
|
2428
2523
|
const controllerName = element.getAttribute('controller');
|
|
2429
2524
|
const currentControllerName = element[NATIVE_CONTROLLER];
|
|
2430
2525
|
// No change
|
|
@@ -4662,8 +4757,8 @@ class PropertyPart extends Part {
|
|
|
4662
4757
|
* Accepts a controller class decorated with @controller (attached directly,
|
|
4663
4758
|
* no registry lookup) or a registry name string (delegated to the attribute
|
|
4664
4759
|
* channel with the exact semantics of a static controller="name"). While a
|
|
4665
|
-
* class is bound it owns the element: the
|
|
4666
|
-
*
|
|
4760
|
+
* class is bound it owns the element: the decorator name is reflected for
|
|
4761
|
+
* inspection, while the attribute/MutationObserver attach channel stays inert.
|
|
4667
4762
|
*
|
|
4668
4763
|
* Renders commit while the tree is detached and connect afterwards, so
|
|
4669
4764
|
* attachment happens on reconnected()/connected commits; every hook is
|
|
@@ -4702,10 +4797,6 @@ class ControllerPart extends Part {
|
|
|
4702
4797
|
}
|
|
4703
4798
|
}
|
|
4704
4799
|
if (typeof next === 'function') {
|
|
4705
|
-
// Class binding takes over — drop any attribute so the string channel
|
|
4706
|
-
// cannot fight it.
|
|
4707
|
-
if (this.element.hasAttribute('controller'))
|
|
4708
|
-
this.element.removeAttribute('controller');
|
|
4709
4800
|
if (this.isConnected) {
|
|
4710
4801
|
this._apply(next);
|
|
4711
4802
|
}
|
|
@@ -6777,6 +6868,14 @@ function applyElementFunctionality(constructor) {
|
|
|
6777
6868
|
constructor.prototype.attributeChangedCallback = function (name, oldValue, newValue) {
|
|
6778
6869
|
originalAttributeChangedCallback?.call(this, name, oldValue, newValue);
|
|
6779
6870
|
if (name === 'controller') {
|
|
6871
|
+
// A class attachment reflects its decorator name for DOM diagnostics,
|
|
6872
|
+
// but the class reference remains the only attachment authority.
|
|
6873
|
+
if (this[CONTROLLER_ATTRIBUTE_SYNC])
|
|
6874
|
+
return;
|
|
6875
|
+
if (this[DIRECT_CONTROLLER]) {
|
|
6876
|
+
restoreDirectControllerAttribute(this);
|
|
6877
|
+
return;
|
|
6878
|
+
}
|
|
6780
6879
|
this.controller = newValue;
|
|
6781
6880
|
return;
|
|
6782
6881
|
}
|